github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query76.sql (about) 1 -- Licensed to the Apache Software Foundation (ASF) under one 2 -- or more contributor license agreements. See the NOTICE file 3 -- distributed with this work for additional information 4 -- regarding copyright ownership. The ASF licenses this file 5 -- to you under the Apache License, Version 2.0 (the 6 -- "License"); you may not use this file except in compliance 7 -- with the License. You may obtain a copy of the License at 8 -- 9 -- http://www.apache.org/licenses/LICENSE-2.0 10 -- 11 -- Unless required by applicable law or agreed to in writing, software 12 -- distributed under the License is distributed on an "AS IS" BASIS, 13 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 -- See the License for the specific language governing permissions and 15 -- limitations under the License. 16 17 select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( 18 SELECT 'store' as channel, 'ss_addr_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price 19 FROM store_sales, item, date_dim 20 WHERE ss_addr_sk IS NULL 21 AND ss_sold_date_sk=d_date_sk 22 AND ss_item_sk=i_item_sk 23 UNION ALL 24 SELECT 'web' as channel, 'ws_web_page_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price 25 FROM web_sales, item, date_dim 26 WHERE ws_web_page_sk IS NULL 27 AND ws_sold_date_sk=d_date_sk 28 AND ws_item_sk=i_item_sk 29 UNION ALL 30 SELECT 'catalog' as channel, 'cs_warehouse_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price 31 FROM catalog_sales, item, date_dim 32 WHERE cs_warehouse_sk IS NULL 33 AND cs_sold_date_sk=d_date_sk 34 AND cs_item_sk=i_item_sk) foo 35 GROUP BY channel, col_name, d_year, d_qoy, i_category 36 ORDER BY channel, col_name, d_year, d_qoy, i_category 37 limit 100