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/failure/delete-rtree.aql b/asterix-app/src/test/resources/runtimets/queries/failure/delete-rtree.aql
new file mode 100644
index 0000000..0ad2dde
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/failure/delete-rtree.aql
@@ -0,0 +1,31 @@
+drop dataverse test if exists;
+  
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+	id: int32,
+	tweetid: int64,
+	loc: point,
+	time: datetime,
+	text: string
+}
+
+
+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/twitter/smalltweets.txt"),("format"="adm")) pre-sorted;
+
+
+delete $l from dataset MyData where $l.id>=50 die after 1500;
+
+write output to nc1:"rttest/failure_delete-rtree.adm";      
+
+for $o in dataset('MyData')
+order by $o.id
+return {"id":$o.id}
diff --git a/asterix-app/src/test/resources/runtimets/queries/failure/delete.aql b/asterix-app/src/test/resources/runtimets/queries/failure/delete.aql
new file mode 100644
index 0000000..cb51030
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/failure/delete.aql
@@ -0,0 +1,41 @@
+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 die after 1500;
+
+write output to nc1:"rttest/failure_delete.adm";      
+for $c in dataset('LineItem')
+where $c.l_orderkey>=10
+order by $c.l_orderkey, $c.l_linenumber
+return $c 
diff --git a/asterix-app/src/test/resources/runtimets/queries/failure/insert-rtree.aql b/asterix-app/src/test/resources/runtimets/queries/failure/insert-rtree.aql
new file mode 100644
index 0000000..ca4e910
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/failure/insert-rtree.aql
@@ -0,0 +1,65 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+	id: int32,
+	tweetid: int64,
+	loc: point,
+	time: datetime,
+	text: string
+}
+
+create type MyMiniRecord as closed {
+  id: int32,
+  loc: 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/twitter/smalltweets.txt"),("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_loc_0 on MyData(loc) type rtree;
+create index rtree_index_loc on MyMiniData(loc) type rtree;
+
+insert into dataset MyMiniData
+(
+	for $m in dataset('MyData')
+	where $m.id<1000
+	return {
+		"id": $m.id,
+		"loc": $m.loc
+	}
+);
+
+insert into dataset MyMiniData
+(
+	for $m in dataset('MyData')
+	where $m.id>=1000
+	die after 1000
+	return {
+		"id": $m.id,
+		"loc": $m.loc
+	}
+);
+
+write output to nc1:"rttest/failure_insert-rtree.adm";
+
+for $o in dataset('MyMiniData')
+order by $o.id
+return {"id":$o.id}
diff --git a/asterix-app/src/test/resources/runtimets/queries/failure/insert.aql b/asterix-app/src/test/resources/runtimets/queries/failure/insert.aql
new file mode 100644
index 0000000..570f4bc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/failure/insert.aql
@@ -0,0 +1,72 @@
+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;
+
+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
+	}
+);
+
+insert into dataset LineID (
+for $l in dataset('LineItem')
+	where $l.l_orderkey>=1000
+	die after 1000
+	return {
+		"l_orderkey": $l.l_orderkey,
+		"l_partkey": $l.l_linenumber,
+		"l_suppkey": $l.l_partkey
+	}
+);
+
+write output to nc1:"rttest/failure_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/failure/q1_pricing_summary_report_failure.aql b/asterix-app/src/test/resources/runtimets/queries/failure/q1_pricing_summary_report_failure.aql
new file mode 100644
index 0000000..def6e9a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/failure/q1_pricing_summary_report_failure.aql
@@ -0,0 +1,55 @@
+drop dataverse tpch if exists;
+create dataverse tpch;
+  
+
+use dataverse tpch;
+
+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 nodegroup group1  if not exists on nc1;
+
+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;
+
+
+write output to nc1:"rttest/failure_q1_pricing_summary_report_failure.adm";
+ 
+for $l in dataset('LineItem')
+//where inject-failure($l.l_shipdate <= '1998-09-02', $l.l_orderkey=5999)
+/*+ hash*/
+group by $l_returnflag := $l.l_returnflag, $l_linestatus := $l.l_linestatus  
+  with $l
+order by $l_returnflag, $l_linestatus
+return {
+  "l_returnflag": $l_returnflag,
+  "l_linestatus": $l_linestatus,
+  "sum_qty": sum(for $i in $l return $i.l_quantity),
+  "sum_base_price": sum(for $i in $l return $i.l_extendedprice),
+  "sum_disc_price": sum(for $i in $l return $i.l_extendedprice * (1 - $i.l_discount)),
+  "sum_charge": sum(for $i in $l return $i.l_extendedprice * (1 - $i.l_discount) * (1 + $i.l_tax)),
+  "ave_qty": avg(for $i in $l return $i.l_quantity),  
+  "ave_price": avg(for $i in $l return $i.l_extendedprice),
+  "ave_disc": avg(for $i in $l return $i.l_discount),
+  "count_order": count($l)
+}