Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

3.2 KB
Raw Blame
-- Automatically generated by Gravitino Spark SQL test
-- !query
with ss as (
 select
          i_item_id,sum(ss_ext_sales_price) total_sales
 from
 	store_sales,
 	date_dim,
         customer_address,
         item
 where
         i_item_id in (select
  i_item_id
from
 item
where i_category in ('Children'))
 and     ss_item_sk              = i_item_sk
 and     ss_sold_date_sk         = d_date_sk
 and     d_year                  = 1999
 and     d_moy                   = 9
 and     ss_addr_sk              = ca_address_sk
 and     ca_gmt_offset           = -6 
 group by i_item_id),
 cs as (
 select
          i_item_id,sum(cs_ext_sales_price) total_sales
 from
 	catalog_sales,
 	date_dim,
         customer_address,
         item
 where
         i_item_id               in (select
  i_item_id
from
 item
where i_category in ('Children'))
 and     cs_item_sk              = i_item_sk
 and     cs_sold_date_sk         = d_date_sk
 and     d_year                  = 1999
 and     d_moy                   = 9
 and     cs_bill_addr_sk         = ca_address_sk
 and     ca_gmt_offset           = -6 
 group by i_item_id),
 ws as (
 select
          i_item_id,sum(ws_ext_sales_price) total_sales
 from
 	web_sales,
 	date_dim,
         customer_address,
         item
 where
         i_item_id               in (select
  i_item_id
from
 item
where i_category in ('Children'))
 and     ws_item_sk              = i_item_sk
 and     ws_sold_date_sk         = d_date_sk
 and     d_year                  = 1999
 and     d_moy                   = 9
 and     ws_bill_addr_sk         = ca_address_sk
 and     ca_gmt_offset           = -6
 group by i_item_id)
  select   
  i_item_id
,sum(total_sales) total_sales
 from  (select * from ss 
        union all
        select * from cs 
        union all
        select * from ws) tmp1
 group by i_item_id
 order by i_item_id
      ,total_sales
 limit 100
-- !query schema
struct<i_item_id:string,total_sales:decimal(27,2)>
-- !query output
AAAAAAAAADCCAAAA	2436.18
AAAAAAAAAHJDAAAA	2018.80
AAAAAAAAAIGDAAAA	3594.50
AAAAAAAAAKLBAAAA	4472.87
AAAAAAAAAKNCAAAA	2165.80
AAAAAAAAALJDAAAA	5841.00
AAAAAAAAALMCAAAA	2641.40
AAAAAAAAALPCAAAA	35.52
AAAAAAAAANHDAAAA	986.53
AAAAAAAAANIBAAAA	3609.64
AAAAAAAACEGBAAAA	8273.20
AAAAAAAACFDBAAAA	1980.18
AAAAAAAACMOAAAAA	328.56
AAAAAAAACPADAAAA	1162.50
AAAAAAAAEDDDAAAA	296.01
AAAAAAAAEFNAAAAA	999.36
AAAAAAAAEMCEAAAA	187.20
AAAAAAAAEPPDAAAA	1163.28
AAAAAAAAFJMCAAAA	1779.52
AAAAAAAAGHNCAAAA	623.20
AAAAAAAAGIGCAAAA	229.44
AAAAAAAAGLEEAAAA	1857.60
AAAAAAAAHCGBAAAA	2093.25
AAAAAAAAHJKCAAAA	6768.96
AAAAAAAAHLDBAAAA	1248.80
AAAAAAAAIAIAAAAA	7255.28
AAAAAAAAIDACAAAA	1543.92
AAAAAAAAIDPCAAAA	52.48
AAAAAAAAIFAEAAAA	1642.00
AAAAAAAAIFOCAAAA	503.04
AAAAAAAAIJLAAAAA	4662.00
AAAAAAAAILGAAAAA	27.03
AAAAAAAAILIBAAAA	3112.97
AAAAAAAAIPKBAAAA	0.00
AAAAAAAAKJIBAAAA	116.44
AAAAAAAALJEBAAAA	1527.28
AAAAAAAALNJBAAAA	216.32
AAAAAAAAMENDAAAA	1661.25
AAAAAAAAMEOBAAAA	3.20
AAAAAAAAMGMBAAAA	83.80
AAAAAAAAMHHDAAAA	96.28
AAAAAAAAMLIBAAAA	4823.72
AAAAAAAAMNOBAAAA	89.50
AAAAAAAAMPKDAAAA	3125.50
AAAAAAAANAFBAAAA	8257.34
AAAAAAAANAFEAAAA	232.90
AAAAAAAANMECAAAA	151.11
AAAAAAAAOAFBAAAA	3811.50
AAAAAAAAOEEBAAAA	46.59
AAAAAAAAOFHAAAAA	320.25
AAAAAAAAOMKBAAAA	5627.16
AAAAAAAAPNPAAAAA	7178.49