This is an automated email from the ASF dual-hosted git repository. mhubail pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit bbbb0cffbe46059e4dfce03e8d4e6e1ff46968d2 Author: Janhavi Tripurwar <[email protected]> AuthorDate: Fri Mar 28 14:05:53 2025 +0530 [ASTERIXDB-3588]: Allow limit after offset - user model changes: yes - storage format changes: no - interface changes: no details: - This change modifies the grammar to support the LIMIT clause after the OFFSET clause. Ext-ref: MB-66004 Change-Id: I8fbcda0df6183dbfb650325e01526b0f5cfde124 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19583 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Janhavi Tripurwar <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> --- .../limit_after_offset.1.query.sqlpp | 23 ++++++++++++++++++++++ .../limit_after_offset/limit_after_offset.1.adm | 0 .../src/test/resources/runtimets/sqlpp_queries.xml | 5 +++++ .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj | 1 + 4 files changed, 29 insertions(+) diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/limit_after_offset/limit_after_offset.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/limit_after_offset/limit_after_offset.1.query.sqlpp new file mode 100644 index 0000000000..349b762cba --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/limit_after_offset/limit_after_offset.1.query.sqlpp @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//success + +create dataset ds primary key (id:string); +SELECT id FROM ds OFFSET 1 LIMIT 5; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/limit_after_offset/limit_after_offset.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/limit_after_offset/limit_after_offset.1.adm new file mode 100644 index 0000000000..e69de29bb2 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml index c39152d488..ac237d5eed 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml @@ -7451,6 +7451,11 @@ <output-dir compare="Text">active_requests</output-dir> </compilation-unit> </test-case> + <test-case FilePath="misc"> + <compilation-unit name="limit_after_offset"> + <output-dir compare="Text">limit_after_offset</output-dir> + </compilation-unit> + </test-case> <test-case FilePath="misc"> <compilation-unit name="jobs"> <output-dir compare="Text">jobs</output-dir> diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj index 0d0b694c2a..7a46e95c9b 100644 --- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj +++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj @@ -5858,6 +5858,7 @@ LimitClause LimitClause() throws ParseException: | ( <OFFSET> { startToken = token; pushForbiddenScope(getCurrentScope()); } offsetExpr = Expression() + ( <LIMIT> limitExpr = Expression() )? { popForbiddenScope(); } ) )
