Added asterix project
git-svn-id: https://asterixdb.googlecode.com/svn/trunk/asterix@12 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/delete-with-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/delete-with-index.aql
new file mode 100644
index 0000000..b1ad097
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/delete-with-index.aql
@@ -0,0 +1,43 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+ l_orderkey: int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: int32,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+create dataset LineItem(LineItemType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+load dataset LineItem
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+
+create index idx_LineItem_partkey on LineItem(l_linenumber);
+create index idx_LineItem_suppkey on LineItem(l_suppkey);
+
+delete $l from dataset LineItem where $l.l_suppkey>=2 or $l.l_linenumber>1;
+
+write output to nc1:"rttest/dml_delete-with-index.adm";
+for $c in dataset('LineItem')
+where $c.l_suppkey<150
+order by $c.l_orderkey, $c.l_linenumber
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/delete.aql b/asterix-app/src/test/resources/runtimets/queries/dml/delete.aql
new file mode 100644
index 0000000..cdd0315
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/delete.aql
@@ -0,0 +1,40 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+ l_orderkey: int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: int32,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset LineItem(LineItemType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+load dataset LineItem
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+
+delete $l from dataset LineItem where $l.l_orderkey>=10;
+
+write output to nc1:"rttest/dml_delete.adm";
+for $c in dataset('LineItem')
+order by $c.l_orderkey, $c.l_linenumber
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert-tuple-with-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-tuple-with-index.aql
new file mode 100644
index 0000000..fcc83d6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-tuple-with-index.aql
@@ -0,0 +1,52 @@
+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 nodegroup group1 if not exists on nc1, nc2;
+
+create dataset LineID(LineIDType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+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;
+
+
+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-tuple-with-index.adm";
+for $c in dataset('LineID')
+where $c.l_suppkey = 3 and $c.l_linenumber=2
+order by $c.l_orderkey, $c.l_linenumber
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert-tuple.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-tuple.aql
new file mode 100644
index 0000000..731f7cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-tuple.aql
@@ -0,0 +1,49 @@
+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 nodegroup group1 if not exists on nc1, nc2;
+
+create dataset LineID(LineIDType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+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_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-tuple.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-wisc.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-wisc.aql
new file mode 100644
index 0000000..4e9e594
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-wisc.aql
@@ -0,0 +1,55 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create type Schema as closed {
+unique1: int32,
+unique2: int32,
+two: int32,
+four: int32,
+ten: int32,
+twenty: int32,
+onePercent: int32,
+tenPercent: int32,
+twentyPercent: int32,
+fiftyPercent: int32,
+unique3: int32,
+evenOnePercent: int32,
+oddOnePercent: int32,
+stringu1: string,
+stringu2: string,
+string4: string
+}
+
+create dataset onektup(Schema) partitioned by key unique2 on group1;
+
+create dataset tenktup1(Schema) partitioned by key unique2 on group1;
+
+load dataset onektup
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/wisc/onektup.adm"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load dataset tenktup1
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/wisc/tenktup.adm"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+create dataset tmp(Schema) partitioned by key unique2 on group1;
+
+load dataset tmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/wisc/empty.adm"),("format"="adm")) pre-sorted;
+
+insert into dataset tmp(
+for $l in dataset('tenktup1')
+where $l.unique2 > 0 and $l.unique2 < 99
+return $l
+);
+
+write output to nc1:"rttest/dml_insert-wisc.adm";
+for $t in dataset('tmp')
+order by $t.unique2
+return $t
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-index.aql
new file mode 100644
index 0000000..ec30668
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-index.aql
@@ -0,0 +1,66 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+ l_orderkey: int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: double,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string
+}
+
+create type LineIDType as closed {
+ l_orderkey: int32,
+ l_linenumber: int32,
+ l_suppkey: int32
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset LineItem(LineItemType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+create dataset LineID(LineIDType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+load dataset LineItem
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+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;
+
+
+create index idx_LineID_partkey on LineID(l_linenumber);
+create index idx_LineID_suppkey on LineID(l_suppkey);
+
+insert into dataset LineID (
+for $l in dataset('LineItem')
+ where $l.l_orderkey<10
+ return {
+ "l_orderkey": $l.l_orderkey,
+ "l_partkey": $l.l_linenumber,
+ "l_suppkey": $l.l_partkey
+ }
+);
+
+write output to nc1:"rttest/dml_insert-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.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert.aql
new file mode 100644
index 0000000..2123aa8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert.aql
@@ -0,0 +1,62 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+ l_orderkey: int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: double,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string
+}
+
+create type LineIDType as closed {
+ l_orderkey: int32,
+ l_linenumber: int32,
+ l_suppkey: int32
+}
+
+create nodegroup group1 if not exists on nc1;
+
+create dataset LineItem(LineItemType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+create dataset LineID(LineIDType)
+ partitioned by key l_orderkey, l_linenumber on group1;
+
+load dataset LineItem
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+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 (
+for $l in dataset('LineItem')
+ where $l.l_orderkey<10
+ return {
+ "l_orderkey": $l.l_orderkey,
+ "l_partkey": $l.l_linenumber,
+ "l_suppkey": $l.l_partkey
+ }
+);
+
+write output to nc1:"rttest/dml_insert.adm";
+for $c in dataset('LineID')
+order by $c.l_orderkey, $c.l_linenumber
+return $c
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/insert_less_nc.aql b/asterix-app/src/test/resources/runtimets/queries/dml/insert_less_nc.aql
new file mode 100644
index 0000000..80cb4f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/insert_less_nc.aql
@@ -0,0 +1,62 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+ l_orderkey: int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: double,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string
+}
+
+create type LineIDType as closed {
+ l_orderkey: int32,
+ l_linenumber: int32,
+ l_suppkey: int32
+}
+
+create nodegroup group1nc2 if not exists on nc2;
+
+create dataset LineItem(LineItemType)
+ partitioned by key l_orderkey, l_linenumber on group1nc2;
+
+create dataset LineID(LineIDType)
+ partitioned by key l_orderkey, l_linenumber on group1nc2;
+
+load dataset LineItem
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+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 (
+for $l in dataset('LineItem')
+ where $l.l_orderkey<1000
+ return {
+ "l_orderkey": $l.l_orderkey,
+ "l_partkey": $l.l_linenumber,
+ "l_suppkey": $l.l_partkey
+ }
+);
+
+write output to nc1:"rttest/dml_insert_less_nc.adm";
+for $c in dataset('LineID')
+order by $c.l_orderkey, $c.l_linenumber
+return $c
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql
new file mode 100644
index 0000000..bb2f934
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql
@@ -0,0 +1,34 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+ id: int32,
+ point: point,
+ kwds: string,
+ line1: line,
+ line2: line,
+ poly1: polygon,
+ poly2: polygon,
+ rec: rectangle
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset MyData(MyRecord)
+ partitioned by key id on group1;
+
+load dataset MyData
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point on MyData(point) type rtree;
+
+delete $m from dataset MyData where $m.id>10;
+
+write output to nc1:"rttest/dml_scan-delete-rtree-secondary-index.adm";
+
+for $o in dataset('MyData')
+where spatial-intersect($o.point, create-polygon(create-point(0.0,1.0), create-point(0.0,4.0), create-point(12.0,4.0), create-point(12.0,1.0)))
+order by $o.id
+return {"id":$o.id}
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql
new file mode 100644
index 0000000..fe9c017
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql
@@ -0,0 +1,55 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+ id: int32,
+ point: point,
+ kwds: string,
+ line1: line,
+ line2: line,
+ poly1: polygon,
+ poly2: polygon,
+ rec: rectangle
+}
+
+create type MyMiniRecord as closed {
+ id: int32,
+ point: point
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset MyData(MyRecord)
+ partitioned by key id on group1;
+
+load dataset MyData
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+
+create dataset MyMiniData(MyMiniRecord)
+ partitioned by key id on group1;
+
+load dataset MyMiniData
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point_0 on MyData(point) type rtree;
+create index rtree_index_point on MyMiniData(point) type rtree;
+
+insert into dataset MyMiniData
+(
+ for $m in dataset('MyData')
+ return {
+ "id": $m.id,
+ "point": $m.point
+ }
+);
+
+write output to nc1:"rttest/dml_scan-insert-rtree-secondary-index.adm";
+
+for $o in dataset('MyMiniData')
+where spatial-intersect($o.point, create-polygon(create-point(0.0,1.0), create-point(0.0,4.0), create-point(12.0,4.0), create-point(12.0,1.0)))
+order by $o.id
+return {"id":$o.id}