You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/13 12:01:38 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #3123: `array` function allows different data types

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] comphead commented on issue #3123: `array` function allows different data types

Posted by GitBox <gi...@apache.org>.
comphead commented on issue #3123:
URL: https://github.com/apache/arrow-datafusion/issues/3123#issuecomment-1224753049

   @alamb looks like it was already fixed in #2194
   
   ```
   DataFusion CLI v11.0.0
   ❯ select array[1, 2, 'foo'];
   NotImplemented("Arrays with different types are not supported: {Int64, Utf8}")
   ```
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #3123: `array` function allows different data types

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #3123:
URL: https://github.com/apache/arrow-datafusion/issues/3123#issuecomment-1232812026

   👍  thanks @comphead  -- not sure what I was thinking about


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] comphead commented on issue #3123: `array` function allows different data types

Posted by GitBox <gi...@apache.org>.
comphead commented on issue #3123:
URL: https://github.com/apache/arrow-datafusion/issues/3123#issuecomment-1223459107

   I will try to solve it


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb closed issue #3123: `array` function allows different data types

Posted by GitBox <gi...@apache.org>.
alamb closed issue #3123: `array` function allows different data types
URL: https://github.com/apache/arrow-datafusion/issues/3123


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org