FrankZhang996 opened a new issue, #30109:
URL: https://github.com/apache/doris/issues/30109

   ### 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
   
   1.2.5-rc01
   
   ### What's Wrong?
   
   doris对select中的字段进行了常量折叠  对于grouping中和grouping sets中的字段没有进行常量折叠 [Bug] 
   以下语法会报错:
   SELECT
        (
        CASE
                        
                        WHEN to_date ( DAY ) <= CURRENT_DATE ()- 1 AND to_date 
( DAY ) >= CURRENT_DATE ()- 7 THEN
                        '本周' 
                        WHEN to_date ( DAY ) <= CURRENT_DATE ()- 8 AND to_date 
( DAY ) >= CURRENT_DATE ()- 14 THEN
                        '上周' 
                END 
                ),
                grouping (
                CASE
                                
                                WHEN to_date ( DAY ) <= CURRENT_DATE ()- 1 AND 
to_date ( DAY ) >= CURRENT_DATE ()- 7 THEN
                                '本周' 
                                WHEN to_date ( DAY ) <= CURRENT_DATE ()- 8 AND 
to_date ( DAY ) >= CURRENT_DATE ()- 14 THEN
                                '上周' 
                        END 
                        ),
                        count( `apv_apply_no` ) 
                FROM
                        bolt_202401041830aa9462b1be4dd8a02fa65ab1bbcd78 
                GROUP BY
                        grouping sets ((
                                CASE
                                                WHEN to_date ( DAY ) <= 
CURRENT_DATE ()- 1 AND to_date ( DAY ) >= CURRENT_DATE ()- 7 THEN
                                                '本周' 
                                                WHEN to_date ( DAY ) <= 
CURRENT_DATE ()- 8 AND to_date ( DAY ) >= CURRENT_DATE ()- 14 THEN
                                                '上周' 
                                END 
        ),())
   
   报错信息
   detailMessage = select list expression not produced by aggregation output 
(missing from GROUP BY clause?): (CASE WHEN to_date(`DAY`) <= '2024-01-17 
00:00:00' AND to_date(`DAY`) >= '2024-01-11 00:00:00' THEN '本周' WHEN 
to_date(`DAY`) <= '2024-01-10 00:00:00' AND to_date(`DAY`) >= '2024-01-04 
00:00:00' THEN '上周' END)
   
   ### What You Expected?
   
   grouping中和grouping sets中的字段也进行常量折叠
   
   ### 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: commits-unsubscr...@doris.apache.org.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

Reply via email to