[ https://issues.apache.org/jira/browse/SPARK-38790?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vishnu K Suman updated SPARK-38790: ----------------------------------- Description: `IN`operator in spark.sql is giving unexpected results 1 in (null, 1) => true 1 in (null, 2) = null I would have expected the second piece of code to throw false. {code:java} >>> spark.sql('SELECT 1 in (null, 1)').show() +----------------+ |(1 IN (NULL, 1))| +----------------+ | true| +----------------+ >>> spark.sql('SELECT 1 in (null, 2)').show() +----------------+ |(1 IN (NULL, 2))| +----------------+ | null| +----------------+ {code} was: `IN`operator in spark.sql is giving unexpected results 1 in (null, 1) => true 1 in (null, 2) = null I would have expected the second piece of code to throw false. !image-2022-04-05-22-21-27-695.png! > Unexpected behaviour for "IN" operator in spark when null is involved in array > ------------------------------------------------------------------------------ > > Key: SPARK-38790 > URL: https://issues.apache.org/jira/browse/SPARK-38790 > Project: Spark > Issue Type: Bug > Components: Spark Core, SQL > Affects Versions: 3.2.1 > Environment: Tested on pyspark 3.2.1 > Reporter: Vishnu K Suman > Priority: Major > Attachments: image-2022-04-05-22-21-27-695.png > > > > `IN`operator in spark.sql is giving unexpected results > 1 in (null, 1) => true > 1 in (null, 2) = null > I would have expected the second piece of code to throw false. > > > {code:java} > >>> spark.sql('SELECT 1 in (null, 1)').show() > +----------------+ > |(1 IN (NULL, 1))| > +----------------+ > | true| > +----------------+ > >>> spark.sql('SELECT 1 in (null, 2)').show() > +----------------+ > |(1 IN (NULL, 2))| > +----------------+ > | null| > +----------------+ > {code} > -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org