asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject asterixdb git commit: ASTERIXDB-1597: fix and add a regression test.
Date Fri, 26 Aug 2016 05:20:08 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 4e33cd95a -> e6a6cc392


ASTERIXDB-1597: fix and add a regression test.

- Change the order of rule applications, let PushAggFuncIntoStandaloneAggregateRule
  run after ExtractCommonExpressionsRule

Change-Id: Ifc7d757f4d0073dc00a5b2a5aca16581f12cec1d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1116
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


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

Branch: refs/heads/master
Commit: e6a6cc392dd84aac1a088803ab5fecd67b00dc9f
Parents: 4e33cd9
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Thu Aug 25 19:09:15 2016 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Thu Aug 25 22:19:51 2016 -0700

----------------------------------------------------------------------
 .../asterix/optimizer/base/RuleCollections.java |  5 +++-
 .../query-ASTERIXDB-1597.1.ddl.sqlpp            | 31 ++++++++++++++++++++
 .../query-ASTERIXDB-1597.2.update.sqlpp         | 23 +++++++++++++++
 .../query-ASTERIXDB-1597.3.query.sqlpp          | 26 ++++++++++++++++
 .../query-ASTERIXDB-1597.1.adm                  |  1 +
 .../resources/runtimets/testsuite_sqlpp.xml     |  5 ++++
 6 files changed, 90 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e6a6cc39/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
index b29f743..1b11cde 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
@@ -161,7 +161,6 @@ public final class RuleCollections {
         normalization.add(new IntroduceUnnestForCollectionToSequenceRule());
         normalization.add(new EliminateSubplanRule());
         normalization.add(new EnforceOrderByAfterSubplan());
-        normalization.add(new PushAggFuncIntoStandaloneAggregateRule());
         normalization.add(new BreakSelectIntoConjunctsRule());
         normalization.add(new ExtractGbyExpressionsRule());
         normalization.add(new ExtractDistinctByExpressionsRule());
@@ -175,6 +174,10 @@ public final class RuleCollections {
         normalization.add(new IntroduceDynamicTypeCastForExternalFunctionRule());
         normalization.add(new IntroduceEnforcedListTypeRule());
         normalization.add(new ExtractCommonExpressionsRule());
+
+        // Let PushAggFuncIntoStandaloneAggregateRule run after ExtractCommonExpressionsRule
+        // so that PushAggFunc can happen in fewer places.
+        normalization.add(new PushAggFuncIntoStandaloneAggregateRule());
         normalization.add(new ConstantFoldingRule());
         normalization.add(new RemoveRedundantSelectRule());
         normalization.add(new UnnestToDataScanRule(algebraExtensionManager));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e6a6cc39/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.ddl.sqlpp
new file mode 100644
index 0000000..07c39e3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as closed {
+  id: int8
+};
+
+create dataset samptable(samptabletype) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e6a6cc39/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.2.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.2.update.sqlpp
new file mode 100644
index 0000000..d1ad8b5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.2.update.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.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+insert into samptable ({'id' : 1});

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e6a6cc39/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.3.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.3.query.sqlpp
new file mode 100644
index 0000000..0c44d1c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.3.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 test;
+
+select t1.sumid
+from (
+  select sum(s.id) sumid from samptable s
+) t1
+order by t1.sumid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e6a6cc39/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.adm
new file mode 100644
index 0000000..d23d39d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/subquery/query-ASTERIXDB-1597/query-ASTERIXDB-1597.1.adm
@@ -0,0 +1 @@
+{ "sumid": 1 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e6a6cc39/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 5aa466c..e3f67f4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -5685,6 +5685,11 @@
         <expected-error>Cannot resolve ambiguous alias reference for undefined identifier</expected-error>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="subquery">
+      <compilation-unit name="query-ASTERIXDB-1597">
+        <output-dir compare="Text">query-ASTERIXDB-1597</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="subset-collection">
     <test-case FilePath="subset-collection">


Mime
View raw message