Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/2344#discussion_r17703765
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
---
@@ -221,19 +221,35 @@ trait HiveTypeCoercion {
a.makeCopy(Array(a.left, Cast(a.right, DoubleType)))
case p: BinaryPredicate if p.left.dataType == StringType
+ && p.right.dataType == DateType =>
+ p.makeCopy(Array(Cast(p.left, DateType), p.right))
+ case p: BinaryPredicate if p.left.dataType == DateType
+ && p.right.dataType == StringType =>
+ p.makeCopy(Array(p.left, Cast(p.right, DateType)))
+ case p: BinaryPredicate if p.left.dataType == StringType
&& p.right.dataType == TimestampType =>
p.makeCopy(Array(Cast(p.left, TimestampType), p.right))
case p: BinaryPredicate if p.left.dataType == TimestampType
&& p.right.dataType == StringType =>
p.makeCopy(Array(p.left, Cast(p.right, TimestampType)))
+ case p: BinaryPredicate if p.left.dataType == TimestampType
+ && p.right.dataType == DateType =>
+ p.makeCopy(Array(Cast(p.left, DateType), p.right))
--- End diff --
I didn't check this in Hive, but probably it's better to convert the `Date`
=> `Timestamp`, since `Timestamp` is more precise. The same for the rule `In` .
---
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]