The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
3. EXPLAIN
```sql
explain logical
select
date_format(t1.create_time, '%y-%m-%d') as stat_date,
t1.shop_id,
sum(t1.order_gift_coin_num),
sum(t1.give_coin_num),
sum(t1.discount_ticket_amount),
ifnull(sum(t2.group_meituan_sale_coin_num), 0),
ifnull(sum(t2.coin_order_amount), 0)
from
test_ind_order t1
left join (
select
t3.stat_date,
t3.shop_id,
sum(t3.group_meituan_sale_coin_num) group_meituan_sale_coin_num,
sum(t3.coin_order_amount) coin_order_amount
from
test_ind_shop t3
where
t3.stat_date >= '2020-01-01'
and t3.stat_date < '2020-02-01'
and t3.shop_id = '9102a162-ee65-48e7-a543-c2d6ed0275e6'
group by
t3.stat_date,
t3.shop_id) t2 on
t1.shop_id = t2.shop_id
and t2.stat_date = date_format(t1.create_time, '%y-%m-%d')
where
t1.create_time >= '2020-01-01'
and t1.create_time < '2020-02-01'
and t1.shop_id = '9102a162-ee65-48e7-a543-c2d6ed0275e6'
group by
date_format(t1.create_time, '%y-%m-%d'),
t1.shop_id
order by
stat_date,t1.shop_id desc limit 20
Expected behavior (Required)
The result should contain cpu and memory metric values
Steps to reproduce the behavior (Required)
CREATE TABLE
test_ind_shop
(stat_date
date NOT NULL ,shop_id
varchar(50) NOT NULL ,merchant_id
varchar(50) NULL ,shop_name
varchar(50) NULL ,province_code
int(11) NULL ,province_name
varchar(50) NULL ,city_code
int(11) NULL ,city_name
varchar(50) NULL ,area_code
int(11) NULL ,area_name
varchar(50) NULL ,shop_level
int(11) NULL ,shop_level_name
varchar(50) NULL ,shop_property
int(11) NULL ,shop_property_name
varchar(50) NULL ,group_wechat_sale_coin_num
decimal(20, 0) NULL ,group_wechat_gift_coin_num
decimal(20, 0) NULL ,group_koubei_sale_coin_num
decimal(20, 0) NULL ,group_koubei_gift_coin_num
decimal(20, 0) NULL ,group_meituan_sale_coin_num
decimal(20, 0) NULL ,group_meituan_gift_coin_num
decimal(20, 0) NULL ,group_tmall_sale_coin_num
decimal(20, 0) NULL ,group_tmall_gift_coin_num
decimal(20, 0) NULL ,group_douyin_sale_coin_num
decimal(20, 0) NULL ,group_douyin_gift_coin_num
decimal(20, 0) NULL ,coin_order_sale_coin_num
decimal(20, 0) NULL ,coin_order_gift_coin_num
decimal(20, 0) NULL ,temp_coin_order_sale_coin_num
decimal(20, 0) NULL ,temp_coin_order_gift_coin_num
decimal(20, 0) NULL ,exchange_sale_coin_num
decimal(20, 0) NULL ,exchange_gift_coin_num
decimal(20, 0) NULL ,mem_mkt_gift_coin_num
decimal(20, 0) NULL ,smp_gift_coin_num
decimal(20, 0) NULL ,coupon_gift_coin_num
decimal(20, 0) NULL ,ecode_gift_coin_num
decimal(20, 0) NULL ,hand_coin_sale_coin_num
decimal(20, 0) NULL ,sale_gift_coin_num
decimal(20, 0) NULL ,begin_deposit_coin_num
decimal(20, 0) NULL ,end_deposit_coin_num
decimal(20, 0) NULL ,machine_receive_coin_num
decimal(20, 0) NULL ,coin_order_amount
decimal(20, 6) NULL ,verification_group_amount
decimal(20, 6) NULL ,per_coin_price
decimal(20, 6) NULL ,create_time
datetime NULL ,create_at
int(11) NULL ,update_at
datetime NULL ,issue_card_gift_coin_num
decimal(20, 0) NULL ,region_name
varchar(50) NULL ,precinct_name
varchar(50) NULL ,exchange_save_lottery_num
decimal(20, 0) NULL ,machine_ele_lottery_num
decimal(20, 0) NULL ,non_ele_lottery_num
decimal(20, 0) NULL ,self_machine_lottery_num
decimal(20, 0) NULL ,activity_gift_lottery_num
decimal(20, 0) NULL ,exchange_redeem_lottery_num
decimal(20, 0) NULL ,jingdong_redeem_lottery_num
decimal(20, 0) NULL ,wechat_redeem_lottery_num
decimal(20, 0) NULL ,invalid_lottery_num
decimal(20, 0) NULL ,expire_lottery_num
decimal(20, 0) NULL ,no_machine_coin_num
decimal(20, 0) NULL ,virtual_machine_coin_num
decimal(20, 0) NULL ,goods_num
decimal(20, 0) NULL ,exch_coin_num
decimal(20, 0) NULL ,total_order_amount
decimal(20, 6) NULL ,total_order_num
decimal(20, 0) NULL ,mem_first_order_num
decimal(20, 0) NULL ,mem_first_order_amount
decimal(20, 6) NULL ,mem_repeat_order_num
decimal(20, 0) NULL ,mem_repeat_order_amount
decimal(20, 6) NULL ,segment0
decimal(20, 0) NULL ,segment1
decimal(20, 0) NULL ,segment2
decimal(20, 0) NULL ,segment3
decimal(20, 0) NULL ,segment4
decimal(20, 0) NULL ,segment5
decimal(20, 0) NULL ,segment6
decimal(20, 0) NULL ,segment7
decimal(20, 0) NULL ,mem_mem_num
int(11) NULL ,active_mem_num
int(11) NULL ,mem_order_amount
decimal(20, 6) NULL ,mem_order_num
decimal(20, 0) NULL ) ENGINE=OLAP PRIMARY KEY(stat_date
,shop_id
) DISTRIBUTED BY HASH(shop_id
) BUCKETS 100 ORDER BY(shop_id
) PROPERTIES ( "colocate_with" = "shop_group", "compression" = "LZ4", "enable_persistent_index" = "true", "fast_schema_evolution" = "true", "replicated_storage" = "true", "replication_num" = "2" );Expected behavior (Required)
The result should contain cpu and memory metric values
Real behavior (Required)
StarRocks version (Required)