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

   ### 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.1、1.2 can't work well
   master can work well but RewriteInPredicateRule may be useless
   
   ### What's Wrong?
   
   RewriteInPredicateRule may cast InPredicate expr's two child to the same 
type, for example: where cast(age as char) in ('11'), the type of age is int, 
RewriteInPredicateRule will cast expr's two child type to int. As in the 
example above, child 0 will be such struct: 
   ```
   child 0: type: int
       |---  child: type : char
               |-- child: type : int
   ```
   
   Due to the RewriteInPredicateRule cast the type of the expr to int, it will 
reanalyze stmt, but it will reset stmt first before reanalyze the stmt, and 
reset opt will change child 0 to such struct:
   ```
   child: type : char
       |-- child: type : int
   ```
   It cause two child's type will be cast to varchar in func 
castAllToCompatibleType, the logic of RewriteInPredicateRule will be useless.
   
   In 1.1-lts and 1.2-lts, such case  " where cast(age as char) in ('11')"  
can't work well,  because func castAllToCompatibleType will cast int to char 
but int can't cast to char(master can work well because func 
castAllToCompatibleType will cast int to varchar in such case).
   ```
   MySQL [test]> select user_id from test_cast where cast(age as char) in 
('45');
   ERROR 1105 (HY000): errCode = 2, detailMessage = type not match, 
originType=INT, targeType=CHAR(*)
   ```
   
   ### What You Expected?
   
   work well
   
   ### 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]

Reply via email to