[
https://issues.apache.org/jira/browse/CALCITE-6983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17947684#comment-17947684
]
xiong duan commented on CALCITE-6983:
-------------------------------------
After the following push-down operation, the generated SQL will have two
parameters. This does not conform to the usage specification of
Preparestatement. These two parameters can be set to different values, and they
are different from the semantic expression required by the original SQL.
> SortJoinTransposeRule should not push SORT past a UNION when SORT's fetch is
> DynamicParam
> -----------------------------------------------------------------------------------------
>
> Key: CALCITE-6983
> URL: https://issues.apache.org/jira/browse/CALCITE-6983
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.39.0
> Reporter: Roman Churganov
> Priority: Blocker
> Labels: pull-request-available
>
> An issue with `SortJoinTransposeRule`, which is the same as in
> `SortUnionTransposeRule ` has been fixed in CALCITE-6647 . Can be reproduced
> with a query like:
> {code:sql}
> SELECT t5.fn1, t8.m_fn
> FROM (
> SELECT id AS fn1 FROM foo WHERE sd = ?
> UNION SELECT id FROM bar WHERE d = ?
> UNION SELECT id FROM baz WHERE id = ? ) AS t5
> LEFT JOIN (SELECT id AS m_fn FROM (
> SELECT id, aoguid FROM foo2
> WHERE EXISTS (SELECT 1 FROM (
> SELECT buildnum AS fn2 FROM v1_dhouse) AS t7 WHERE aoguid =
> t7.fn2 ) ) AS t ) AS t8
> ON t5.fn1 = t8.m_fn
> FETCH NEXT ? ROWS ONLY
> {code}
> which hangs on building a plan, with a debug log can see growing plans,
> eventually it fails with StackOverflow...,
--
This message was sent by Atlassian Jira
(v8.20.10#820010)