GitHub user theelderbeever closed a discussion: How to access Map array by field
I have a MapArray column that I am reading from a parquet table. I am trying to
access particular key/value pairs in that map.
I was attempting this SQL expression `SELECT tags['account'] FROM metrics`
however, I get the error
> Error: Generic("Error during planning: The expression to get an indexed field
> is only valid for `List` or `Struct` types, got Map(Field { name:
> \"entries\", data_type: Struct([Field { name: \"keys\", data_type: Utf8,
> nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field {
> name: \"values\", data_type: Utf8, nullable: true, dict_id: 0,
> dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0,
> dict_is_ordered: false, metadata: {} }, false)")
The parquet file was generated using a MapBuilder from arrow so the type should
be correct. How can I query the keys in a Map array?
GitHub link: https://github.com/apache/datafusion/discussions/7851
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]