Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/18853#discussion_r131929813
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
---
@@ -354,6 +354,14 @@ object TypeCoercion {
p.makeCopy(Array(left, Cast(right, TimestampType)))
case p @ BinaryComparison(left, right)
+ if left.isInstanceOf[AttributeReference] &&
right.isInstanceOf[Literal] =>
+ p.makeCopy(Array(left, castExpr(right, left.dataType)))
--- End diff --
We need to cover all the same cases, but it seems this fix couldn't do, for
example;
```
scala> spark.udf.register("testUdf", () => "85908509832958239058032")
scala> sql("select * from values (1) where testUdf() > 1").explain
== Physical Plan ==
*Filter (cast(UDF:testUdf() as int) > 1)
+- LocalTableScan [col1#104]
```
---
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]