Repository: asterixdb
Updated Branches:
  refs/heads/master 03e44a573 -> c9cbb2c07


ASTERIXDB-1693: Fix Default dataverse types referencing

Change-Id: Iae7ed8a2de345531345e4df2f9e06aa0d7680ebc
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1284
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamou...@gmail.com>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>


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

Branch: refs/heads/master
Commit: c9cbb2c071d4bbc2b4b0e338ac67c56542b92726
Parents: 03e44a5
Author: Murtadha Hubail <mhub...@uci.edu>
Authored: Fri Oct 14 17:04:46 2016 +0300
Committer: Murtadha Hubail <hubail...@gmail.com>
Committed: Fri Oct 14 08:45:01 2016 -0700

----------------------------------------------------------------------
 .../asterix/app/translator/QueryTranslator.java |  6 ++---
 ...ataset_with_default_dataverse_type.1.ddl.aql | 25 ++++++++++++++++++++
 ...aset_with_default_dataverse_type.2.query.aql | 23 ++++++++++++++++++
 ...ataset_with_default_dataverse_type.3.ddl.aql | 20 ++++++++++++++++
 .../dataset_with_default_dataverse_type.2.adm   |  1 +
 .../src/test/resources/metadata/testsuite.xml   |  5 ++++
 6 files changed, 77 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c9cbb2c0/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 91b33ee..f4ef1a1 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -513,9 +513,9 @@ public class QueryTranslator extends AbstractLangTranslator 
implements IStatemen
         String dataverseName = getActiveDataverse(dd.getDataverse());
         String datasetName = dd.getName().getValue();
         DatasetType dsType = dd.getDatasetType();
-        String itemTypeDataverseName = dd.getItemTypeDataverse().getValue();
+        String itemTypeDataverseName = 
getActiveDataverse(dd.getItemTypeDataverse());
         String itemTypeName = dd.getItemTypeName().getValue();
-        String metaItemTypeDataverseName = 
dd.getMetaItemTypeDataverse().getValue();
+        String metaItemTypeDataverseName = 
getActiveDataverse(dd.getMetaItemTypeDataverse());
         String metaItemTypeName = dd.getMetaItemTypeName().getValue();
         Identifier ngNameId = dd.getNodegroupName();
         String nodegroupName = getNodeGroupName(ngNameId, dd, dataverseName);
@@ -3101,7 +3101,7 @@ public class QueryTranslator extends 
AbstractLangTranslator implements IStatemen
         return (dataverse != null) ? dataverse : 
activeDefaultDataverse.getDataverseName();
     }
 
-    protected String getActiveDataverse(Identifier dataverse) throws 
AlgebricksException {
+    protected String getActiveDataverse(Identifier dataverse) {
         return getActiveDataverseName(dataverse != null ? dataverse.getValue() 
: null);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c9cbb2c0/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.1.ddl.aql
new file mode 100644
index 0000000..732363f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.1.ddl.aql
@@ -0,0 +1,25 @@
+/*
+ * 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 type UserType if exists;
+
+create type UserType as {
+  id: bigint
+};
+
+create dataset GleambookUsers(UserType) primary key id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c9cbb2c0/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.query.aql
 
b/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.query.aql
new file mode 100644
index 0000000..eb73925
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.query.aql
@@ -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.
+ */
+let $count := count(
+for $v in dataset Metadata.Dataset
+where $v.DatasetName = 'GleambookUsers'
+return $v)
+return $count
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c9cbb2c0/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.3.ddl.aql
new file mode 100644
index 0000000..272c659
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.3.ddl.aql
@@ -0,0 +1,20 @@
+/*
+ * 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 dataset GleambookUsers if exists;
+drop type UserType if exists;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c9cbb2c0/asterixdb/asterix-app/src/test/resources/metadata/results/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.adm
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.adm
@@ -0,0 +1 @@
+1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c9cbb2c0/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml 
b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
index 251e2e4..7b0e015 100644
--- a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -19,6 +19,11 @@
 <test-suite xmlns="urn:xml.testframework.asterix.apache.org" 
ResultOffsetPath="results" QueryOffsetPath="queries" QueryFileExtension=".aql">
   <test-group name="basic">
     <test-case FilePath="basic">
+      <compilation-unit name="dataset_with_default_dataverse_type">
+        <output-dir 
compare="Text">dataset_with_default_dataverse_type</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="basic">
       <compilation-unit name="dataset_with_meta-1">
         <output-dir compare="Text">dataset_with_meta-1</output-dir>
       </compilation-unit>

Reply via email to