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

    https://github.com/apache/spark/pull/21620#discussion_r197726949
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ---
    @@ -536,6 +536,11 @@ object TypeCoercion {
               case None => c
             }
     
    +      case ArrayJoin(arr, d, nr) if 
!ArrayType(StringType).acceptsType(arr.dataType) &&
    +        ArrayType.acceptsType(arr.dataType) =>
    +        val containsNull = 
arr.dataType.asInstanceOf[ArrayType].containsNull
    +        ArrayJoin(Cast(arr, ArrayType(StringType, containsNull)), d, nr)
    --- End diff --
    
    I am not sure. I think it is arguable which is the right result of `SELECT 
array_join(array(array('a', 'b'), array('c', 'd')), ';')` for instance. With 
this PR, the result is `[a, b];[c, d]` but shouldn't it be `[a;b];[c;d]`? 
Moreover, Presto, which is the reference here, doesn't support nested arrays 
for instance:
    ```
    presto> select array_join(array[array[1, 2, 3], array[3, 4, 5]], ';');
    Query 20180625_090549_00003_bsbcg failed: Input type array(integer) not 
supported
    ```
    So, I'd avoid that.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to