>From Peeyush Gupta <[email protected]>: Peeyush Gupta has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17997 )
Change subject: [ASTERIXDB-3327][COMP] NPE caused by offset without limit in query ...................................................................... [ASTERIXDB-3327][COMP] NPE caused by offset without limit in query - user model changes: no - storage format changes: no - interface changes: no Change-Id: I7b4f69d52e403674246a6a0995cfd3122e5d1b13 --- A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/limit/offset_without_limit/offset_without_limit.7.query.sqlpp M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java A asterixdb/asterix-app/src/test/resources/runtimets/results/limit/offset_without_limit/offset_without_limit.7.adm 3 files changed, 44 insertions(+), 1 deletion(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/97/17997/1 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/limit/offset_without_limit/offset_without_limit.7.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/limit/offset_without_limit/offset_without_limit.7.query.sqlpp new file mode 100644 index 0000000..e0df538 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/limit/offset_without_limit/offset_without_limit.7.query.sqlpp @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/* + * Description : Test that offset without limit is NOT pushed into a primary scan + * Expected Result : Success + */ + +use test; + +select x, count(*) as count from [{"id":10, "x":1},{"id":10, "x":2}] a group by x order by x offset 1; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/limit/offset_without_limit/offset_without_limit.7.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/limit/offset_without_limit/offset_without_limit.7.adm new file mode 100644 index 0000000..d29535d --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/limit/offset_without_limit/offset_without_limit.7.adm @@ -0,0 +1 @@ +{ "x": 2, "count": 1 } diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java index 8ab87e7..92452ca 100644 --- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java +++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java @@ -332,7 +332,9 @@ @Override public Void visit(LimitClause limitClause, Collection<VariableExpr> freeVars) throws CompilationException { - limitClause.getLimitExpr().accept(this, freeVars); + if (limitClause.hasLimitExpr()) { + limitClause.getLimitExpr().accept(this, freeVars); + } return null; } -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17997 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: trinity Gerrit-Change-Id: I7b4f69d52e403674246a6a0995cfd3122e5d1b13 Gerrit-Change-Number: 17997 Gerrit-PatchSet: 1 Gerrit-Owner: Peeyush Gupta <[email protected]> Gerrit-MessageType: newchange
