GoGoWen opened a new issue #7204: URL: https://github.com/apache/incubator-doris/issues/7204
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues. ### Version v0.14 ### What's Wrong? step 1: create table with below sql. CREATE TABLE `m_test` ( `pin_id` bigint(20) NOT NULL COMMENT "", `date_time` datetime NOT NULL COMMENT "", `impressions` bigint(20) SUM NOT NULL COMMENT "", `clicks` bigint(20) SUM NOT NULL COMMENT "", `cost` bigint(20) SUM NOT NULL COMMENT "" ) ENGINE=OLAP AGGREGATE KEY(`pin_id`, `date_time`) COMMENT "OLAP" PARTITION BY RANGE(`date_time`) (PARTITION p202011 VALUES [('0000-01-01 00:00:00'), ('2020-12-01 00:00:00')), PARTITION p202012 VALUES [('2020-12-01 00:00:00'), ('2021-01-01 00:00:00')), PARTITION p202101 VALUES [('2021-01-01 00:00:00'), ('2021-02-01 00:00:00')), PARTITION p202102 VALUES [('2021-02-01 00:00:00'), ('2021-03-01 00:00:00')), PARTITION p202103 VALUES [('2021-03-01 00:00:00'), ('2021-04-01 00:00:00')), PARTITION p202104 VALUES [('2021-04-01 00:00:00'), ('2021-05-01 00:00:00')), PARTITION p202105 VALUES [('2021-05-01 00:00:00'), ('2021-06-01 00:00:00')), PARTITION p202108 VALUES [('2021-06-01 00:00:00'), ('2021-09-01 00:00:00')), PARTITION p202109 VALUES [ ('2021-09-01 00:00:00'), ('2021-10-01 00:00:00'))) DISTRIBUTED BY HASH(`pin_id`) BUCKETS 16 PROPERTIES ( "replication_num" = "3", "in_memory" = "false", "storage_format" = "V2" ); step 2: query with below sql desc select sum(case when 1=1 then pin_id else pin_id end) from m_test; step3: current result is: +---------------------------------------------------------------------------------+ | Explain String | +---------------------------------------------------------------------------------+ | PLAN FRAGMENT 0 | | OUTPUT EXPRS: sum(`pin_id`) | | PARTITION: UNPARTITIONED | | | | RESULT SINK | | | | 3:AGGREGATE (merge finalize) | | | output: sum( sum(`pin_id`)) | | | group by: | | | | | 2:EXCHANGE | | | | PLAN FRAGMENT 1 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | | | STREAM DATA SINK | | EXCHANGE ID: 02 | | UNPARTITIONED | | | | 1:AGGREGATE (update serialize) | | | output: sum(`pin_id`) | | | group by: | | | | | 0:OlapScanNode | | TABLE: m_test | | PREAGGREGATION: OFF. Reason: Aggregate Operator not match: SUM <--> null | | partitions=1/9 | | rollup: m_test | | tabletRatio=16/16 | | tabletList=13538,13542,13546,13550,13554,13558,13562,13566,13570,13574 ... | | cardinality=0 | | avgRowSize=0.0 | | numNodes=1 | +---------------------------------------------------------------------------------+ ### What You Expected? expected result is: +-----------------------------------------------------------------------------------------------------------------------------------+ | Explain String | +-----------------------------------------------------------------------------------------------------------------------------------+ | PLAN FRAGMENT 0 | | OUTPUT EXPRS: sum(`pin_id`) | | PARTITION: UNPARTITIONED | | | | RESULT SINK | | | | 3:AGGREGATE (merge finalize) | | | output: sum( sum(`pin_id`)) | | | group by: | | | | | 2:EXCHANGE | | | | PLAN FRAGMENT 1 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | | | STREAM DATA SINK | | EXCHANGE ID: 02 | | UNPARTITIONED | | | | 1:AGGREGATE (update serialize) | | | output: sum(`pin_id`) | | | group by: | | | | | 0:OlapScanNode | | TABLE: m_test | | PREAGGREGATION: OFF. Reason: the type of agg on StorageEngine's Key column should only be MAX or MIN.agg expr: sum(`pin_id`) | | partitions=1/9 | | rollup: m_test | | tabletRatio=16/16 | | tabletList=13538,13542,13546,13550,13554,13558,13562,13566,13570,13574 ... | | cardinality=1 | | avgRowSize=756.0 | | numNodes=3 | +-----------------------------------------------------------------------------------------------------------------------------------+ ### How to Reproduce? _No response_ ### Anything Else? _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
