ASTERIXDB-769: adds a regression test.
Change-Id: Ifaa6a37de981c5f60a416db85d3485d042558f63
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1027
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.1.ddl.aql
new file mode 100644
index 0000000..51460ff
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.1.ddl.aql
@@ -0,0 +1,35 @@
+/*
+ * 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 dataverse test;
+
+create type Type1 as closed {
+id: int32,
+items: [
+{ subid: string, value: int32 }
+]
+}
+create type Type2 as closed
+{ id: string, val: int32 }
+
+create dataset Dataset1(Type1) primary key id;
+
+create dataset Dataset2(Type2) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.2.update.aql
new file mode 100644
index 0000000..2b82631
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.2.update.aql
@@ -0,0 +1,52 @@
+/*
+ * 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 dataverse test;
+
+insert into dataset Dataset1 (
+{ "id": 1, "items": [
+{ "subid": "2", "value": 1 }
+,
+{ "subid": "4", "value": 1111 }
+] }
+)
+insert into dataset Dataset1 (
+{ "id": 2, "items": [
+{ "subid": "0", "value": 1 }
+,
+{ "subid": "1", "value": 2222 }
+] }
+)
+insert into dataset Dataset2 (
+{ "id": "0", "val": 0 }
+)
+insert into dataset Dataset2 (
+{ "id": "1", "val": 1 }
+)
+insert into dataset Dataset2 (
+{ "id": "2", "val": 2 }
+)
+insert into dataset Dataset2 (
+{ "id": "3", "val": 3 }
+)
+insert into dataset Dataset2 (
+{ "id": "4", "val": 4 }
+)
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.3.query.aql
new file mode 100644
index 0000000..2dd7673
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.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.
+ */
+
+use dataverse test;
+
+for $i in dataset Dataset1
+for $j in $i.items
+order by $i.id, $j.value
+return {
+ "id": $i.id,
+ "items":
+ for $k in dataset Dataset2
+ order by $k.id
+ return { "subid": $k.id, "value": switch-case($k.id = $j.subid, true, $j.value, false, $k.val) }
+}
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.1.adm
new file mode 100644
index 0000000..595e05b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query-ASTERIXDB-769/query-ASTERIXDB-769.1.adm
@@ -0,0 +1,4 @@
+{ "id": 1, "items": [ { "subid": "0", "value": 0 }, { "subid": "1", "value": 1 }, { "subid": "2", "value": 1 }, { "subid": "3", "value": 3 }, { "subid": "4", "value": 4 } ] }
+{ "id": 1, "items": [ { "subid": "0", "value": 0 }, { "subid": "1", "value": 1 }, { "subid": "2", "value": 2 }, { "subid": "3", "value": 3 }, { "subid": "4", "value": 1111 } ] }
+{ "id": 2, "items": [ { "subid": "0", "value": 1 }, { "subid": "1", "value": 1 }, { "subid": "2", "value": 2 }, { "subid": "3", "value": 3 }, { "subid": "4", "value": 4 } ] }
+{ "id": 2, "items": [ { "subid": "0", "value": 0 }, { "subid": "1", "value": 2222 }, { "subid": "2", "value": 2 }, { "subid": "3", "value": 3 }, { "subid": "4", "value": 4 } ] }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index deee18f..619b378 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -6774,6 +6774,11 @@
<output-dir compare="Text">query_issue849-2</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="leftouterjoin">
+ <compilation-unit name="query-ASTERIXDB-769">
+ <output-dir compare="Text">query-ASTERIXDB-769</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="index-leftouterjoin">
<test-case FilePath="index-leftouterjoin">