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

    https://github.com/apache/spark/pull/22408#discussion_r217593872
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala ---
    @@ -735,6 +735,44 @@ class DataFrameFunctionsSuite extends QueryTest with 
SharedSQLContext {
           df.selectExpr("array_contains(array(1, null), array(1, null)[0])"),
           Seq(Row(true), Row(true))
         )
    +
    +    checkAnswer(
    +      df.selectExpr("array_contains(array(1), 1.23D)"),
    +      Seq(Row(false), Row(false))
    +    )
    +
    +    checkAnswer(
    +      df.selectExpr("array_contains(array(1), 1.0D)"),
    +      Seq(Row(true), Row(true))
    +    )
    +
    +    checkAnswer(
    +      df.selectExpr("array_contains(array(1.0D), 1)"),
    +      Seq(Row(true), Row(true))
    +    )
    +
    +    checkAnswer(
    +      df.selectExpr("array_contains(array(1.23D), 1)"),
    +      Seq(Row(false), Row(false))
    +    )
    +
    +    checkAnswer(
    +      df.selectExpr("array_contains(array(array(1)), array(1.0D))"),
    +      Seq(Row(true), Row(true))
    +    )
    +
    +    checkAnswer(
    +      df.selectExpr("array_contains(array(array(1)), array(1.23D))"),
    +      Seq(Row(false), Row(false))
    +    )
    +
    +    intercept[AnalysisException] {
    +      df.selectExpr("array_contains(array(1), 1.23)")
    --- End diff --
    
    Good point. Yes, I can do a lossy conversion.
    Seems like `BinaryComparison` uses wider DecimalType, so we could follow 
the behavior to use `findWiderTypeWithoutStringPromotion`.
    cc @gatorsmile @cloud-fan 


---

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

Reply via email to