merge back the fixes for issue285 and issue288: r1477:1478 and r1481:1482 from asterix_issue285
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@1483 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.1.ddl.aql
new file mode 100644
index 0000000..0f548a1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.1.ddl.aql
@@ -0,0 +1,23 @@
+/*
+ * Description : This test case is to verify the fix for issue288
+ : https://code.google.com/p/asterixdb/issues/detail?id=288
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type LineIDType as closed {
+ l_orderkey: int32,
+ l_linenumber: int32,
+ l_suppkey: int32
+}
+
+create dataset LineID(LineIDType)
+ primary key l_orderkey, l_linenumber;
+
+create dataset LineID2(LineIDType)
+ primary key l_orderkey, l_linenumber;
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.2.update.aql
new file mode 100644
index 0000000..181085f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * Description : This test case is to verify the fix for issue288
+ : https://code.google.com/p/asterixdb/issues/detail?id=288
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+use dataverse test;
+
+load dataset LineID
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem_0.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+
+insert into dataset LineID (
+let $x:=1
+let $y:=2
+let $z:=3
+return {
+ "l_orderkey": $x,
+ "l_linenumber": $y,
+ "l_suppkey": $z
+}
+);
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.3.ddl.aql
new file mode 100644
index 0000000..c3a2bef
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.3.ddl.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : This test case is to verify the fix for issue288
+ : https://code.google.com/p/asterixdb/issues/detail?id=288
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+use dataverse test;
+
+create index idx_LineID_1 on LineID(l_linenumber);
+create index idx_LineID_2 on LineID2(l_linenumber);
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.4.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.4.update.aql
new file mode 100644
index 0000000..2ae4ba0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.4.update.aql
@@ -0,0 +1,25 @@
+/*
+ * Description : This test case is to verify the fix for issue288
+ : https://code.google.com/p/asterixdb/issues/detail?id=288
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+use dataverse test;
+
+insert into dataset LineID2
+(
+ for $r in dataset('LineID')
+ return $r
+);
+
+// If we replace the insert statement with this, it will work
+/* insert into dataset LineID2
+(
+ for $r in dataset('LineID')
+ return {
+"l_orderkey": $r.l_orderkey,
+"l_linenumber": $r.l_linenumber,
+"l_suppkey": $r.l_suppkey}
+);
+*/
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.5.query.aql
new file mode 100644
index 0000000..a1196bd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue288/query-issue288.5.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : This test case is to verify the fix for issue288
+ : https://code.google.com/p/asterixdb/issues/detail?id=288
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+use dataverse test;
+
+for $c in dataset('LineID2')
+where $c.l_linenumber=2
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql
new file mode 100644
index 0000000..230315e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql
@@ -0,0 +1,31 @@
+/*
+ * Description : Left-outer joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create type CSXType as closed {
+ id: int32,
+ csxid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+create dataset CSX(CSXType) primary key id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql
new file mode 100644
index 0000000..923f6e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql
@@ -0,0 +1,17 @@
+/*
+ * Description : Left-outer joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+load dataset DBLP
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+
+load dataset CSX
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql
new file mode 100644
index 0000000..edcb9b2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql
@@ -0,0 +1,25 @@
+/*
+ * Description : Left-outer joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ *
+ * TODO(@Sattam): given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ *
+ * regression test 2 for issue 285--having an order by and limit for the outer loop relation
+ *
+ * Success : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('DBLP')
+order by $a.id
+limit 10
+return {
+"aid": $a.id,
+"bids": for $b in dataset('CSX')
+where $a.authors = $b.authors
+order by $b.id
+return $b.id
+}
diff --git a/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql
new file mode 100644
index 0000000..a04adc8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql
@@ -0,0 +1,35 @@
+/*
+ * Description : Left-outer joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title.
+ *
+ * TODO(@Sattam): given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ *
+ * regression test for issue 285
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create type CSXType as closed {
+ id: int32,
+ csxid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+create dataset CSX(CSXType) primary key id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql
new file mode 100644
index 0000000..923f6e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql
@@ -0,0 +1,17 @@
+/*
+ * Description : Left-outer joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+load dataset DBLP
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+
+load dataset CSX
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.3.query.aql
new file mode 100644
index 0000000..f5ff114
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.3.query.aql
@@ -0,0 +1,23 @@
+/*
+ * Description : Left-outer joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ *
+ * TODO(@Sattam): given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ *
+ * regression test for issue 285--having an order by for the outer loop relation
+ * Success : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('DBLP')
+order by $a.id
+return {
+"aid": $a.id,
+"bids": for $b in dataset('CSX')
+where $a.authors = $b.authors
+order by $b.id
+return $b.id
+}
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/query-issue288/query-issue288.1.adm b/asterix-app/src/test/resources/runtimets/results/dml/query-issue288/query-issue288.1.adm
new file mode 100644
index 0000000..e6716e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/query-issue288/query-issue288.1.adm
@@ -0,0 +1 @@
+{ "l_orderkey": 1, "l_linenumber": 2, "l_suppkey": 3 }
diff --git a/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query_issue285-2/query_issue285-2.1.adm b/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query_issue285-2/query_issue285-2.1.adm
new file mode 100644
index 0000000..3005398
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query_issue285-2/query_issue285-2.1.adm
@@ -0,0 +1,10 @@
+{ "aid": 1, "bids": [ ] }
+{ "aid": 2, "bids": [ ] }
+{ "aid": 3, "bids": [ ] }
+{ "aid": 4, "bids": [ ] }
+{ "aid": 5, "bids": [ 98 ] }
+{ "aid": 6, "bids": [ ] }
+{ "aid": 7, "bids": [ ] }
+{ "aid": 8, "bids": [ ] }
+{ "aid": 9, "bids": [ ] }
+{ "aid": 10, "bids": [ ] }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query_issue285/query_issue285.1.adm b/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query_issue285/query_issue285.1.adm
new file mode 100644
index 0000000..62c427a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/leftouterjoin/query_issue285/query_issue285.1.adm
@@ -0,0 +1,100 @@
+{ "aid": 1, "bids": [ ] }
+{ "aid": 2, "bids": [ ] }
+{ "aid": 3, "bids": [ ] }
+{ "aid": 4, "bids": [ ] }
+{ "aid": 5, "bids": [ 98 ] }
+{ "aid": 6, "bids": [ ] }
+{ "aid": 7, "bids": [ ] }
+{ "aid": 8, "bids": [ ] }
+{ "aid": 9, "bids": [ ] }
+{ "aid": 10, "bids": [ ] }
+{ "aid": 11, "bids": [ ] }
+{ "aid": 12, "bids": [ ] }
+{ "aid": 13, "bids": [ ] }
+{ "aid": 14, "bids": [ ] }
+{ "aid": 15, "bids": [ ] }
+{ "aid": 16, "bids": [ ] }
+{ "aid": 17, "bids": [ ] }
+{ "aid": 18, "bids": [ ] }
+{ "aid": 19, "bids": [ ] }
+{ "aid": 20, "bids": [ ] }
+{ "aid": 21, "bids": [ ] }
+{ "aid": 22, "bids": [ ] }
+{ "aid": 23, "bids": [ ] }
+{ "aid": 24, "bids": [ ] }
+{ "aid": 25, "bids": [ ] }
+{ "aid": 26, "bids": [ ] }
+{ "aid": 27, "bids": [ ] }
+{ "aid": 28, "bids": [ ] }
+{ "aid": 29, "bids": [ ] }
+{ "aid": 30, "bids": [ ] }
+{ "aid": 31, "bids": [ ] }
+{ "aid": 32, "bids": [ ] }
+{ "aid": 33, "bids": [ ] }
+{ "aid": 34, "bids": [ 57 ] }
+{ "aid": 35, "bids": [ ] }
+{ "aid": 36, "bids": [ ] }
+{ "aid": 37, "bids": [ ] }
+{ "aid": 38, "bids": [ ] }
+{ "aid": 39, "bids": [ ] }
+{ "aid": 40, "bids": [ ] }
+{ "aid": 41, "bids": [ ] }
+{ "aid": 42, "bids": [ ] }
+{ "aid": 43, "bids": [ ] }
+{ "aid": 44, "bids": [ ] }
+{ "aid": 45, "bids": [ ] }
+{ "aid": 46, "bids": [ ] }
+{ "aid": 47, "bids": [ ] }
+{ "aid": 48, "bids": [ ] }
+{ "aid": 49, "bids": [ ] }
+{ "aid": 50, "bids": [ ] }
+{ "aid": 51, "bids": [ ] }
+{ "aid": 52, "bids": [ ] }
+{ "aid": 53, "bids": [ ] }
+{ "aid": 54, "bids": [ 91 ] }
+{ "aid": 55, "bids": [ ] }
+{ "aid": 56, "bids": [ ] }
+{ "aid": 57, "bids": [ ] }
+{ "aid": 58, "bids": [ ] }
+{ "aid": 59, "bids": [ ] }
+{ "aid": 60, "bids": [ ] }
+{ "aid": 61, "bids": [ ] }
+{ "aid": 62, "bids": [ ] }
+{ "aid": 63, "bids": [ ] }
+{ "aid": 64, "bids": [ ] }
+{ "aid": 65, "bids": [ ] }
+{ "aid": 66, "bids": [ ] }
+{ "aid": 67, "bids": [ ] }
+{ "aid": 68, "bids": [ 57 ] }
+{ "aid": 69, "bids": [ 57 ] }
+{ "aid": 70, "bids": [ ] }
+{ "aid": 71, "bids": [ ] }
+{ "aid": 72, "bids": [ ] }
+{ "aid": 73, "bids": [ ] }
+{ "aid": 74, "bids": [ ] }
+{ "aid": 75, "bids": [ ] }
+{ "aid": 76, "bids": [ ] }
+{ "aid": 77, "bids": [ ] }
+{ "aid": 78, "bids": [ ] }
+{ "aid": 79, "bids": [ ] }
+{ "aid": 80, "bids": [ ] }
+{ "aid": 81, "bids": [ ] }
+{ "aid": 82, "bids": [ ] }
+{ "aid": 83, "bids": [ ] }
+{ "aid": 84, "bids": [ ] }
+{ "aid": 85, "bids": [ ] }
+{ "aid": 86, "bids": [ ] }
+{ "aid": 87, "bids": [ ] }
+{ "aid": 88, "bids": [ ] }
+{ "aid": 89, "bids": [ ] }
+{ "aid": 90, "bids": [ ] }
+{ "aid": 91, "bids": [ ] }
+{ "aid": 92, "bids": [ ] }
+{ "aid": 93, "bids": [ ] }
+{ "aid": 94, "bids": [ ] }
+{ "aid": 95, "bids": [ ] }
+{ "aid": 96, "bids": [ ] }
+{ "aid": 97, "bids": [ ] }
+{ "aid": 98, "bids": [ ] }
+{ "aid": 99, "bids": [ ] }
+{ "aid": 100, "bids": [ ] }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 4eb7b0f..f6b3192 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -743,6 +743,11 @@
-->
</test-group>
<test-group name="dml">
+ <test-case FilePath="dml">
+ <compilation-unit name="query-issue288">
+ <output-dir compare="Text">query-issue288</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="dml">
<compilation-unit name="query-issue205">
<output-dir compare="Text">query-issue205</output-dir>
@@ -4165,5 +4170,17 @@
</compilation-unit>
</test-case>
</test-group>
+ <test-group name="leftouterjoin">
+ <test-case FilePath="leftouterjoin">
+ <compilation-unit name="query_issue285">
+ <output-dir compare="Text">query_issue285</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="leftouterjoin">
+ <compilation-unit name="query_issue285-2">
+ <output-dir compare="Text">query_issue285-2</output-dir>
+ </compilation-unit>
+ </test-case>
+ </test-group>
</test-suite>