Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/22408
  
    How about this decimal case?
    ```
    // v2.3.1
    scala> spark.range(10).selectExpr("cast(id AS decimal(9, 0)) as 
value").selectExpr("array_contains(array(1, 2, 3), value)").show
    +--------------------------------------------------+
    |array_contains(array(1, 2, 3), CAST(value AS INT))|
    +--------------------------------------------------+
    |                                             false|
    |                                              true|
    |                                              true|
    |                                              true|
    |                                             false|
    |                                             false|
    |                                             false|
    |                                             false|
    |                                             false|
    |                                             false|
    +--------------------------------------------------+
    
    // this patch
    scala> spark.range(10).selectExpr("cast(id AS decimal(9, 0)) as 
value").selectExpr("array_contains(array(1, 2, 3), value)").show
    org.apache.spark.sql.AnalysisException: cannot resolve 
'array_contains(array(1, 2, 3), `value`)' due to data type mismatch: Input to 
function array_contains should have been array followed by a value with same 
element type, but it's [array<int>, decimal(9,0)].; line 1 pos 0;
    'Project [unresolvedalias(array_contains(array(1, 2, 3), value#2), 
Some(<function1>))]
    +- Project [cast(id#0L as decimal(9,0)) AS value#2]
       +- Range (0, 10, step=1, splits=Some(4))
    ```


---

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

Reply via email to