Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/16777
  
    
    **Postgres**
    
    ```
    postgres=# SELECT greatest(array[1], array[0.1]);
     greatest
    ----------
     {1}
    (1 row)
    
    postgres=# SELECT least(array[1], array[0.1]);
     least
    -------
     {0.1}
    (1 row)
    ```
    
    ```
    postgres=# SELECT * FROM (values (array[1]), (array[0.1])) as foo;
     column1
    ---------
     {1}
     {0.1}
    (2 rows)
    ```
    
    ```
    postgres=# SELECT array[1] UNION SELECT array[0.1];
     array
    -------
     {0.1}
     {1}
    (2 rows)
    ```
    
    ```
    postgres=# SELECT CASE WHEN TRUE THEN array[0.1] ELSE array[1] END;
     array
    -------
     {0.1}
    (1 row)
    ```
    
    (sorry, I could not find a proper way to test this with `IF`. So, I used 
`CASE`/`WHEN` in postgres).
    
    
    
    
    **Hive** - not supporting this type coercion.
    
    ```
    SELECT least(array(1), array(1D));
    FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '1': 
least only takes primitive types, got array<int>
    ```
    least/greatest: seems only supporting primitive types
    
    ```
    SELECT inline(array(struct(array(0)), struct(array(1D))));
    FAILED: SemanticException [Error 10016]: Line 1:38 Argument type mismatch 
'1D': Argument type "struct<col1:array<double>>" is different from preceding 
arguments. Previous type was "struct<col1:array<int>>"
    ```
    
    ```
    SELECT array(1) UNION SELECT array(1D);
    FAILED: SemanticException Schema of both sides of union should match: 
Column _c0 is of type array<int> on first table and type array<double> on 
second table. Cannot tell the position of null AST.
    ```
    
    ```
    SELECT IF(1=1, array(1), array(1D));
    FAILED: SemanticException [Error 10016]: Line 1:25 Argument type mismatch 
'1D': The second and the third arguments of function IF should have the same 
type, but they are different: "array<int>" and "array<double>"
    ```
    
    **MySQL**
    
    Seems not supporting arrays



---
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]

Reply via email to