Rob Harrison created SPARK-43053:
------------------------------------

             Summary: Possible logic issue
                 Key: SPARK-43053
                 URL: https://issues.apache.org/jira/browse/SPARK-43053
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.0.0
         Environment: Kubernetes sql operator
            Reporter: Rob Harrison


I found this bug when the following query returned no results:
{code:java}
WHERE cast(leistungsnummer as long) NOT IN (123)){code}
However so did the following query:
{code:java}
WHERE cast(leistungsnummer as long) IN (123)) {code}
This can be simplified to the following:
{code:java}
WHERE NULL IN (123)
{code}
Returns zero results but so does:
{code:java}
WHERE NULL NOT IN (123) {code}
Logically one would assume `NULL IN (123, 456)` would be false.  However if 
that is the case then you would think `NULL NOT IN (123, 456)` would be true.  
It seems they both equate to false.

I don't know if this is a quirk of the SQL spec or if this is a bug in Spark 
SQL implementation but it is causing unexpected results.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to