xy720 opened a new pull request #4646:
URL: https://github.com/apache/incubator-doris/pull/4646


   ## Proposed changes
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. input sql
   
   ```
       SELECT
           case when "condition" = ' ' then 'string' else search_source end as 
search_source
       FROM test_tbl
       GROUP BY search_source
   ```
   
   2. doris report an analysis error.
   
   In the sql above, search_source is a TINYINT type and 'string' is VARCHAR(*) 
type. Because the value of WhenExpr `"condition" = ' '` is false, so this 
case-when clause will produce a CastExpr as SelectListItem with a SlotRef child 
represents `search_source` after rewriting the sql. However, the 
analyzeAggregation() method cannot handle the case where SelectListItem is 
CaseExpr(implicitCast).
   
   **Expected behavior**
   Analysis successfully.
   
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [x] Bugfix (non-breaking change which fixes an issue)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after 
creating the PR. If you're unsure about any of them, don't hesitate to ask. 
We're here to help! This is simply a reminder of what we are going to look for 
before merging your code._
   
   - [x] I have create an issue on (Fix #4645 ), and have described the 
bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[email protected] by explaining why you chose the solution you did and what 
alternatives you considered, etc...
   


----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to