Dmitry Lychagin has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/2890
Change subject: [ASTERIXDB-2440][COMP] Compiler failure with IN expression
......................................................................
[ASTERIXDB-2440][COMP] Compiler failure with IN expression
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Fixed NullPointerException when IN expression is passed as
an argument to a function call
Change-Id: I4f9734c37b074ef9b16bc7ae403ae079b86b0e9a
---
M
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
A
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/in_as_or/in_as_or.9.query.sqlpp
A
asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/in_as_or/in_as_or.9.adm
3 files changed, 29 insertions(+), 9 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/90/2890/1
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index ae9682b..91de474 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -771,7 +771,7 @@
Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo =
langExprToAlgExpression(expr, topOp);
AbstractLogicalOperator o1 = (AbstractLogicalOperator)
eo.second.getValue();
args.add(new MutableObject<>(eo.first));
- if (o1 != null && !(o1.getOperatorTag() ==
LogicalOperatorTag.ASSIGN && hasOnlyChild(o1, topOp))) {
+ if (o1 != null) {
topOp = eo.second;
}
break;
@@ -1471,14 +1471,6 @@
ScalarFunctionCallExpression callExpr = new
ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(fid));
callExpr.setSourceLocation(sourceLoc);
return callExpr;
- }
-
- private static boolean hasOnlyChild(ILogicalOperator parent,
Mutable<ILogicalOperator> childCandidate) {
- List<Mutable<ILogicalOperator>> inp = parent.getInputs();
- if (inp == null || inp.size() != 1) {
- return false;
- }
- return inp.get(0) == childCandidate;
}
protected Pair<ILogicalExpression, Mutable<ILogicalOperator>>
langExprToAlgExpression(Expression expr,
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/in_as_or/in_as_or.9.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/in_as_or/in_as_or.9.query.sqlpp
new file mode 100644
index 0000000..4b27077
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/in_as_or/in_as_or.9.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use tpch;
+
+select value c.c_custkey
+from Customer c
+where not(c.c_name in ["Customer#000000001", "Customer#000000002",
"Customer#000000003"])
+order by c.c_custkey
+limit 2
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/in_as_or/in_as_or.9.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/in_as_or/in_as_or.9.adm
new file mode 100644
index 0000000..c79bf28
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/in_as_or/in_as_or.9.adm
@@ -0,0 +1,2 @@
+4
+5
\ No newline at end of file
--
To view, visit https://asterix-gerrit.ics.uci.edu/2890
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f9734c37b074ef9b16bc7ae403ae079b86b0e9a
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Dmitry Lychagin <[email protected]>