You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2016/12/22 01:27:33 UTC

asterixdb git commit: ASTERIXDB-1754: fix NPE in CopyLimitDownRule.

Repository: asterixdb
Updated Branches:
  refs/heads/master 03e940a77 -> eb199d3a9


ASTERIXDB-1754: fix NPE in CopyLimitDownRule.

Change-Id: Ia9e26912a048c680aa9db7a12cd3933a7acbde37
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1399
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
BAD: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/eb199d3a
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/eb199d3a
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/eb199d3a

Branch: refs/heads/master
Commit: eb199d3a91563968c35786bb9f2b8bbd9da7db16
Parents: 03e940a
Author: Yingyi Bu <yi...@couchbase.com>
Authored: Tue Dec 20 13:43:17 2016 -0800
Committer: Yingyi Bu <bu...@gmail.com>
Committed: Wed Dec 21 17:27:09 2016 -0800

----------------------------------------------------------------------
 .../query-ASTERIXDB-1754.1.ddl.sqlpp            | 38 ++++++++++++++++++++
 .../query-ASTERIXDB-1754.2.query.sqlpp          | 28 +++++++++++++++
 .../query-ASTERIXDB-1754.1.adm                  |  1 +
 .../resources/runtimets/testsuite_sqlpp.xml     |  5 +++
 .../rewriter/rules/CopyLimitDownRule.java       |  1 +
 5 files changed, 73 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/eb199d3a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.ddl.sqlpp
new file mode 100644
index 0000000..7eb1cd1
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.ddl.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+create type CustomerType as
+{
+  cid : bigint
+}
+
+create type OrderType as
+{
+  oid : bigint
+}
+
+create external dataset Customers(CustomerType) using localfs((`path`=`asterix_nc1://data/nontagged/customerData.json`),(`format`=`adm`));
+
+create external dataset Orders(OrderType) using localfs((`path`=`asterix_nc1://data/nontagged/orderData.json`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/eb199d3a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.2.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.2.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.2.query.sqlpp
new file mode 100644
index 0000000..74e50e3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.2.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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 test;
+
+SELECT c.name AS cust_name,
+       c.age AS cust_age,
+       o.total AS order_total
+FROM Customers c, Orders o
+WHERE c.cid = o.cid AND c.age != o.total
+LIMIT 1
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/eb199d3a/asterixdb/asterix-app/src/test/resources/runtimets/results/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.adm
new file mode 100644
index 0000000..c18fb3d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/custord/query-ASTERIXDB-1754/query-ASTERIXDB-1754.1.adm
@@ -0,0 +1 @@
+{ "cust_name": "Jodi Alex", "cust_age": 19, "order_total": 7.206 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/eb199d3a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 57be018..bd3266e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -1411,6 +1411,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="custord">
+      <compilation-unit name="query-ASTERIXDB-1754">
+        <output-dir compare="Text">query-ASTERIXDB-1754</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="custord">
       <compilation-unit name="load-test">
         <output-dir compare="Text">load-test</output-dir>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/eb199d3a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/CopyLimitDownRule.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/CopyLimitDownRule.java b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/CopyLimitDownRule.java
index a68ed6c..372af26 100644
--- a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/CopyLimitDownRule.java
+++ b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/CopyLimitDownRule.java
@@ -103,6 +103,7 @@ public class CopyLimitDownRule implements IAlgebraicRewriteRule {
             limitCloneOp.setPhysicalOperator(new StreamLimitPOperator());
             limitCloneOp.getInputs().add(new MutableObject<ILogicalOperator>(unsafeOp));
             limitCloneOp.setExecutionMode(unsafeOp.getExecutionMode());
+            OperatorPropertiesUtil.computeSchemaRecIfNull((AbstractLogicalOperator) unsafeOp);
             limitCloneOp.recomputeSchema();
             unsafeOpRef.setValue(limitCloneOp);
             context.computeAndSetTypeEnvironmentForOperator(limitCloneOp);