peter-toth opened a new pull request #29988:
URL: https://github.com/apache/spark/pull/29988


   ### What changes were proposed in this pull request?
   Fix `InConversion` rule by finding the common wider type of list expressions 
first and then the final common type for comparison between the value and the 
list expressions.
   
   Before this PR the query `SELECT * FROM t WHERE c IN ('2')` where c is `Int` 
generated the following filter:
   ```
   Filter cast(c#31 as string) IN (cast(2 as string))
   ```
   After this PR it generates:
   ```
   Filter cast(c#31 as int) IN (cast(2 as int))
   ```
   that is identical to what a `WHERE c = '2'` would do.
   
   ### Why are the changes needed?
   To make `In` behave like `=` and avoid issues described in 
https://issues.apache.org/jira/browse/SPARK-33098 
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, some queries will not fail.
   
   ### How was this patch tested?
   Existing UTs and I will add some new ones as well.


----------------------------------------------------------------
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