[
https://issues.apache.org/jira/browse/CALCITE-7301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18039358#comment-18039358
]
Dmitry Sysolyatin commented on CALCITE-7301:
--------------------------------------------
saw a useful comment from Julian on one of previous task:
>It might be helpful for SqlUnparserTest to unparse everything before and after
>cloning. Could you enable that in this PR? Then you might not need a specific
>test case.
It would be good to add this to the current PR. Then we don't need such tests,
I hope
> Support unparse special syntax when operator is LAMBDA
> ------------------------------------------------------
>
> 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
>
> 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)