We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, we support creating a map like
SELECT MAKE_MAP(1, 'a', 2, 'b', 3, 'c'); ---- {1: a, 2: b, 3: c}
However, we can't access this map if its key isn't a string.
SELECT MAKE_MAP(1, 'a', 2, 'b', 3, 'c')[1]
It will get the error
External error: query failed: DataFusion error: Error during planning: Error during planning: Coercion from [Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false), Int64] to the signature ArraySignature(ArrayAndIndex) failed. No function matches the given name and argument types 'array_element(Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false), Int64)'. You might need to add explicit type casts. Candidate functions: array_element(array, index)
If the key is a string, it works well.
query T SELECT MAKE_MAP('1', 'a', '2', 'b', '3', 'c')['1'] ---- a
As mentioned above, create a map with non-string keys and try to access it by the key.
Given the SQL
It should return the value 'a'.
'a'
#11780 (comment)
The text was updated successfully, but these errors were encountered:
Map
Interesting, I can give it a try.
Sorry, something went wrong.
take
I think map_extract function can benefit this issue #11969
map_extract
I will prioritise this issue
Seems like a bug with GetFieldFunc function
GetFieldFunc
dharanad
Successfully merging a pull request may close this issue.
Describe the bug
Currently, we support creating a map like
However, we can't access this map if its key isn't a string.
It will get the error
If the key is a string, it works well.
To Reproduce
As mentioned above, create a map with non-string keys and try to access it by the key.
Expected behavior
Given the SQL
It should return the value
'a'
.Additional context
#11780 (comment)
The text was updated successfully, but these errors were encountered: