alamb opened a new issue, #3123:
URL: https://github.com/apache/arrow-datafusion/issues/3123

   **Describe the bug**
   Both Spark and Postgres allow arrays of elements that have the same type -- 
e.g. Spark: 
https://spark.apache.org/docs/2.1.0/api/java/index.html?org/apache/spark/sql/types/ArrayType.html
   
   The current `array()` function in datafusion creates a `FixedSizeList` arrow 
array. However, the `FixedSizedList` in arrow is more general as it allows the 
elements to be any type
   
   Datafusion currently doesn't coerce the types to a common type
   
   **To Reproduce**
   ```sql
   DataFusion CLI v10.0.0
   ❯ select array(1,2,'foo');
   +--------------------------------------+
   | array(Int64(1),Int64(2),Utf8("foo")) |
   +--------------------------------------+
   | [1, 2, foo]                          |
   +--------------------------------------+
   ```
   
   **Expected behavior**
   An error, like in postgres:
   
   ```sql
                  ^
   alamb=# select array[1,2,'foo'];
   ERROR:  invalid input syntax for type integer: "foo"
   ```
   
   
   **Additional context**
   Found while working on https://github.com/apache/arrow-datafusion/pull/3122
   
   The `array` function was originally introduced by @jorgecarleitao  in 
https://github.com/apache/arrow/pull/8102/files


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to