ASTERIXDB-1231, ASTERIXDB-636: fixed Self-join
- Fixed self-join with index-out-of-boud exception during the compilation
- Added a test case for ASTERIXDB-636
Change-Id: I8d5d9cb0cb54473fbe7a5e43934e9608548c1dbb
Reviewed-on: https://asterix-gerrit.ics.uci.edu/635
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.1.ddl.aql
new file mode 100644
index 0000000..1a690a1
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.1.ddl.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+/*
+ * Description : Checks whether a meta-data self-join query works or not.
+ * Expected Res : Success
+ * Issue : ASTERIXDB-1231
+ */
+
+drop dataverse testdv if exists;
+drop dataverse test if exists;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.2.update.aql
new file mode 100644
index 0000000..15bf59a
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.2.update.aql
@@ -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.
+ */
+
+/*
+ * Description : Checks whether a meta-data self-join query works or not.
+ * Expected Res : Success
+ * Issue : ASTERIXDB-1231
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.3.query.aql
new file mode 100644
index 0000000..569d3d1
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_selfjoin/metadata_selfjoin.3.query.aql
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+/*
+ * Description : Checks whether a meta-data self-join query works or not.
+ * Expected Res : Success
+ * Issue : ASTERIXDB-1231
+ */
+
+use dataverse Metadata;
+
+for $m in dataset Metadata.Dataset
+for $n in dataset Metadata.Dataset
+where $m=$n
+return
+{ "dv1": $m.DataverseName, "dv2": $n.DataverseName }
diff --git a/asterix-app/src/test/resources/metadata/results/basic/metadata_selfjoin/metadata_selfjoin.1.adm b/asterix-app/src/test/resources/metadata/results/basic/metadata_selfjoin/metadata_selfjoin.1.adm
new file mode 100644
index 0000000..da05a15
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/metadata_selfjoin/metadata_selfjoin.1.adm
@@ -0,0 +1,13 @@
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
+{ "dv1": "Metadata", "dv2": "Metadata" }
diff --git a/asterix-app/src/test/resources/metadata/testsuite.xml b/asterix-app/src/test/resources/metadata/testsuite.xml
index 0b8c26a..bba2ab0 100644
--- a/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -274,6 +274,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="basic">
+ <compilation-unit name="metadata_selfjoin">
+ <output-dir compare="Text">metadata_selfjoin</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="basic">
<compilation-unit name="temp_dataset">
<output-dir compare="Text">temp_dataset</output-dir>
</compilation-unit>