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-1629: fix the open record constructor type computer.
Date Wed, 14 Sep 2016 01:05:32 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 93a67deeb -> f798175f2


ASTERIXDB-1629: fix the open record constructor type computer.

Change-Id: I1a6ad39a889a774d6e448b2efe90134b5490f7c8
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1167
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/f798175f
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/f798175f
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/f798175f

Branch: refs/heads/master
Commit: f798175f238d1646d474e717ddded33c4432e880
Parents: 93a67de
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Tue Sep 13 14:54:09 2016 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Tue Sep 13 18:05:03 2016 -0700

----------------------------------------------------------------------
 .../query-ASTERIXDB-1629.1.ddl.sqlpp            | 43 ++++++++++++++++++++
 .../query-ASTERIXDB-1629.2.update.sqlpp         | 24 +++++++++++
 .../query-ASTERIXDB-1629.3.query.sqlpp          | 24 +++++++++++
 .../query-ASTERIXDB-1629.1.adm                  |  2 +
 .../resources/runtimets/testsuite_sqlpp.xml     |  5 +++
 .../impl/OpenRecordConstructorResultType.java   |  6 +++
 6 files changed, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f798175f/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.ddl.sqlpp
new file mode 100644
index 0000000..babf75e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.ddl.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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 LineItemType as closed {
+  l_orderkey: int32,
+  l_partkey: int32,
+  l_suppkey: int32,
+  l_linenumber: int32,
+  l_quantity: int32,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create dataset LineItem(LineItemType) primary key l_orderkey, l_linenumber;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f798175f/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.2.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.2.update.sqlpp
new file mode 100644
index 0000000..6d593d3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+load dataset LineItem
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f798175f/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.3.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.3.query.sqlpp
new file mode 100644
index 0000000..f04f7b3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.3.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 AVG(1) AS one FROM LineItem
+UNION ALL
+SELECT AVG(1) AS one FROM LineItem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f798175f/asterixdb/asterix-app/src/test/resources/runtimets/results/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.adm
new file mode 100644
index 0000000..2e350b8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/union/query-ASTERIXDB-1629/query-ASTERIXDB-1629.1.adm
@@ -0,0 +1,2 @@
+{ "one": 1.0 }
+{ "one": 1.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f798175f/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 7027092..3dd4ad5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -8117,5 +8117,10 @@
         <output-dir compare="Text">query-ASTERIXDB-1354-2</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="union">
+      <compilation-unit name="query-ASTERIXDB-1629">
+        <output-dir compare="Text">query-ASTERIXDB-1629</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
 </test-suite>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f798175f/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
index a12bc1d..baee36a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/OpenRecordConstructorResultType.java
@@ -28,6 +28,8 @@ import java.util.Set;
 import org.apache.asterix.om.typecomputer.base.IResultTypeComputer;
 import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
 import org.apache.asterix.om.types.ARecordType;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.types.TypeHelper;
 import org.apache.asterix.om.util.ConstantExpressionUtil;
@@ -71,6 +73,10 @@ public class OpenRecordConstructorResultType implements IResultTypeComputer
{
             String fieldName = ConstantExpressionUtil.getStringConstant(e1);
             if (fieldName != null && t2 != null && TypeHelper.isClosed(t2))
{
                 namesList.add(fieldName);
+                if (t2.getTypeTag() == ATypeTag.UNION) {
+                    AUnionType unionType = (AUnionType) t2;
+                    t2 = AUnionType.createUnknownableType(unionType.getActualType());
+                }
                 typesList.add(t2);
             } else {
                 if (canProvideAdditionFieldInfo && fieldName != null) {


Mime
View raw message