Hi Vishwas,

The way to access elements from array or map is documented[1] on Calcite 
website. Is that what you need?

By the way, the ordinal you use to access an array should start from 1 rather 
than 0. For instance, if you execute SQL:

> select x[2]['key2'] as v from (values(array[map['key1', 'value1'], 
> map['key1', 'value1', 'key2', 'value2']])) as t(x)

The SQL is good, and Calcite will give you result "V=value2".

Best,
Hongze

[1] http://calcite.apache.org/docs/reference.html#value-constructors

> On May 5, 2019, at 20:45, Vishwas Bm <[email protected]> wrote:
> 
> Hi,
> 
> Can anyone help me in telling how to write a sql query directly to access a
> map value in an array.
> 
> I have an array field with this format. Now how to get value using the
> mapKey for a specific array Index.
> 
> *FieldName:* Field_X
> *Type:* ARRAY<MAP<STRING, STRING>>
> 
> 
> 
> *Thanks & Regards,*
> 
> *Vishwas *

Reply via email to