englefly commented on code in PR #49257: URL: https://github.com/apache/doris/pull/49257#discussion_r2004698359
########## regression-test/suites/empty_relation/eliminate_empty.groovy: ########## @@ -320,4 +320,177 @@ suite("eliminate_empty") { sql """drop table if exists table_5_undef_partitions2_keys3""" sql """drop table if exists table_10_undef_partitions2_keys3""" } + + // union(A, empty) => A + sql """ + set disable_nereids_rules=''; + drop table dwd_bill_fact_bill_standard_info; + drop table ods_bill_fact_bill_jingdong_coupon; + CREATE TABLE `dwd_bill_fact_bill_standard_info` ( + `tenant_id` bigint NULL, + `event_day` date NULL, + `platform` varchar(60) NULL, + `trade_order_no` varchar(192) NULL, + `bill_order_no` varchar(150) NULL, + `item_type` varchar(256) NULL, + `fa_type` varchar(384) NULL, + `id` bigint NULL, + `bill_name` varchar(150) NULL, + `bill_platform` varchar(60) NULL, + `sub_bill_platform` varchar(20) NULL COMMENT '平台子类型 ', + `account_no` varchar(150) NULL, + `shop_id` bigint NULL, + `shop_name` varchar(150) NULL, + `business_year` int NULL, + `business_mouth` int NULL, + `import_date` datetime NULL, + `input_method` varchar(60) NULL, + `import_code` bigint NULL, + `import_name` varchar(60) NULL, + `original_order_no` varchar(150) NULL, + `refund_order_no` varchar(50) NULL COMMENT '退款单号 ', + `bill_type` varchar(60) NULL, + `fa_order_no` varchar(120) NULL, + `sub_fa_type` text NULL, + `time_of_expense` datetime NULL, + `refund_time` datetime NULL COMMENT '退款时间 ', + `fa_settlement_time` datetime NULL, + `goods_name` varchar(765) NULL, + `opt_pay_account` varchar(150) NULL, + `account_name` varchar(150) NULL, + `actual_amount` decimal(19,4) NULL, + `income_out_direction` tinyint NULL, + `balance` decimal(19,4) NULL, + `amount_unit` varchar(30) NULL, + `amount_field_name` varchar(128) NULL COMMENT '金额字段名称 ', + `currency_id` int NULL, + `currency` varchar(30) NULL, + `business_channel` varchar(120) NULL, + `document_type` varchar(30) NULL, + `remark` varchar(765) NULL, + `abstracts` varchar(765) NULL, + `sub_order_no` varchar(150) NULL, + `seq` tinyint NULL, + `original_id` bigint NULL, + `original_goods_id` bigint NULL, + `plat_spec_id` bigint NULL COMMENT '平台规格ID ', + `create_time` datetime NULL, + `update_time` datetime NULL, + `creator_id` bigint NULL, + `updater_id` bigint NULL, + `version_no` bigint NULL, + `is_delete_doris` tinyint NULL COMMENT 'doris删除标记' + ) ENGINE=OLAP + UNIQUE KEY(`tenant_id`, `event_day`, `platform`, `trade_order_no`, `bill_order_no`, `item_type`, `fa_type`) + DISTRIBUTED BY HASH(`platform`) BUCKETS 1 + properties("replication_num" = "1"); + + CREATE TABLE `ods_bill_fact_bill_jingdong_coupon` ( + `tenant_id` bigint NOT NULL COMMENT '商户号', + `event_day` date NOT NULL COMMENT '分区', + `shop_id` bigint NOT NULL COMMENT '商店id', + `bill_coupon_id` varchar(150) NOT NULL COMMENT '生成优惠券号', + `coupon_name` varchar(765) NULL COMMENT '优惠券名称', + `shop_name` varchar(765) NULL COMMENT '店铺名称', + `effect_date` varchar(150) NULL COMMENT '作用日期', + `coupon_type` varchar(150) NULL COMMENT '优惠券类型', + `coupon_batch_code` varchar(150) NULL, + `coupon_code` varchar(150) NULL COMMENT '优惠券码', + `sku_id` varchar(150) NULL, + `money` decimal(19,4) NULL COMMENT '优惠券金额', + `contribute_party` varchar(150) NULL COMMENT '承担方', + `occur_time` datetime NULL, + `billing_time` datetime NULL, + `fee_settlement_time` datetime NULL, + `fa_settlement_time` datetime NULL COMMENT '业务日期', + `settlement_status` varchar(150) NULL COMMENT '结算状态', + `account_id` varchar(150) NULL COMMENT '账户id', + `account_no` varchar(150) NULL COMMENT '账号', + `trade_order_no` varchar(150) NULL COMMENT '商品编号', + `create_time` datetime NULL COMMENT '创建时间', + `update_time` datetime NULL COMMENT '修改时间', + `creator_id` bigint NULL COMMENT '创建人', + `updater_id` bigint NULL COMMENT '分区', + `currency_id` int NULL COMMENT '分区', + `version_no` bigint NULL COMMENT '分区', + `is_delete_doris` tinyint NULL COMMENT 'doris删除标记', + `summary_number` varchar(150) NULL + ) ENGINE=OLAP + UNIQUE KEY(`tenant_id`, `event_day`, `shop_id`, `bill_coupon_id`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`shop_id`) BUCKETS 1 + properties("replication_num" = "1"); + + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-10',-21911.4800); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-18',2592.5400); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-30',2218.4700); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-12',2940.4100); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-20',-25357.9600); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-24',-10754.1800); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-06',3089.6400); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-09',3066.7900); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-17',2271.7500); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-27',2290.4900); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-29',2363.7300); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-03',3664.7300); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-05',3014.6100); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-23',3175.2100); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-15',2622.6600); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-07',3444.7800); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-19',3348.2700); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-31',2003.6000); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-13',3981.9000); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-21',2850.0000); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-01',2543.0300); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-11',3671.9000); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-25',3303.3500); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-08',2510.0500); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-16',2869.5100); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-28',2405.4000); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-02',-65854.8900); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-04',3229.0900); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-14',1486.5400); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-22',3476.0100); + insert into dwd_bill_fact_bill_standard_info(tenant_id,shop_id,event_day,actual_amount) values(1548,102,'2025-01-26',2745.2200); + set parallel_pipeline_task_num=1; + """ + + sql """ Review Comment: we check plan in ut. in this case, the main purpose is to make sure this sql does not lead to BE core -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org