Skip to content

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

5.3 KB
Raw Blame
-- Automatically generated by Gravitino Spark SQL test
-- !query
select  
   substr(w_warehouse_name,1,20)
  ,sm_type
  ,web_name
  ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end)  as 30days 
  ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and 
                 (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end )  as 31_60days 
  ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and 
                 (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end)  as 61_90days 
  ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and
                 (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end)  as 91_120days 
  ,sum(case when (ws_ship_date_sk - ws_sold_date_sk  > 120) then 1 else 0 end)  as dy120days 
from
   web_sales
  ,warehouse
  ,ship_mode
  ,web_site
  ,date_dim
where
    d_month_seq between 1212 and 1212 + 11
and ws_ship_date_sk   = d_date_sk
and ws_warehouse_sk   = w_warehouse_sk
and ws_ship_mode_sk   = sm_ship_mode_sk
and ws_web_site_sk    = web_site_sk
group by
   substr(w_warehouse_name,1,20)
  ,sm_type
  ,web_name
order by substr(w_warehouse_name,1,20)
        ,sm_type
       ,web_name
limit 100
-- !query schema
struct<substr(w_warehouse_name, 1, 20):string,sm_type:string,web_name:string,30days:bigint,31_60days:bigint,61_90days:bigint,91_120days:bigint,dy120days:bigint>
-- !query output
Bad cards must make.	EXPRESS	site_0	4	3	3	4	0
Bad cards must make.	EXPRESS	site_1	0	3	3	3	0
Bad cards must make.	EXPRESS	site_2	4	5	2	7	0
Bad cards must make.	EXPRESS	site_3	3	5	4	2	0
Bad cards must make.	EXPRESS	site_4	4	5	4	5	0
Bad cards must make.	LIBRARY	site_0	3	1	3	1	0
Bad cards must make.	LIBRARY	site_1	4	5	3	5	0
Bad cards must make.	LIBRARY	site_2	0	2	1	0	0
Bad cards must make.	LIBRARY	site_3	3	1	2	2	0
Bad cards must make.	LIBRARY	site_4	2	2	2	3	0
Bad cards must make.	NEXT DAY	site_0	5	2	2	6	0
Bad cards must make.	NEXT DAY	site_1	3	1	6	1	0
Bad cards must make.	NEXT DAY	site_2	3	4	7	2	0
Bad cards must make.	NEXT DAY	site_3	0	5	6	6	0
Bad cards must make.	NEXT DAY	site_4	1	2	3	1	0
Bad cards must make.	OVERNIGHT	site_0	7	2	4	2	0
Bad cards must make.	OVERNIGHT	site_1	4	2	6	1	0
Bad cards must make.	OVERNIGHT	site_2	1	3	4	1	0
Bad cards must make.	OVERNIGHT	site_3	2	1	7	0	0
Bad cards must make.	OVERNIGHT	site_4	2	5	1	4	0
Bad cards must make.	REGULAR	site_0	3	3	2	3	0
Bad cards must make.	REGULAR	site_1	1	2	0	5	0
Bad cards must make.	REGULAR	site_2	3	5	4	1	0
Bad cards must make.	REGULAR	site_3	6	4	1	1	0
Bad cards must make.	REGULAR	site_4	2	4	3	4	0
Bad cards must make.	TWO DAY	site_0	7	1	2	1	0
Bad cards must make.	TWO DAY	site_1	2	1	2	4	0
Bad cards must make.	TWO DAY	site_2	5	3	1	3	0
Bad cards must make.	TWO DAY	site_3	0	3	1	1	0
Bad cards must make.	TWO DAY	site_4	0	3	2	1	0
Conventional childr	EXPRESS	site_0	7	5	2	1	0
Conventional childr	EXPRESS	site_1	5	4	1	7	0
Conventional childr	EXPRESS	site_2	1	3	2	4	0
Conventional childr	EXPRESS	site_3	2	4	3	1	0
Conventional childr	EXPRESS	site_4	3	5	4	2	0
Conventional childr	LIBRARY	site_0	2	1	5	1	0
Conventional childr	LIBRARY	site_1	2	7	3	2	0
Conventional childr	LIBRARY	site_2	2	2	2	2	0
Conventional childr	LIBRARY	site_3	0	4	2	2	0
Conventional childr	LIBRARY	site_4	2	2	2	2	0
Conventional childr	NEXT DAY	site_0	1	4	5	3	0
Conventional childr	NEXT DAY	site_1	2	2	3	1	0
Conventional childr	NEXT DAY	site_2	6	4	2	4	0
Conventional childr	NEXT DAY	site_3	2	1	1	2	0
Conventional childr	NEXT DAY	site_4	1	7	2	1	0
Conventional childr	OVERNIGHT	site_0	3	3	1	3	0
Conventional childr	OVERNIGHT	site_1	2	3	1	2	0
Conventional childr	OVERNIGHT	site_2	2	3	5	1	0
Conventional childr	OVERNIGHT	site_3	1	6	3	4	0
Conventional childr	OVERNIGHT	site_4	2	2	4	1	0
Conventional childr	REGULAR	site_0	3	4	5	5	0
Conventional childr	REGULAR	site_1	4	1	1	0	0
Conventional childr	REGULAR	site_2	1	2	3	2	0
Conventional childr	REGULAR	site_3	1	1	0	1	0
Conventional childr	REGULAR	site_4	3	2	3	0	0
Conventional childr	TWO DAY	site_0	3	2	6	0	0
Conventional childr	TWO DAY	site_1	3	3	3	1	0
Conventional childr	TWO DAY	site_2	1	3	4	3	0
Conventional childr	TWO DAY	site_3	2	2	3	5	0
Conventional childr	TWO DAY	site_4	1	0	2	1	0
Doors canno	EXPRESS	site_0	4	2	3	3	0
Doors canno	EXPRESS	site_1	3	5	3	5	0
Doors canno	EXPRESS	site_2	2	4	5	2	0
Doors canno	EXPRESS	site_3	3	4	4	6	0
Doors canno	EXPRESS	site_4	2	4	2	5	0
Doors canno	LIBRARY	site_0	5	1	0	2	0
Doors canno	LIBRARY	site_1	6	2	5	9	0
Doors canno	LIBRARY	site_2	4	1	3	4	0
Doors canno	LIBRARY	site_3	3	1	2	5	0
Doors canno	LIBRARY	site_4	2	1	2	0	0
NULL	EXPRESS	site_0	2	1	6	5	0
NULL	EXPRESS	site_1	5	4	2	3	0
NULL	EXPRESS	site_2	4	4	3	5	0
NULL	EXPRESS	site_3	2	6	3	3	0
NULL	EXPRESS	site_4	2	5	3	1	0
NULL	LIBRARY	site_0	1	7	0	1	0
NULL	LIBRARY	site_1	1	4	4	0	0
NULL	LIBRARY	site_2	1	2	5	0	0
NULL	LIBRARY	site_3	1	3	2	9	0
NULL	LIBRARY	site_4	5	3	3	1	0
NULL	NEXT DAY	site_0	1	3	3	1	0
NULL	NEXT DAY	site_1	4	2	2	7	0
NULL	NEXT DAY	site_2	1	2	3	3	0
NULL	NEXT DAY	site_3	5	3	3	1	0
NULL	NEXT DAY	site_4	3	1	2	4	0
NULL	OVERNIGHT	site_0	1	2	5	2	0
NULL	OVERNIGHT	site_1	1	3	1	0	0
NULL	OVERNIGHT	site_2	2	1	2	2	0
NULL	OVERNIGHT	site_3	1	2	1	0	0
NULL	OVERNIGHT	site_4	3	6	2	2	0
NULL	REGULAR	site_0	1	1	0	3	0
NULL	REGULAR	site_1	4	3	1	4	0
NULL	REGULAR	site_2	1	1	1	4	0
NULL	REGULAR	site_3	4	1	0	3	0
NULL	REGULAR	site_4	0	2	3	1	0
NULL	TWO DAY	site_0	0	2	2	1	0
NULL	TWO DAY	site_1	2	4	2	0	0
NULL	TWO DAY	site_2	0	1	3	1	0
NULL	TWO DAY	site_3	1	0	0	0	0
NULL	TWO DAY	site_4	4	5	2	2	0