Hi all,
Apologies in advance for the longer e-mail! I am a grad student adapting
Calcite for use in a research project prototype.  The functionality I am
trying to add involves inserting non-executable operators into a plan to
represent abstract sets of queries.
For example, it takes two queries like,

"select a from t"
and
"select b from t"

and combines them into:

"select any {a, b} from t".
Similarly, an "any{}" operator can have, e.g. a list of filtering
conditions and other grammatical options. These queries are not intended to
ever be executed and only exist for us to write planning rules over!

I am able to parse statements like the one above, but I am having a great
bit of trouble trying to validate and convert to a relational expression.
The output of the convertSqlToRel test I added is:

LogicalProject(EXPR$0=[ANY($1)])
     LogicalTableScan(table=[(t1, t2, t3)])

I created a SqlNode named SqlAny and a RexNode RexAny that is parsed
correctly, but after validation it is converted to a SqlBasicCall. I am
able to catch it by examining the operator type in
convertExtendedExpression() and return a RexAny node, but I am not sure
what to add to the validator to avoid this hack and preserve the
fieldnames that are operands to SqlAny.

Please, any and all help is appreciated!
Cheers,
Lana

Reply via email to