You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/08/19 17:21:20 UTC

[jira] [Closed] (SPARK-16152) `In` predicate does not work with null values

     [ https://issues.apache.org/jira/browse/SPARK-16152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dongjoon Hyun closed SPARK-16152.
---------------------------------
    Resolution: Invalid

Hi, [~fushar]. 
This seems to be a SQL question. [~kevinyu98] is right. Spark/PostgreSQL/MySQL are consistent with this. `NULL IN (NULL)` is NULL. Please run the following query. The result is also `TRUE` for the above SQL engines.
{code}
SELECT (NULL IN (NULL)) IS NULL
{code}

> `In` predicate does not work with null values
> ---------------------------------------------
>
>                 Key: SPARK-16152
>                 URL: https://issues.apache.org/jira/browse/SPARK-16152
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1
>            Reporter: Ashar Fuadi
>
> According to https://github.com/apache/spark/blob/v1.6.1/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala#L134..L136:
> {code}
>  override def eval(input: InternalRow): Any = {
>     val evaluatedValue = value.eval(input)
>     if (evaluatedValue == null) {
>       null
>     } else {
>       ...
> {code}
> we always return {{null}} when the current value is null, ignoring the elements of {{list}}. Therefore, we cannot have a predicate which tests whether a column contains values in e.g. {{[1, 2, 3, null]}}
> Is this a bug, or is this actually the expected behavior?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org