[
https://issues.apache.org/jira/browse/CALCITE-7301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Sysolyatin updated CALCITE-7301:
---------------------------------------
Description:
Many issues like [CALCITE-5439], [CALCITE-4406], [CALCITE-6178], and
[CALCITE-7339] have the same problem. If SqlShuttle or any other mechanism
creates a copy of a SqlCall with different operands, and the operator does not
implement createCall, then it fails to unparse/validate the SqlNode
This task adds a common test case that runs on existing parsing tests and
checks that unparsing after a deep copy works correctly.
was:
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}
> Support unparse special syntax when operator is LAMBDA/MERGE/UNPIVOT
> --------------------------------------------------------------------
>
> Key: CALCITE-7301
> URL: https://issues.apache.org/jira/browse/CALCITE-7301
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.41.0
> Reporter: Dmitry Sysolyatin
> Assignee: Dmitry Sysolyatin
> Priority: Major
> Labels: pull-request-available
>
> Many issues like [CALCITE-5439], [CALCITE-4406], [CALCITE-6178], and
> [CALCITE-7339] have the same problem. If SqlShuttle or any other mechanism
> creates a copy of a SqlCall with different operands, and the operator does
> not implement createCall, then it fails to unparse/validate the SqlNode
> This task adds a common test case that runs on existing parsing tests and
> checks that unparsing after a deep copy works correctly.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)