GitHub user cloud-fan opened a pull request:
https://github.com/apache/spark/pull/15880
[SPARK-17913][SQL] compare long and string type column may return confusing
result
## What changes were proposed in this pull request?
Spark SQL follows MySQL to do the implicit type conversion for binary
comparison: http://dev.mysql.com/doc/refman/5.7/en/type-conversion.html
However, this may return confusing result, e.g. `1 = 'true'` will return
true, `19157170390056973L = '19157170390056971'` will return true.
I think it's more reasonable to follow postgres in this case, i.e. cast
string to the type of the other side, and throw exception if the string is not
castable.
## How was this patch tested?
newly added tests.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloud-fan/spark compare
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15880.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #15880
----
commit 40c6267921c5b9e2e2e55a320d97a17f608dca27
Author: Wenchen Fan <[email protected]>
Date: 2016-11-14T10:32:54Z
compare long and string type column may return confusing result
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]