Skip to content

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

1.7 KB
Raw Blame
-- Automatically generated by Gravitino Spark SQL test
-- !query
select  ss_customer_sk
            ,sum(act_sales) sumsales
      from (select ss_item_sk
                  ,ss_ticket_number
                  ,ss_customer_sk
                  ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price
                                                            else (ss_quantity*ss_sales_price) end act_sales
            from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk
                                                               and sr_ticket_number = ss_ticket_number)
                ,reason
            where sr_reason_sk = r_reason_sk
              and r_reason_desc = 'Did not like the warranty') t
      group by ss_customer_sk
      order by sumsales, ss_customer_sk
limit 100
-- !query schema
struct<ss_customer_sk:bigint,sumsales:decimal(38,2)>
-- !query output
10619	6.18
11464	92.72
13636	169.11
15564	55.96
15667	1023.44
16000	18.58
20647	2012.49
21518	311.85
22796	194.25
24744	1162.42
24985	1342.75
25761	0.00
26197	115.44
26569	158.83
31370	3959.93
31823	940.17
33223	4473.77
34598	796.20
36205	31.17
36676	690.99
37691	947.52
40218	34.90
41211	125.44
4127	199.80
41646	506.92
42975	228.32
43915	716.82
47354	NULL
48157	34.72
48579	566.95
48656	1077.58
497	514.46
51161	81.00
53099	549.90
53227	561.73
53417	62.16
57221	2093.04
58002	0.00
58716	878.24
58905	420.48
63774	234.60
63808	16.86
65139	NULL
65242	395.85
68042	608.40
68335	79.00
68494	2906.31
69252	1805.76
69371	803.14
71722	3591.00
73251	147.28
76792	1892.55
78064	4600.01
78110	2366.32
80402	8.56
81304	2593.68
8232	2031.68
83885	0.00
84518	1417.02
89420	16.04
91248	410.20
94402	265.54
95148	NULL
96898	415.34
98692	90.00
NULL	2991.20