xy720 opened a new issue #4692: URL: https://github.com/apache/incubator-doris/issues/4692
**Describe the bug** Duplicate columns will appear in case when statement. **To Reproduce** Steps to reproduce the behavior: 1. create table ``` +----------------------+-------------+------+-------+---------------------+---------+ | Field | Type | Null | Key | Default | Extra | +----------------------+-------------+------+-------+---------------------+---------+ | event_day | INT | No | true | NULL | | | event_hour | TINYINT | No | true | 0 | | | event_minute | TINYINT | No | true | 0 | | | event_time | DATETIME | No | true | 1970-01-01 00:00:00 | | | search_page | VARCHAR(30) | No | true | | | | search_source | TINYINT | No | true | 0 | | | soft_version | VARCHAR(30) | No | true | | | | not_arrived_category | VARCHAR(30) | No | true | | | | pv | FLOAT | No | false | 0 | REPLACE | +----------------------+-------------+------+-------+---------------------+---------+ ``` ``` CREATE TABLE `baiduapp_strategy_performance_search_ios_arrive` ( `event_day` int(11) NOT NULL COMMENT "日期,如20191016", `event_hour` tinyint(4) NOT NULL DEFAULT "0" COMMENT "小时,如8", `event_minute` tinyint(4) NOT NULL DEFAULT "0" COMMENT "分钟,如59", `event_time` datetime NOT NULL DEFAULT "1970-01-01 00:00:00" COMMENT "隶属时间(区间查询用)", `search_page` varchar(30) NOT NULL DEFAULT "" COMMENT "page来源", `search_source` tinyint(4) NOT NULL DEFAULT "0" COMMENT "search_source来源", `soft_version` varchar(30) NOT NULL DEFAULT "" COMMENT "APP版本,如11.15.0.2", `not_arrived_category` varchar(30) NOT NULL DEFAULT "" COMMENT "未到达原因", `pv` float NOT NULL DEFAULT "0" COMMENT "聚合pv数" ) ENGINE=OLAP UNIQUE KEY(`event_day`, `event_hour`, `event_minute`, `event_time`, `search_page`, `search_source`, `soft_version`, `not_arrived_category`) COMMENT "OLAP" PARTITION BY RANGE(`event_day`) (PARTITION p202006 VALUES [("20200601"), ("20200701")), PARTITION p202007 VALUES [("20200701"), ("20200801")), PARTITION p202008 VALUES [("20200801"), ("20200901")), PARTITION p202009 VALUES [("20200901"), ("20201001")), PARTITION p202010 VALUES [("20201001"), ("20201101")), PARTITION p202011 VALUES [("20201101"), ("20201201")), PARTITION p202012 VALUES [("20201201"), ("20210101"))) DISTRIBUTED BY HASH(`event_day`) BUCKETS 16 PROPERTIES ( "replication_num" = "3", "in_memory" = "false", "storage_format" = "V2" ); ``` 2. execute sql ``` explain select case when 2 < 1 then 'all' else search_source end as search_source, soft_version from baiduapp_strategy_performance_search_ios_arrive group by search_source, soft_version; ``` 3. print explain answer ``` +-------------------------------------------------------------------------------------------+ | Explain String | +-------------------------------------------------------------------------------------------+ | PLAN FRAGMENT 0 | | OUTPUT EXPRS: `search_source` | `search_source` | | PARTITION: UNPARTITIONED | | | | RESULT SINK | | | | 4:EXCHANGE | | | | PLAN FRAGMENT 1 | | OUTPUT EXPRS: | | PARTITION: HASH_PARTITIONED: `search_source`, <slot 2> `soft_version` | | | | STREAM DATA SINK | | EXCHANGE ID: 04 | | UNPARTITIONED | | | | 3:AGGREGATE (merge finalize) | | | group by: `search_source`, <slot 2> `soft_version` | | | | | 2:EXCHANGE | | | | PLAN FRAGMENT 2 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | | | STREAM DATA SINK | | EXCHANGE ID: 02 | | HASH_PARTITIONED: `search_source`, <slot 2> `soft_version` | | | | 1:AGGREGATE (update serialize) | | | STREAMING | | | group by: `search_source`, `soft_version` | | | | | 0:OlapScanNode | | TABLE: baiduapp_strategy_performance_search_ios_arrive | | PREAGGREGATION: ON | | partitions=1/7 | | rollup: baiduapp_strategy_performance_search_ios_arrive | | tabletRatio=16/16 | | tabletList=129434,129438,129442,129446,129450,129454,129458,129462,129466,129470 ... | | cardinality=2 | | avgRowSize=882.0 | | numNodes=3 | +-------------------------------------------------------------------------------------------+ ``` 4. You can see there are two output expr `search_source` in PLAN FRAGMENT 0 **Expected behavior** The output expr should be `search_source` and `soft_version` ---------------------------------------------------------------- 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. 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