You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for accessing a map with non-literal key.
For example this should work (and also other cases where key cannot be constant-folded to a literal):
query ok
SELECT SUM(ints['by' || 'tes']) FROM data;
but it does not:
DataFusion error: Error during planning: Failed to coerce arguments to satisfy a call to 'array_element' function: coercion from [Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false), Utf8] to the signature ArraySignature(ArrayAndIndexes(1)) failed No function matches the given name and argument types 'array_element(Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false), Utf8)'. You might need to add explicit type casts. Candidate functions: array_element(array, index
The text was updated successfully, but these errors were encountered:
Accessing a map with a non-string key doesn't work (at least via DataFusion SQL) and is covered by #11785
Accessing a map with a literal string key works:
datafusion/datafusion/sqllogictest/test_files/map.slt
Lines 69 to 72 in 5e1e693
Add support for accessing a map with non-literal key.
For example this should work (and also other cases where key cannot be constant-folded to a literal):
but it does not:
The text was updated successfully, but these errors were encountered: