You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maxim Gekk (JIRA)" <ji...@apache.org> on 2018/05/15 06:01:00 UTC

[jira] [Created] (SPARK-24276) semanticHash() returns different values for semantically the same IS IN

Maxim Gekk created SPARK-24276:
----------------------------------

             Summary: semanticHash() returns different values for semantically the same IS IN
                 Key: SPARK-24276
                 URL: https://issues.apache.org/jira/browse/SPARK-24276
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.3.0
            Reporter: Maxim Gekk


When a plan is canonicalized any set-based operation, such as IS IN, should have its expressions ordered as the order of expressions does not matter in the evaluation of the operator.

For instance:

{code:scala}
val df = spark.createDataFrame(Seq((1, 2)))
val p1 = df.where('_1.isin(1, 2)).queryExecution.logical.canonicalized
val p2 = df.where('_1.isin(2, 1)).queryExecution.logical.canonicalized
val h1 = p1.semanticHash
val h2 = p2.semanticHash
{code}

{code}
df: org.apache.spark.sql.DataFrame = [_1: int, _2: int]
p1: org.apache.spark.sql.catalyst.plans.logical.LogicalPlan =
'Filter '_1 IN (1,2)
+- LocalRelation [_1#0, _2#1]

p2: org.apache.spark.sql.catalyst.plans.logical.LogicalPlan =
'Filter '_1 IN (2,1)
+- LocalRelation [_1#0, _2#1]

h1: Int = -1384236508
h2: Int = 939549189
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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