xiedeyantu opened a new issue, #55413: URL: https://github.com/apache/doris/issues/55413
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Version master branch ### What's Wrong? ``` CREATE TABLE `emp` ( `empno` int NULL, `ename` varchar(10) NOT NULL, `job` varchar(9) NULL, `mgr` int NULL, `hiredate` date NULL, `sal` decimal(7,2) NULL, `comm` decimal(7,2) NULL, `deptno` int NULL ) ENGINE=OLAP DUPLICATE KEY(`empno`) DISTRIBUTED BY HASH(`empno`) BUCKETS 10 PROPERTIES ( "replication_allocation" = "tag.location.default: 1" ); ``` Plan and result: ``` mysql> explain logical plan select sum(empno) from EMP where false group by grouping sets((),()); +--------------------------------------------------------------------------------------------------------------------------------------------+ | Explain String(Nereids Planner) | +--------------------------------------------------------------------------------------------------------------------------------------------+ | LogicalResultSink[105] ( outputExprs=[__sum_0#10] ) | | +--LogicalProject[104] ( distinct=false, projects=[sum(empno)#10] ) | | +--LogicalAggregate[103] ( groupByExpr=[GROUPING_ID#11], outputExpr=[GROUPING_ID#11, sum(empno#0) AS `sum(empno)`#10], hasRepeat=true ) | | +--LogicalRepeat ( groupingSets=[[], []], outputExpressions=[empno#0, GROUPING_ID#11] ) | | +--LogicalEmptyRelation ( projects=[empno#0] ) | +--------------------------------------------------------------------------------------------------------------------------------------------+ 5 rows in set (0.00 sec) mysql> explain logical plan select sum(empno) from EMP where false group by grouping sets(()); +-----------------------------------------------------------------------------------------------------------+ | Explain String(Nereids Planner) | +-----------------------------------------------------------------------------------------------------------+ | LogicalResultSink[56] ( outputExprs=[__sum_0#10] ) | | +--LogicalAggregate[55] ( groupByExpr=[], outputExpr=[sum(empno#0) AS `sum(empno)`#10], hasRepeat=false ) | | +--LogicalEmptyRelation ( projects=[empno#0] ) | +-----------------------------------------------------------------------------------------------------------+ 3 rows in set (0.01 sec) mysql> select sum(empno) from EMP where false group by grouping sets((),()); Empty set (0.04 sec) <------- If executed using pgsql, a NULL value should be returned. mysql> select sum(empno) from EMP where false group by grouping sets(()); +------------+ | sum(empno) | +------------+ | NULL | +------------+ 1 row in set (0.02 sec) ``` ### What You Expected? mysql> select sum(empno) from EMP where false group by grouping sets((),()); +------------+ | sum(empno) | +------------+ | NULL | +------------+ ### How to Reproduce? _No response_ ### Anything Else? _No response_ ### Are you willing to submit PR? - [ ] 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]
