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/demo_aql/local/01-load-cust.aql b/asterix-app/src/test/resources/demo_aql/local/01-load-cust.aql
new file mode 100644
index 0000000..cd7a682
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/01-load-cust.aql
@@ -0,0 +1,26 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+
+load dataset Customers
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1:///tmp/customer.adm"),("format"="adm")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/demo_aql/local/02-filter-cust.aql b/asterix-app/src/test/resources/demo_aql/local/02-filter-cust.aql
new file mode 100644
index 0000000..38171ed
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/02-filter-cust.aql
@@ -0,0 +1,27 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+
+write output to nc1:"/tmp/02-filter-cust.adm";
+
+for $c in dataset('Customers')
+where $c.age < 21
+return { "custname":$c.name, "custage": $c.age }
diff --git a/asterix-app/src/test/resources/demo_aql/local/03-count-cust-age.aql b/asterix-app/src/test/resources/demo_aql/local/03-count-cust-age.aql
new file mode 100644
index 0000000..37698a7
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/03-count-cust-age.aql
@@ -0,0 +1,29 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+
+write output to nc1:"/tmp/03-count-cust-age.adm";
+
+count(
+for $c in dataset('Customers')
+where not(is-null($c.age))
+return $c
+)
diff --git a/asterix-app/src/test/resources/demo_aql/local/04-load-ord.aql b/asterix-app/src/test/resources/demo_aql/local/04-load-ord.aql
new file mode 100644
index 0000000..b8898f5
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/04-load-ord.aql
@@ -0,0 +1,19 @@
+use dataverse demo_aql;
+
+declare type OrderType as open {
+ oid: int32,
+ cid: int32,
+ orderstatus: string,
+ orderpriority: string,
+ clerk: string,
+ total: float
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset Orders(OrderType)
+ partitioned by key oid on group1;
+
+load dataset Orders
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1:///tmp/orders.adm"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/demo_aql/local/05-count-param1.aql b/asterix-app/src/test/resources/demo_aql/local/05-count-param1.aql
new file mode 100644
index 0000000..02263c4
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/05-count-param1.aql
@@ -0,0 +1,23 @@
+use dataverse demo_aql;
+
+declare type OrderType as open {
+ oid: int32,
+ cid: int32,
+ orderstatus: string,
+ orderpriority: string,
+ clerk: string,
+ total: float
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset Orders(OrderType)
+ partitioned by key oid on group1;
+
+write output to nc1:"/tmp/05-count-param1.adm";
+
+count(
+for $o in dataset('Orders')
+where not(is-null($o.param1))
+return $o
+)
diff --git a/asterix-app/src/test/resources/demo_aql/local/06-count-custord.aql b/asterix-app/src/test/resources/demo_aql/local/06-count-custord.aql
new file mode 100644
index 0000000..86e6ea0
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/06-count-custord.aql
@@ -0,0 +1,41 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+
+declare type OrderType as open {
+ oid: int32,
+ cid: int32,
+ orderstatus: string,
+ orderpriority: string,
+ clerk: string,
+ total: float
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+declare dataset Orders(OrderType)
+ partitioned by key oid on group1;
+
+write output to nc1:"/tmp/06-count-custord.adm";
+
+for $c in dataset('Customers')
+for $o in dataset('Orders')
+where $c.cid = $o.cid and $o.total > 70
+group by $age := $c.age with $o
+return {"custage": $age, "count-orders":count($o)}
diff --git a/asterix-app/src/test/resources/demo_aql/local/101-load-dblp.aql b/asterix-app/src/test/resources/demo_aql/local/101-load-dblp.aql
new file mode 100644
index 0000000..7d6dc62
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/101-load-dblp.aql
@@ -0,0 +1,18 @@
+use dataverse demo_aql;
+
+declare type DBLPType as open {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset DBLP(DBLPType)
+ partitioned by key id on group1;
+
+load dataset DBLP
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1:///tmp/dblp-id.txt"),("format"="delimited-text"),("delimiter"=":"));
diff --git a/asterix-app/src/test/resources/demo_aql/local/102-fuzzy-select.aql b/asterix-app/src/test/resources/demo_aql/local/102-fuzzy-select.aql
new file mode 100644
index 0000000..e37b49a
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/102-fuzzy-select.aql
@@ -0,0 +1,22 @@
+use dataverse demo_aql;
+
+declare type DBLPType as open {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset DBLP(DBLPType)
+ partitioned by key id on group1;
+
+write output to nc1:"/tmp/102-fuzzy-select.adm";
+
+for $x in dataset('DBLP')
+let $ed := edit-distance($x.authors, "Michael Carey")
+where $ed <= 3
+order by $ed, $x.authors
+return { "edit-distance":$ed, "authors":$x.authors, "title":$x.title }
diff --git a/asterix-app/src/test/resources/demo_aql/local/110-self-join-dblp.aql b/asterix-app/src/test/resources/demo_aql/local/110-self-join-dblp.aql
new file mode 100644
index 0000000..f51e455
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/local/110-self-join-dblp.aql
@@ -0,0 +1,28 @@
+use dataverse demo_aql;
+
+declare type DBLPType as open {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+declare nodegroup group1 on nc1, nc2;
+
+declare dataset DBLP(DBLPType)
+ partitioned by key id on group1;
+
+write output to nc1:"/tmp/110-self-join-dblp.adm";
+
+set simthreshold '.5f';
+
+for $k in (
+ for $i in dataset('DBLP')
+ for $j in dataset('DBLP')
+ where $i.title ~= $j.title
+ order by $i.id, $j.id
+ return {'dblp1': $i, 'dblp2': $j}
+)
+where $k.dblp1.id < $k.dblp2.id
+return $k
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/01-load-cust.aql b/asterix-app/src/test/resources/demo_aql/rainbow/01-load-cust.aql
new file mode 100644
index 0000000..e75bce2
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/01-load-cust.aql
@@ -0,0 +1,24 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+
+load dataset Customers from rainbow-01:"/home/onose/demo-data/semistructured/customer.adm";
+
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/02-filter-cust.aql b/asterix-app/src/test/resources/demo_aql/rainbow/02-filter-cust.aql
new file mode 100644
index 0000000..8af2368
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/02-filter-cust.aql
@@ -0,0 +1,27 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+
+write output to rainbow-01:"/home/onose/hyracks-rainbow/results/02-filter-cust.adm";
+
+for $c in dataset('Customers')
+where $c.age < 21
+return { "custname":$c.name, "custage": $c.age }
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/03-count-cust-age.aql b/asterix-app/src/test/resources/demo_aql/rainbow/03-count-cust-age.aql
new file mode 100644
index 0000000..eda4015
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/03-count-cust-age.aql
@@ -0,0 +1,29 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+
+write output to rainbow-01:"/home/onose/hyracks-rainbow/results/03-count-cust-age.adm";
+
+count(
+for $c in dataset('Customers')
+where not(is-null($c.age))
+return $c
+)
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/04-load-ord.aql b/asterix-app/src/test/resources/demo_aql/rainbow/04-load-ord.aql
new file mode 100644
index 0000000..bae97e8
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/04-load-ord.aql
@@ -0,0 +1,17 @@
+use dataverse demo_aql;
+
+declare type OrderType as open {
+ oid: int32,
+ cid: int32,
+ orderstatus: string,
+ orderpriority: string,
+ clerk: string,
+ total: float
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset Orders(OrderType)
+ partitioned by key oid on group1;
+
+load dataset Orders from rainbow-01:"/home/onose/demo-data/semistructured/orders.adm";
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/05-count-param1.aql b/asterix-app/src/test/resources/demo_aql/rainbow/05-count-param1.aql
new file mode 100644
index 0000000..f5ec449
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/05-count-param1.aql
@@ -0,0 +1,23 @@
+use dataverse demo_aql;
+
+declare type OrderType as open {
+ oid: int32,
+ cid: int32,
+ orderstatus: string,
+ orderpriority: string,
+ clerk: string,
+ total: float
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset Orders(OrderType)
+ partitioned by key oid on group1;
+
+write output to rainbow-01:"/home/onose/hyracks-rainbow/results/05-count-param1.adm";
+
+count(
+for $o in dataset('Orders')
+where not(is-null($o.param1))
+return $o
+)
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/06-count-custord.aql b/asterix-app/src/test/resources/demo_aql/rainbow/06-count-custord.aql
new file mode 100644
index 0000000..ba5d5f4
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/06-count-custord.aql
@@ -0,0 +1,43 @@
+use dataverse demo_aql;
+
+declare type CustomerType as open {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ interests: {{string}},
+ children: [ { name: string, age: int32? } ]
+}
+
+declare type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+
+declare type OrderType as open {
+ oid: int32,
+ cid: int32,
+ orderstatus: string,
+ orderpriority: string,
+ clerk: string,
+ total: float
+}
+
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset Customers(CustomerType)
+ partitioned by key cid on group1;
+declare dataset Orders(OrderType)
+ partitioned by key oid on group1;
+
+write output to rainbow-01:"/home/onose/hyracks-rainbow/results/06-count-custord.adm";
+
+for $c in dataset('Customers')
+for $o in dataset('Orders')
+where $c.cid = $o.cid and $o.total > 70
+group by $age := $c.age with $o
+return {"custage": $age, "count-orders":count($o)}
+
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/101-load-dblp.aql b/asterix-app/src/test/resources/demo_aql/rainbow/101-load-dblp.aql
new file mode 100644
index 0000000..20f0b51
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/101-load-dblp.aql
@@ -0,0 +1,18 @@
+use dataverse demo_aql;
+
+declare type DBLPType as open {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset DBLP(DBLPType)
+ partitioned by key id on group1;
+
+load dataset DBLP from
+ rainbow-01:"/home/onose/demo-data/dblp-id.txt" delimited by ":";
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/102-fuzzy-select.aql b/asterix-app/src/test/resources/demo_aql/rainbow/102-fuzzy-select.aql
new file mode 100644
index 0000000..c9f072a
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/102-fuzzy-select.aql
@@ -0,0 +1,22 @@
+use dataverse demo_aql;
+
+declare type DBLPType as open {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset DBLP(DBLPType)
+ partitioned by key id on group1;
+
+write output to rainbow-01:"/home/onose/hyracks-rainbow/results/102-fuzzy-select.adm";
+
+for $x in dataset('DBLP')
+let $ed := edit-distance($x.authors, "Michael Carey")
+where $ed <= 3
+order by $ed, $x.authors
+return { "edit-distance":$ed, "authors":$x.authors, "title":$x.title }
diff --git a/asterix-app/src/test/resources/demo_aql/rainbow/110-self-join-dblp.aql b/asterix-app/src/test/resources/demo_aql/rainbow/110-self-join-dblp.aql
new file mode 100644
index 0000000..c5b900b
--- /dev/null
+++ b/asterix-app/src/test/resources/demo_aql/rainbow/110-self-join-dblp.aql
@@ -0,0 +1,28 @@
+use dataverse demo_aql;
+
+declare type DBLPType as open {
+ id: int32,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+declare nodegroup group1 on rainbow-01, rainbow-02, rainbow-03, rainbow-04, rainbow-05;
+
+declare dataset DBLP(DBLPType)
+ partitioned by key id on group1;
+
+write output to rainbow-01:"/home/onose/hyracks-rainbow/results/110-self-join-dblp.adm";
+
+set simthreshold '.8f';
+
+for $k in (
+ for $i in dataset('DBLP')
+ for $j in dataset('DBLP')
+ where $i.title ~= $j.title
+ order by $i.id, $j.id
+ return {'dblp1': $i, 'dblp2': $j}
+)
+where $k.dblp1.id < $k.dblp2.id
+return $k