Dmitry Sysolyatin created CALCITE-7301:
------------------------------------------
Summary: Support unparse special syntax when operator is LAMBDA
Key: CALCITE-7301
URL: https://issues.apache.org/jira/browse/CALCITE-7301
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.41.0
Reporter: Dmitry Sysolyatin
Assignee: Dmitry Sysolyatin
The same as [CALCITE-5439], [CALCITE-4406], [CALCITE-6178]
When creating a deep copy of SqlNode with the SqlLambdaOperator operator,
SqlShuttle creates SqlBasicCall instead of SqlLambda, and such SqlNode fails
when unparse query/validate query and so on:
Test case
{code}
@Test void testDeepCopySqlWithLambda() {
final String sql = "select higher_order_func(1, (x, y) -> (x + y)) from t";
final String expected = "SELECT `HIGHER_ORDER_FUNC`(1, (`X`, `Y`) -> `X` +
`Y`)\nFROM `T`";
final SqlNode sqlNode = sql(sql).node();
final SqlNode shuttled = sqlNode.accept(new SqlShuttle() {
@Override public @Nullable SqlNode visit(final SqlCall call) {
// Handler always creates a new copy of 'call'
CallCopyingArgHandler argHandler = new CallCopyingArgHandler(call,
true);
call.getOperator().acceptCall(this, call, false, argHandler);
return argHandler.result();
}
});
assertThat(toLinux(shuttled.toString()), is(expected));
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)