Fixed issue 108.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix-fix-issue-108@189 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index.aql
new file mode 100644
index 0000000..ee418e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index.aql
@@ -0,0 +1,35 @@
+/*
+ * Test case Name : empty-load-with-index.aql
+ * Description : Check that an empty load doesn't preclude a future non-empty load on secondary index
+ * Expected Result : Success
+ * Date : May 2 2012
+ */
+
+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)
+ partitioned by key l_orderkey, l_linenumber;
+
+create index linenum_index on LineID(l_linenumber);
+
+load dataset LineID
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/empty.adm"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load dataset LineID
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+write output to nc1:"rttest/dml_empty-load-with-index.adm";
+for $c in dataset('LineID')
+order by $c.l_orderkey, $c.l_linenumber
+limit 1
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/empty-load.aql b/asterix-app/src/test/resources/runtimets/queries/dml/empty-load.aql
new file mode 100644
index 0000000..5f51b93
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/empty-load.aql
@@ -0,0 +1,33 @@
+/*
+ * Test case Name : empty-load.aql
+ * Description : Check that an empty load doesn't preclude a future non-empty load on a primary index
+ * Expected Result : Success
+ * Date : May 2 2012
+ */
+
+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)
+ partitioned by key l_orderkey, l_linenumber;
+
+load dataset LineID
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/empty.adm"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load dataset LineID
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+write output to nc1:"rttest/dml_empty-load.adm";
+for $c in dataset('LineID')
+order by $c.l_orderkey, $c.l_linenumber
+limit 1
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index.aql
new file mode 100644
index 0000000..f88b897
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index.aql
@@ -0,0 +1,50 @@
+/*
+ * Test case Name : insert-into-empty-dataset-with-index.aql
+ * Description : Check that we can insert into an empty dataset and its empty secondary indexes
+ * Expected Result : Success
+ * Date : May 2 2012
+ */
+
+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)
+ partitioned by key l_orderkey, l_linenumber;
+
+create index idx_LineID_partkey on LineID(l_linenumber);
+create index idx_LineID_suppkey on LineID(l_suppkey);
+
+insert into dataset LineID (
+let $x:=1
+let $y:=2
+let $z:=3
+return {
+ "l_orderkey": $x,
+ "l_partkey": $y,
+ "l_suppkey": $z
+}
+);
+
+insert into dataset LineID (
+let $x:=2
+let $y:=3
+let $z:=4
+return {
+ "l_orderkey": $x,
+ "l_partkey": $y,
+ "l_suppkey": $z
+}
+);
+
+write output to nc1:"rttest/dml_insert-into-empty-dataset-with-index.adm";
+for $c in dataset('LineID')
+where $c.l_suppkey < 100 and $c.l_linenumber<5
+order by $c.l_orderkey, $c.l_linenumber
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset.aql
index 5c19730..ad7e3b2 100644
--- a/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset.aql
@@ -1,3 +1,10 @@
+/*
+ * Test case Name : insert-into-empty-dataset.aql
+ * Description : Check that we can insert into an empty dataset
+ * Expected Result : Success
+ * Date : May 2 2012
+ */
+
drop dataverse test if exists;
create dataverse test;
use dataverse test;