Murtadha Hubail has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1284

Change subject: ASTERIXDB-1693: Fix Default dataverse types referencing
......................................................................

ASTERIXDB-1693: Fix Default dataverse types referencing

Change-Id: Iae7ed8a2de345531345e4df2f9e06aa0d7680ebc
---
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
A 
asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.query.aql
A 
asterixdb/asterix-app/src/test/resources/metadata/queries/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.3.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/metadata/results/basic/dataset_with_default_dataverse_type/dataset_with_default_dataverse_type.2.adm
M asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
6 files changed, 77 insertions(+), 3 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/84/1284/1

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 @@
         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 @@
         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);
     }
 
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
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
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
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
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>

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1284
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae7ed8a2de345531345e4df2f9e06aa0d7680ebc
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <hubail...@gmail.com>

Reply via email to