Hey,

I'm having some problems implementing CALCITE-1940 and wanted to ask you for advice about how to tackle it.

A query like "select next value for seq1" where "seq1" is a sequence in e.g. PostgreSQL is will generate a query plan like "LogicalProject(NEXT VALUE FOR seq1) -> LogicalValues( (0) )".

As far as I understood, the convention to use for executing such a query is determined based on the input. The planner now always chooses the "EnumerableValues" implementation for "LogicalValues" thus the statement is never pushed down to PostgreSQL.

My question is, how would I be able to make the expression "NEXT VALUE FOR seq1", represented by the new subtype RexSeqCall, be executed on PostgreSQL? The sequence "seq1" is an entry in the JdbcSchema, but the current code doesn't seem to know that. During planning it seems only the input types are considered for the convention determination.

I hope you understand the problem I am having. Has anyone ideas of how to fix that?

I thought it might be possible to write a planner rule that finds such expressions and transforms them, but that's only one part I guess. Currently, the planner thinks a plan like "EnumerableProject(NEXT VALUE FOR seq1) -> EnumerableValues( (0) )" is better than "JdbcProject(NEXT VALUE FOR seq1) -> JdbcValues( (0) )" which it isn't. Any ideas how I could fix that?

--

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*

Reply via email to