Calcite has UNNEST WITH ORDINALITY instead of pg_expandarray.

Notice that if an array of records is expanded, each field becomes a separate 
column.

Would that work for you?

Mihai


________________________________
From: Maxime Sechehaye <[email protected]>
Sent: Tuesday, September 16, 2025 12:37 AM
To: [email protected] <[email protected]>
Subject: Support for field access on a table expression


Hello,

We are currently using Calcite to enable SQL queries on our database 
application. Our application emulates a Postgres server, so all frontend tools 
send Postgres-like queries.

We are encountering an issue with a query sent by Tableau that contains:
(information_schema._pg_expandarray(i.indkey)).n

We have implemented a SqlUserDefinedTableFunction for _pg_expandarray. The 
implementation works correctly, except when it comes to field access, as in the 
expression above. The return type of _pg_expandarray must be a cursor, but it 
does not seem to be compatible with the dot operator.

Do you know if it is currently possible to support field access on a table 
expression in Calcite, or should we wait for a potential update?

Attached is the full query sent by Tableau.

Best regards,

Maxime Sechehaye
Junior Software Engineer
[ActiveViam]<https://activeviam.com>
A:
ActiveViam France, 46 rue de l'Arbre Sec, 75001 Paris
Follow us on LinkedIn<https://www.linkedin.com/company/activeviam/>
[Both Awards]

Reply via email to