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

   ### 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
   
   大于1.0.0
   
   ### What's Wrong?
   
   SELECT
     case
       when (inc_day = days_add(CURDATE()  , 1)) then '当期'
       when (inc_day = days_add(CURDATE() , 8)) then '环比'
       when (inc_day = days_add(CURDATE() , 365)) then '同比'
       else '其他'
     end AS LONG_COL_0,
     sum(1)
   from dal_sh_analysis.dim_vendor_basic     
   group by 
       case
       when (inc_day = days_add(CURDATE()  , 1)) then '当期'
       when (inc_day = days_add(CURDATE() , 8)) then '环比'
       when (inc_day = days_add(CURDATE() , 365)) then '同比'
       else '其他'
     end  
     
   
   group by 后面如果接的不是别名,而是case when+ 日期函数,会报错
   doris1.0以下版本正常,升级后查询报错
   
   SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = select list expression 
not produced by aggregation output (missing from GROUP BY clause?): CASE WHEN 
(`inc_day` = '2022-10-14 00:00:00') THEN '当期' WHEN (`inc_day` = '2022-10-21 
00:00:00') THEN '环比' WHEN (`inc_day` = '2023-10-13 00:00:00') THEN '同比' ELSE 
'其他' END
   
   
   <img width="783" alt="image" 
src="https://user-images.githubusercontent.com/31120351/195558752-807f161e-0b2d-4b6f-8807-21f7f3136c38.png";>
   
   
   
   
   ### What You Expected?
   
   group by 后面如果接的不是别名,而是case when+ 日期函数,会报错
   
   ### 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: 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