[
https://issues.apache.org/jira/browse/CALCITE-7761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110843#comment-18110843
]
Kirill Tkalenko commented on CALCITE-7761:
------------------------------------------
[~julianhyde] No. I encountered this issue while implementing a {{ROWNUM}}
rewrite downstream. The rewrite adds {{{}FETCH{}}}, which is then overwritten
while processing the outer {{{}ORDER BY{}}}. In my opinion, preserving an
existing {{OFFSET}} or {{FETCH}} is generic behavior that should be handled in
Calcite itself.
> Preserve OFFSET and FETCH when rewriting outer ORDER BY
> -------------------------------------------------------
>
> Key: CALCITE-7761
> URL: https://issues.apache.org/jira/browse/CALCITE-7761
> Project: Calcite
> Issue Type: Improvement
> Reporter: Kirill Tkalenko
> Assignee: Kirill Tkalenko
> Priority: Major
> Labels: pull-request-available
>
> {{SqlValidatorImpl.performUnconditionalRewrites}} may overwrite {{OFFSET}} or
> {{FETCH}} previously added to an inner {{SELECT}} during query rewriting.
> Merge the outer {{SqlOrderBy}} only when the inner {{SELECT}} has no
> {{{}ORDER BY{}}}, {{{}OFFSET{}}}, or {{{}FETCH{}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)