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/old-optimizerts/queries/aggreg-test01.aql b/asterix-app/src/test/resources/old-optimizerts/queries/aggreg-test01.aql
new file mode 100644
index 0000000..6a484df
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/aggreg-test01.aql
@@ -0,0 +1,7 @@
+// count, sum, avg
+for $o in recordset(['oid', 'int32', 'date', 'int32', 'cid', 'int32', 'total', 'float'], 'osfiles', ['nc1', 'data/spj01/ord1.adm'], ['nc2', 'data/spj01/ord2.adm'])
+group by $cid := $o.cid with $o
+return { "cid": $cid , "ordpercust": count($o),  
+         "totalcust": sum(for $i in $o return $i.total), 
+         "avgcust": avg(for $i in $o return $i.total) } 
+ 
diff --git a/asterix-app/src/test/resources/old-optimizerts/queries/j-cust-subplan.aql b/asterix-app/src/test/resources/old-optimizerts/queries/j-cust-subplan.aql
new file mode 100644
index 0000000..caa6e28
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/j-cust-subplan.aql
@@ -0,0 +1,4 @@
+for $c in recordset(['cid', 'int32', 'name', 'string', 'age', 'int32'], 'osfiles', ['nc1', 'data/spj01/cust1.adm'], ['nc2', 'data/spj01/cust2.adm'])
+where some $c2 in [ $c ]
+      satisfies substring($c2.name, 1, 1) = "J"
+return $c
diff --git a/asterix-app/src/test/resources/old-optimizerts/queries/redundant-orderby.aql b/asterix-app/src/test/resources/old-optimizerts/queries/redundant-orderby.aql
new file mode 100644
index 0000000..e993025
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/redundant-orderby.aql
@@ -0,0 +1,6 @@
+for $x in dataset('A')
+order by $x.a
+order by $x.a
+order by $x.b
+order by $x.b
+return $x
diff --git a/asterix-app/src/test/resources/old-optimizerts/queries/spj01-limit01.aql b/asterix-app/src/test/resources/old-optimizerts/queries/spj01-limit01.aql
new file mode 100644
index 0000000..e3c680e
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/spj01-limit01.aql
@@ -0,0 +1,9 @@
+declare function samecust($cust, $ord)
+{$cust.cid = $ord.cid}
+
+for $c in recordset(['cid', 'int32', 'name', 'string', 'age', 'int32'], 'osfiles', ['nc1', 'data/spj01/cust1.adm'], ['nc2', 'data/spj01/cust2.adm'])
+for $o in recordset(['oid', 'int32', 'date', 'int32', 'cid', 'int32', 'total', 'float'], 'osfiles', ['nc1', 'data/spj01/ord1.adm'], ['nc2', 'data/spj01/ord2.adm'])
+where samecust($c, $o)
+limit 2 
+return { "custname":$c.name, "orddate":$o.date } 
+
diff --git a/asterix-app/src/test/resources/old-optimizerts/queries/spj01-recordset.aql b/asterix-app/src/test/resources/old-optimizerts/queries/spj01-recordset.aql
new file mode 100644
index 0000000..731a042
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/spj01-recordset.aql
@@ -0,0 +1,8 @@
+declare function samecust($cust, $ord)
+{$cust.cid = $ord.cid}
+
+for $c in recordset(['cid', 'int32', 'name', 'string', 'age', 'int32'], 'osfiles', ['nc1', 'data/spj01/cust1.adm'], ['nc2', 'data/spj01/cust2.adm'])
+for $o in recordset(['oid', 'int32', 'date', 'int32', 'cid', 'int32', 'total', 'float'], 'osfiles', ['nc1', 'data/spj01/ord1.adm'], ['nc2', 'data/spj01/ord2.adm'])
+where samecust($c, $o)
+ and $c.age < 21 and $o.total > 1000.00
+return { "custname":$c.name, "orddate":$o.date } 
diff --git a/asterix-app/src/test/resources/old-optimizerts/queries/spj01-somesat.aql b/asterix-app/src/test/resources/old-optimizerts/queries/spj01-somesat.aql
new file mode 100644
index 0000000..de681f7
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/spj01-somesat.aql
@@ -0,0 +1,4 @@
+for $c in recordset(['cid', 'int32', 'name', 'string', 'age', 'int32'], 'osfiles', ['nc1', 'data/spj01/cust1.adm'], ['nc2', 'data/spj01/cust2.adm'])
+where some $c2 in recordset(['cid', 'int32', 'name', 'string', 'age', 'int32'], 'osfiles', ['nc1', 'data/spj01/cust1.adm'], ['nc2', 'data/spj01/cust2.adm'])
+      satisfies $c2.age > $c.age
+return $c
diff --git a/asterix-app/src/test/resources/old-optimizerts/queries/spj01.aql b/asterix-app/src/test/resources/old-optimizerts/queries/spj01.aql
new file mode 100644
index 0000000..28fd2c8
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/queries/spj01.aql
@@ -0,0 +1,8 @@
+declare function samecust($cust, $ord)
+{$cust.cid = $ord.cid}
+
+for $c in dataset('Customers')
+for $o in dataset('Orders')
+where samecust($c, $o)
+ and $c.age < 21 and $o.total > 1000.00
+return { "custname":$c.name, "orddate":$o.date } 
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/aggreg-test01.plan b/asterix-app/src/test/resources/old-optimizerts/results/aggreg-test01.plan
new file mode 100644
index 0000000..e62f6f3
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/aggreg-test01.plan
@@ -0,0 +1,17 @@
+-- SINK_WRITE  |PARTITIONED|
+  -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- ASSIGN  |PARTITIONED|
+        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+          -- PRE_SORTED_GROUP_BY[$$21]  |PARTITIONED|
+                  {
+                    -- AGGREGATE  |LOCAL|
+                      -- NESTED_TUPLE_SOURCE  |LOCAL|
+                  }
+            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+              -- STABLE_SORT [$$21(ASCENDING)]  |PARTITIONED|
+                -- HASH_PARTITION_EXCHANGE [$$21]  |PARTITIONED|
+                  -- ASSIGN  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- AQL_DATASET_UNNEST  |PARTITIONED|
+                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/j-cust-subplan.plan b/asterix-app/src/test/resources/old-optimizerts/results/j-cust-subplan.plan
new file mode 100644
index 0000000..9f2d856
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/j-cust-subplan.plan
@@ -0,0 +1,16 @@
+-- SINK_WRITE  |PARTITIONED|
+  -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- STREAM_SELECT  |PARTITIONED|
+        -- SUBPLAN  |PARTITIONED|
+                {
+                  -- AGGREGATE  |UNPARTITIONED|
+                    -- STREAM_SELECT  |UNPARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
+                        -- ASSIGN  |UNPARTITIONED|
+                          -- ASSIGN  |UNPARTITIONED|
+                            -- UNNEST  |UNPARTITIONED|
+                              -- NESTED_TUPLE_SOURCE  |LOCAL|
+                }
+          -- AQL_DATASET_UNNEST  |PARTITIONED|
+            -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/redundant-orderby.plan b/asterix-app/src/test/resources/old-optimizerts/results/redundant-orderby.plan
new file mode 100644
index 0000000..1674a32
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/redundant-orderby.plan
@@ -0,0 +1,18 @@
+-- SINK_WRITE  |PARTITIONED|
+  -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- STABLE_SORT [$$8(ASCENDING)]  |PARTITIONED|
+          -- RANGE_PARTITION_EXCHANGE [$$8(ASCENDING)]  |PARTITIONED|
+            -- STREAM_PROJECT  |PARTITIONED|
+              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                -- STABLE_SORT [$$6(ASCENDING)]  |PARTITIONED|
+                  -- RANGE_PARTITION_EXCHANGE [$$6(ASCENDING)]  |PARTITIONED|
+                    -- STREAM_PROJECT  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
+                          -- ASSIGN  |PARTITIONED|
+                            -- ASSIGN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
+                                -- AQL_DATASET_UNNEST  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/spj01-limit01.plan b/asterix-app/src/test/resources/old-optimizerts/results/spj01-limit01.plan
new file mode 100644
index 0000000..9a84f93
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/spj01-limit01.plan
@@ -0,0 +1,20 @@
+-- SINK_WRITE  |UNPARTITIONED|
+  -- STREAM_PROJECT  |UNPARTITIONED|
+    -- ASSIGN  |UNPARTITIONED|
+      -- STREAM_LIMIT  |UNPARTITIONED|
+        -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+          -- STREAM_LIMIT  |PARTITIONED|
+            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+              -- IN_MEMORY_HASH_PAIRWISE_JOIN [$$18][$$19]  |PARTITIONED|
+                -- HASH_PARTITION_EXCHANGE [$$18]  |PARTITIONED|
+                  -- STREAM_PROJECT  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- AQL_DATASET_UNNEST  |PARTITIONED|
+                          -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                -- HASH_PARTITION_EXCHANGE [$$19]  |PARTITIONED|
+                  -- STREAM_PROJECT  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- AQL_DATASET_UNNEST  |PARTITIONED|
+                          -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/spj01-recordset.plan b/asterix-app/src/test/resources/old-optimizerts/results/spj01-recordset.plan
new file mode 100644
index 0000000..9910524
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/spj01-recordset.plan
@@ -0,0 +1,22 @@
+-- SINK_WRITE  |PARTITIONED|
+  -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- ASSIGN  |PARTITIONED|
+        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+          -- IN_MEMORY_HASH_PAIRWISE_JOIN [$$25][$$26]  |PARTITIONED|
+            -- HASH_PARTITION_EXCHANGE [$$25]  |PARTITIONED|
+              -- STREAM_PROJECT  |PARTITIONED|
+                -- STREAM_SELECT  |PARTITIONED|
+                  -- ASSIGN  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- AQL_DATASET_UNNEST  |PARTITIONED|
+                          -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+            -- HASH_PARTITION_EXCHANGE [$$26]  |PARTITIONED|
+              -- STREAM_PROJECT  |PARTITIONED|
+                -- STREAM_SELECT  |PARTITIONED|
+                  -- ASSIGN  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- AQL_DATASET_UNNEST  |PARTITIONED|
+                          -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/spj01-somesat.plan b/asterix-app/src/test/resources/old-optimizerts/results/spj01-somesat.plan
new file mode 100644
index 0000000..f96a70e
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/spj01-somesat.plan
@@ -0,0 +1,25 @@
+-- SINK_WRITE  |PARTITIONED|
+  -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- STREAM_SELECT  |PARTITIONED|
+        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+          -- PRE_SORTED_GROUP_BY[$$0]  |PARTITIONED|
+                  {
+                    -- AGGREGATE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
+                        -- NESTED_TUPLE_SOURCE  |LOCAL|
+                  }
+            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+              -- STABLE_SORT [$$0(ASCENDING)]  |PARTITIONED|
+                -- HASH_PARTITION_EXCHANGE [$$0]  |PARTITIONED|
+                  -- STREAM_PROJECT  |PARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                      -- NESTED_LOOP_BCAST_JOIN  |PARTITIONED|
+                        -- BROADCAST_EXCHANGE  |PARTITIONED|
+                          -- ASSIGN  |PARTITIONED|
+                            -- AQL_DATASET_UNNEST  |PARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                          -- ASSIGN  |PARTITIONED|
+                            -- AQL_DATASET_UNNEST  |PARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/old-optimizerts/results/spj01.plan b/asterix-app/src/test/resources/old-optimizerts/results/spj01.plan
new file mode 100644
index 0000000..b48a773
--- /dev/null
+++ b/asterix-app/src/test/resources/old-optimizerts/results/spj01.plan
@@ -0,0 +1,30 @@
+-- SINK_WRITE  |PARTITIONED|
+  -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- ASSIGN  |PARTITIONED|
+        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+          -- IN_MEMORY_HASH_PAIRWISE_JOIN [$$19][$$20]  |PARTITIONED|
+            -- HASH_PARTITION_EXCHANGE [$$19]  |PARTITIONED|
+              -- STREAM_PROJECT  |PARTITIONED|
+                -- STREAM_SELECT  |PARTITIONED|
+                  -- ASSIGN  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
+                          -- ASSIGN  |PARTITIONED|
+                            -- ASSIGN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
+                                -- AQL_DATASET_UNNEST  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+            -- HASH_PARTITION_EXCHANGE [$$20]  |PARTITIONED|
+              -- STREAM_PROJECT  |PARTITIONED|
+                -- STREAM_SELECT  |PARTITIONED|
+                  -- ASSIGN  |PARTITIONED|
+                    -- ASSIGN  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
+                          -- ASSIGN  |PARTITIONED|
+                            -- ASSIGN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
+                                -- AQL_DATASET_UNNEST  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|