[
https://issues.apache.org/jira/browse/CALCITE-5086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17545612#comment-17545612
]
Julian Hyde commented on CALCITE-5086:
--------------------------------------
The first form would allow "LIMIT 10, 30", "LIMIT 30", "LIMIT 10, ALL", "LIMIT
ALL".
The second form would allow "LIMIT 10, 30", "LIMIT 30", "LIMIT ALL" but
disallow "LIMIT 10, ALL".
Question 1. Do you agree with the above analysis?
There is no database that supports "LIMIT 10, ALL" (only MySQL supports "LIMIT
x, y", and only Postgres supports "ALL") but the semantics make sense (it's the
same as Postgres "LIMIT ALL OFFSET 10") and I think that Calcite should support
it.
Question 2. Do you agree that Calcite should support "LIMIT start, ALL"?
As of this change, Calcite does not support "LIMIT start, ALL". There is a test
to prove it:
{code}
// "limit start, all" is not valid
sql("select a from foo limit 2, ^all^")
.withConformance(SqlConformanceEnum.LENIENT)
.fails("(?s).*Encountered \"all\" at line 1.*");
{code}
Therefore we ought to change the syntax to the second form in this case, and
file log a separate Jira case to support "LIMIT start ALL".
Question 3. Do you agree with that course of action?
> Core parser should allow "OFFSET" to occur before "LIMIT"
> ---------------------------------------------------------
>
> Key: CALCITE-5086
> URL: https://issues.apache.org/jira/browse/CALCITE-5086
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.30.0
> Environment: jdk8
> Reporter: yanjing.wang
> Assignee: yanjing.wang
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.31.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> The core parser supports 'LIMIT count OFFSET start' now, otherwise trino
> supports 'OFFSET start LIMIT count', we can make an improvement to support
> both.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)