World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
-- Automatically generated by Gravitino Spark SQL test
-- !query
with ss as (
select
i_manufact_id,sum(ss_ext_sales_price) total_sales
from
store_sales,
date_dim,
customer_address,
item
where
i_manufact_id in (select
i_manufact_id
from
item
where i_category in ('Books'))
and ss_item_sk = i_item_sk
and ss_sold_date_sk = d_date_sk
and d_year = 1999
and d_moy = 3
and ss_addr_sk = ca_address_sk
and ca_gmt_offset = -5
group by i_manufact_id),
cs as (
select
i_manufact_id,sum(cs_ext_sales_price) total_sales
from
catalog_sales,
date_dim,
customer_address,
item
where
i_manufact_id in (select
i_manufact_id
from
item
where i_category in ('Books'))
and cs_item_sk = i_item_sk
and cs_sold_date_sk = d_date_sk
and d_year = 1999
and d_moy = 3
and cs_bill_addr_sk = ca_address_sk
and ca_gmt_offset = -5
group by i_manufact_id),
ws as (
select
i_manufact_id,sum(ws_ext_sales_price) total_sales
from
web_sales,
date_dim,
customer_address,
item
where
i_manufact_id in (select
i_manufact_id
from
item
where i_category in ('Books'))
and ws_item_sk = i_item_sk
and ws_sold_date_sk = d_date_sk
and d_year = 1999
and d_moy = 3
and ws_bill_addr_sk = ca_address_sk
and ca_gmt_offset = -5
group by i_manufact_id)
select i_manufact_id ,sum(total_sales) total_sales
from (select * from ss
union all
select * from cs
union all
select * from ws) tmp1
group by i_manufact_id
order by total_sales
limit 100
-- !query schema
struct<i_manufact_id:bigint,total_sales:decimal(27,2)>
-- !query output
118 10013.31
124 2784.38
134 2143.68
135 6062.40
141 2025.00
150 793.98
151 1136.85
154 100.88
16 9517.74
162 8420.40
164 1490.76
165 1223.60
188 3229.20
19 782.08
197 6842.64
219 2421.65
220 2782.56
221 1365.44
231 0.00
251 24.88
252 10870.40
256 266.90
261 168.60
266 NULL
286 256.41
291 1997.06
321 4621.50
35 1202.85
359 2116.26
36 2398.88
370 1100.67
392 951.73
40 184.10
417 29.65
443 7104.24
456 722.40
507 67.08
51 365.97
521 360.00
53 2369.01
567 806.93
57 135.33
614 2227.72
619 390.00
624 6481.17
685 4736.52
7 672.90
74 124.20
82 7.68
97 45.22