Github user bogdanrdc commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18455#discussion_r125877364
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/PredicateSuite.scala
 ---
    @@ -35,7 +35,8 @@ class PredicateSuite extends SparkFunSuite with 
ExpressionEvalHelper {
         test(s"3VL $name") {
           truthTable.foreach {
             case (l, r, answer) =>
    -          val expr = op(NonFoldableLiteral(l, BooleanType), 
NonFoldableLiteral(r, BooleanType))
    +          val expr = op(NonFoldableLiteral.create(l, BooleanType),
    --- End diff --
    
    The problem is that NonFoldableLiteral(java.math.BigDecimal, DecimalType) 
is keeping the java value while NonFoldableLiteral.create(_,_) does 
Literal.create which transforms java.math.BigDecimal to Decimal (catalyst type).
    It's a bit of weird code. Literal has the same problem. Literal(_,_) is not 
the same as Literal.create(_,_). So, one should always use .create and never 
the 2 parameter constructor.
    Otherwise you get java values in the execution, which in my case was 
failing because there is no ordering for non catalyst types. 



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to