[ 
https://issues.apache.org/jira/browse/SPARK-7286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15014613#comment-15014613
 ] 

Jakob Odersky commented on SPARK-7286:
--------------------------------------

If we want the same precedence of equals and non-equals operators, they should 
both start with a symbol of same-precedence.
= has the same precedence as !, however as per spec, if the operator also ends 
with a = and does not start with =, it is considered an assignment operator 
with a lower precedence than others.

So I see a couple of options:
1) abandon the wish of same precedence and accept the status-quo
2) adopt Reynold's solution or define another operator
3) remove non-equals comparison altogether, instead rely on negating equals 
comparison. I.e (A !== B becomes !(A === B))

Personally, I am against choosing option 1 as it leads to confusing behaviour 
(like this JIRA demonstrates). Not sure what I prefer between option 2 or 3 
though

> Precedence of operator not behaving properly
> --------------------------------------------
>
>                 Key: SPARK-7286
>                 URL: https://issues.apache.org/jira/browse/SPARK-7286
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.3.1
>         Environment: Linux
>            Reporter: DevilJetha
>            Priority: Critical
>
> The precedence of the operators ( especially with !== and && ) in Dataframe 
> Columns seems to be messed up.
> Example Snippet
> .where( $"col1" === "val1" && ($"col2"  !== "val2")  ) works fine.
> whereas .where( $"col1" === "val1" && $"col2"  !== "val2"  )
> evaluates as ( $"col1" === "val1" && $"col2" ) !== "val2"



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

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

Reply via email to