Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/9720#discussion_r44963028
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
---
@@ -280,6 +280,12 @@ object HiveTypeCoercion {
case p @ BinaryComparison(left @ DateType(), right @
TimestampType()) =>
p.makeCopy(Array(Cast(left, StringType), Cast(right, StringType)))
+ // Checking NullType
+ case p @ BinaryComparison(left @ StringType(), right @ NullType()) =>
+ p.makeCopy(Array(left, Literal.create(null, StringType)))
+ case p @ BinaryComparison(left @ NullType(), right @ StringType()) =>
+ p.makeCopy(Array(Literal.create(null, StringType), right))
+
case p @ BinaryComparison(left @ StringType(), right) if
right.dataType != StringType =>
p.makeCopy(Array(Cast(left, DoubleType), right))
--- End diff --
Hm, actually I only simplified the original rule with conciser pattern
matching in PR #6537 ([here][1]). Tracked down the history and it turned out
that this rule had already been there ever since the very first commit of Spark
SQL by @marmbrus :) ([here][2]).
[1]:
https://github.com/apache/spark/pull/6537/files#diff-d33f6b266aab79a1708e888dc1a1caf3L275
[2]:
https://github.com/apache/spark/commit/9aadcffabd226557174f3ff566927f873c71672e#diff-d33f6b266aab79a1708e888dc1a1caf3R203
---
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]