Hi Yanna,

I order to create a Map or Array type you have to pass from
RelDataTypeFactory#createMapType [1] or RelDataTypeFactory#createArrayType
[2] respectively. From the error you get it seems that you are using
RelDataTypeFactory#createJavaType [3].

Best,
Stamatis

[1]
https://github.com/apache/calcite/blob/a2ad38359380a196a987d28f9ec378006e86fa08/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactory.java#L129
[2]
https://github.com/apache/calcite/blob/a2ad38359380a196a987d28f9ec378006e86fa08/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactory.java#L118
[3]
https://github.com/apache/calcite/blob/a2ad38359380a196a987d28f9ec378006e86fa08/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactory.java#L61

On Tue, Nov 26, 2019 at 1:01 PM Yanna elina <yannaelinasul...@gmail.com>
wrote:

> *Hi Danny , *
>
> *From my side with your suggestion i   have this error message :  for MAP
> type : *
> *SELECT properties['fullyQualifiedDomainName'] FROM TABLE_TEST  : *
>
>  Cannot apply 'ITEM' to arguments of type 'ITEM(<JAVATYPE(CLASS
> JAVA.UTIL.LINKEDHASHMAP)>, <CHAR(24)>)'. Supported form(s):
> <ARRAY>[<INTEGER>]
> <MAP>[<VALUE>]
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>
> *and for LIST TYPE  : *
> *SELECT MY_ARRAY[1] FROM TABLE_TEST :*
>
> Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Cannot
> apply 'ITEM' to arguments of type 'ITEM(<JAVATYPE(CLASS
> JAVA.UTIL.ARRAYLIST)>, <INTEGER>)'. Supported form(s): <ARRAY>[<INTEGER>]
>
> Regard ,
> Yanna
>
> Le mar. 26 nov. 2019 à 12:19, Steve Robert <contact.steverob...@gmail.com>
> a écrit :
>
> > Ok i got it ,
> >
> > thank a lot Danny
> >
> > Le mar. 26 nov. 2019 à 01:53, Danny Chan <yuzhao....@gmail.com> a écrit
> :
> >
> > > Thanks, Steve ~
> > >
> > > Calcite did support LIST type syntax, such as “INT ARRAY” or “INT
> > MULTISET
> > > ARRAY”, but we do not support MAP syntax yet, because it is not a SQL
> > > standard, so the MAP type would always parsed to other type.
> > >
> > > You can reference a ARRAY column item with syntax
> “column_name[_index]”,
> > > and MAP column value with syntax “column_name[‘key_name’]”, these
> syntax
> > > also works with “OTHER”/“ANY” data type.
> > >
> > > Best,
> > > Danny Chan
> > > 在 2019年11月25日 +0800 PM8:22,Steve Robert <contact.steverob...@gmail.com
> > > >,写道:
> > > > Hi ,
> > > >
> > > > I saw an interesting exchange about the CSVAdapter
> > > >
> > > > I am also in a similar case where I want to be able to perform
> > predicate
> > > > filters from table
> > > > after conversion from JSON to JsonScannableTable .
> > > >
> > > >
> > > > the first dimension are correctly converted into the right type
> VARCHAR
> > > ect
> > > > but other dimension like LIST or MAP are converted to "OTHER"-type
> > > > it is therefore impossible to execute CONTAINS / IN OR ANY on column
> > > > transformed to OTHER-TYPE
> > > >
> > > >
> > > > I would like to know where it is the code best place to convert LIST
> > MAP
> > > > to a SQL type ARRAY_LIST and no OTHER
> > > >
> > > > I am new in calcite I have a little trouble understanding the type
> > > > definition workflow. I looked at the side of JSONEnumerator but it
> > seems
> > > > opaque.
> > > >
> > > > thank you in advance
> > > >
> > > > Steve
> > >
> >
>

Reply via email to