tshauck commented on code in PR #9233:
URL: https://github.com/apache/arrow-datafusion/pull/9233#discussion_r1492725582
##########
datafusion/sqllogictest/test_files/array.slt:
##########
@@ -2603,6 +2603,16 @@ select array_position(arrow_cast(make_array([1, 2, 3],
[4, 5, 6], [5, 5, 5], [4,
----
2 2
+query I
+SELECT array_position(arrow_cast([5, 2, 3, 4, 5], 'List(Int32)'), 5)
+----
+1
+
+query I
+SELECT array_position(arrow_cast([5, 2, 3, 4, 5], 'List(Int32)'), 5, 2)
Review Comment:
Thanks for the feedback... `LargeList` is added and works as expected. For
`array_position(arrow_cast([5, 2, 3, 4, 5], 'List(Int32)'), 'foo')`, this
actually doesn't fail right now on this branch and returns NULL:
```
❯ SELECT array_position(arrow_cast([5, 2, 3, 4, 5], 'List(Int32)'), 'foo')
IS NULL;
+----------------------------------------------------------------------------------------------+
|
array_position(make_array(Int64(5),Int64(2),Int64(3),Int64(4),Int64(5)),Utf8("foo"))
IS NULL |
+----------------------------------------------------------------------------------------------+
| true
|
+----------------------------------------------------------------------------------------------+
1 row in set. Query took 0.004 seconds.
```
Because this PR is leveraging the append's casting functionality, this seems
to be the current behavior on main for append:
```
arrow-datafusion/datafusion-cli main ➜ ./target/debug/datafusion-cli
DataFusion CLI v35.0.0
❯ SELECT array_append(arrow_cast([5, 2, 3, 4, 5], 'List(Int32)'), 'foo');
+------------------------------------------------------------------------------------+
|
array_append(make_array(Int64(5),Int64(2),Int64(3),Int64(4),Int64(5)),Utf8("foo"))
|
+------------------------------------------------------------------------------------+
| [5, 2, 3, 4, 5, foo]
|
+------------------------------------------------------------------------------------+
1 row in set. Query took 0.028 seconds.
```
I guess as I user I'd think if the array_append case would work, I'd also
expect array_position to work like that. FWIW duckdb works for both
array_append and `array_position([1,2,3], 'foo')` it just returns 0 rather than
NULL.
--
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]