Hello,

in my recent experiments I ran into some issues when trying to unnest an array of struct.

The query is roughly this: select t.id, e.value1 from MyTable t, unnest(t.structArray) e

EnumerableTableScan#fieldExpression will then try to generate code that converts the value of the "structArray" column to a List<List>, which is where the problems start to arise. This code does not seem to be tested at all, because currently generates a compile error, due to missing a cast to "Iterable". It also assumes the data is already available in the JavaRowFormat.CUSTOM representation, but AFAIU, it could be in any format.

When using RelRecordType for structs, regular struct columns seem to expect JavaRowFormat.ARRAY, but struct arrays don't seem to behave the same way.

What is the expected data format that an enumerator should return for struct arrays that are typed as RelRecordType?

To support formats per type it might be nice to allow specifying the JavaRowFormat on RelDataType. Wdyt?

Also, is there a way to allow working with custom Java types for table/struct rows? From looking at AbstractCursor#createAccessor, it seems the Aviatica code currently only works with classes that expose public fields.

Regards,

Christian

Reply via email to