asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [17/58] [abbrv] [partial] incubator-asterixdb git commit: Added support of typed indexes over open fields & indexes over nested fields
Date Fri, 24 Apr 2015 18:42:43 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql
new file mode 100644
index 0000000..3f2d1d5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index rtree_index_point on MyData(nested.point) type rtree;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.query.aql
new file mode 100644
index 0000000..c722ea2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.nested.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+order by $o.nested.id
+return {"id":$o.nested.id}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql
new file mode 100644
index 0000000..3a29680
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql
@@ -0,0 +1,24 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecordtmp as open {
+  id: int64,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle
+}
+
+create type MyRecord as open {
+nested : MyRecordtmp
+}
+
+create dataset MyDatatmp(MyRecordtmp)
+  primary key id;
+
+create dataset MyData(MyRecord)
+  primary key nested.id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.2.update.aql
new file mode 100644
index 0000000..c307631
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.2.update.aql
@@ -0,0 +1,13 @@
+use dataverse test;
+
+load dataset MyDatatmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
+
+insert into dataset MyData
+(
+	for $c in dataset('MyDatatmp')
+	return {
+		"nested" : $c
+	}	
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql
new file mode 100644
index 0000000..3f2d1d5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index rtree_index_point on MyData(nested.point) type rtree;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.query.aql
new file mode 100644
index 0000000..c722ea2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.nested.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+order by $o.nested.id
+return {"id":$o.nested.id}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
new file mode 100644
index 0000000..249b569
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
@@ -0,0 +1,25 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecordtmp as closed {
+  id: int64,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+create type MyRecord as closed {
+nested : MyRecordtmp
+}
+
+
+create dataset MyDatatmp(MyRecordtmp)
+  primary key id;
+
+create dataset MyData(MyRecord)
+  primary key nested.id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql
new file mode 100644
index 0000000..c307631
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql
@@ -0,0 +1,13 @@
+use dataverse test;
+
+load dataset MyDatatmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
+
+insert into dataset MyData
+(
+	for $c in dataset('MyDatatmp')
+	return {
+		"nested" : $c
+	}	
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
new file mode 100644
index 0000000..3f2d1d5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index rtree_index_point on MyData(nested.point) type rtree;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql
new file mode 100644
index 0000000..c722ea2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.nested.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+order by $o.nested.id
+return {"id":$o.nested.id}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.1.ddl.aql
new file mode 100644
index 0000000..c96c58f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.1.ddl.aql
@@ -0,0 +1,32 @@
+/*
+* Description  : Create an external dataset that contains records stored with text hdfs file format.
+                 Build an index over the external dataset age attribute
+                 Perform a query over the dataset using the index.
+* Expected Res : Success
+* Date         : 3rd Jan 2014
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type MyRecordNested as open {
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create type MyRecord as closed {
+  nested: MyRecordNested
+}
+
+create external dataset MyData(MyRecord)
+using hdfs
+(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/spatialDataNested.json"),("input-format"="text-input-format"),("input-format"="text-input-format"),("format"="adm"));
+
+create index idx on MyData(nested.id:int32) enforced;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.2.update.aql
new file mode 100644
index 0000000..4fb3db0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.2.update.aql
@@ -0,0 +1,7 @@
+/*
+* Description  : Create an external dataset that contains records stored with text hdfs file format.
+                 Build an index over the external dataset age attribute
+                 Perform a query over the dataset using the index.
+* Expected Res : Success
+* Date         : 3rd Jan 2014
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.3.query.aql
new file mode 100644
index 0000000..7402859
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/adm-format/adm-format.3.query.aql
@@ -0,0 +1,22 @@
+/*
+* Description  : Create an external dataset that contains records stored with text hdfs file format.
+                 Build an index over the external dataset age attribute
+                 Perform a query over the dataset using the index.
+* Expected Res : Success
+* Date         : 3rd Jan 2014
+*/
+use dataverse test;
+
+for $d in dataset MyData
+where $d.nested.id = 10
+return {
+  "id": $d.nested.id,
+  "point": $d.nested.point,
+  "kwds": $d.nested.kwds,
+  "line1": $d.nested.line1,
+  "line2": $d.nested.line2,
+  "poly1": $d.nested.poly1,
+  "poly2": $d.nested.poly2,
+  "rec": $d.nested.rec,
+  "circle": $d.nested.circle
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql
new file mode 100644
index 0000000..03bdc79
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql
@@ -0,0 +1,38 @@
+/*
+ * Description  : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue        : 730, 741                 
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TwitterUserType as closed {
+	screen-name: string,
+	lang: string,
+	friends-count: int64,
+	statuses-count: int64,
+	name: string,
+	followers-count: int64
+} 
+
+create type TweetMessageNestedType as open {
+        user: TwitterUserType,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string
+}
+
+create type TweetMessageType as closed {
+  nested: TweetMessageNestedType
+}
+
+create external dataset TweetMessages(TweetMessageType) using hdfs(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/tw_for_indexleftouterjoin_nested.adm"),("input-format"="text-input-format"),("format"="adm"));
+
+create index IdIx on TweetMessages(nested.tweetid:int64) type btree enforced;
+create index msgCountAIx on TweetMessages(nested.countA:int64) type btree enforced;
+create index msgCountBIx on TweetMessages(nested.countB:int64) type btree enforced;
+create index twmSndLocIx on TweetMessages(nested.sender-location:point) type rtree enforced;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.2.update.aql
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql
new file mode 100644
index 0000000..58d0268
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql
@@ -0,0 +1,21 @@
+/*
+ * Description  : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue        : 730, 741                 
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
+
+use dataverse test;
+
+for $t1 in dataset('TweetMessages')
+let $n :=  create-circle($t1.nested.sender-location, 0.5)
+where $t1.nested.tweetid < int64("10")
+order by $t1.nested.tweetid
+return {
+"tweetid1": $t1.nested.tweetid,
+"loc1":$t1.nested.sender-location,
+"nearby-message": for $t2 in dataset('TweetMessages')
+                             where spatial-intersect($t2.nested.sender-location, $n)
+                             order by $t2.nested.tweetid
+                             return {"tweetid2":$t2.nested.tweetid, "loc2":$t2.nested.sender-location}
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql
new file mode 100644
index 0000000..8e5ac27
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql
@@ -0,0 +1,37 @@
+/*
+ * Description  : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue        : 730, 741                 
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TwitterUserType as closed {
+	screen-name: string,
+	lang: string,
+	friends-count: int64,
+	statuses-count: int64,
+	name: string,
+	followers-count: int64
+} 
+
+create type TweetMessageNestedType as open {
+        user: TwitterUserType,
+        sender-location: point,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string
+}
+
+create type TweetMessageType as closed {
+  nested: TweetMessageNestedType
+}
+
+create external dataset TweetMessages(TweetMessageType) using hdfs(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/tw_for_indexleftouterjoin_nested.adm"),("input-format"="text-input-format"),("format"="adm"));
+
+create index IdIx on TweetMessages(nested.tweetid:int64) type btree enforced;
+create index msgCountAIx on TweetMessages(nested.countA:int64) type btree enforced;
+create index msgCountBIx on TweetMessages(nested.countB:int64) type btree enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.2.update.aql
new file mode 100644
index 0000000..16cbac3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue        : 730, 741                 
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.query.aql
new file mode 100644
index 0000000..6fabcbd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.query.aql
@@ -0,0 +1,14 @@
+use dataverse test;
+
+for $t1 in dataset('TweetMessages')
+where $t1.nested.tweetid < int64("10")
+order by $t1.nested.tweetid
+return {
+"tweetid1": $t1.nested.tweetid,
+"count1":$t1.nested.countA,
+"t2info": for $t2 in dataset('TweetMessages') 
+          where $t1.nested.countA /* +indexnl */= $t2.nested.countB
+          order by $t2.nested.tweetid
+          return {"tweetid2": $t2.nested.tweetid,
+                  "count2":$t2.nested.countB}
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.1.ddl.aql
new file mode 100644
index 0000000..1b3cb3d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.1.ddl.aql
@@ -0,0 +1,22 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecordNested as open {
+  id: int64,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create type MyRecord as closed {
+  nested: MyRecordNested
+}
+
+create external dataset MyData(MyRecord) using hdfs(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/spatialDataNested.json"),("input-format"="text-input-format"),("format"="adm"));
+
+create index rtree_index_point on MyData(nested.point:point) type rtree enforced;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.2.update.aql
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.3.query.aql
new file mode 100644
index 0000000..991c04c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/external-indexing/rtree-index/rtree-index.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.nested.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+order by $o.nested.id
+return {"id":$o.nested.id}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.1.ddl.aql
new file mode 100644
index 0000000..fc754bc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.1.ddl.aql
@@ -0,0 +1,107 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as closed{
+	id: int64,
+	Species: string
+}
+
+create type GS as closed{
+	id: int64,
+	Genus: string,
+	lower: S
+}
+
+create type FGS as open{
+	id: int64,
+	Family: string
+}
+
+create type OFGS as closed{
+	id: int64,
+	Order: string,
+	lower: FGS
+}
+
+create type COFGS as closed{
+	id: int64,
+	Class: string,
+	lower: OFGS
+}
+
+create type PCOFGS as closed{
+	id: int64,
+	Phylum: string,
+	lower: COFGS
+}
+
+create type KPCOFGS as open{
+	id: int64,
+	Kingdom: string
+}
+
+create type Classification as closed{
+	id: int64,
+	fullClassification:KPCOFGS
+}
+
+create type Animal as closed{
+	id: int64,
+	class:Classification
+}
+
+
+create dataset Animals(Animal)
+primary key id;
+
+create dataset Classifications(Classification)
+primary key id;
+
+create dataset KPCOFGSs(KPCOFGS)
+primary key id;
+
+create dataset Ss(S)
+primary key id;
+
+create dataset GSs(GS)
+primary key id;
+
+create dataset FGSs(FGS)
+primary key id;
+
+create dataset OFGSs(OFGS)
+primary key id;
+
+create dataset COFGSs(COFGS)
+primary key id;
+
+create dataset PCOFGSs(PCOFGS)
+primary key id;
+
+create index species on Ss(Species);
+
+create index genus on GSs(lower.Species);
+
+create index family on FGSs(lower.lower.Species:string) enforced;
+
+create index orda on OFGSs(lower.lower.lower.Species:string) enforced;
+
+create index classy on COFGSs(lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on PCOFGSs(lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on KPCOFGSs(lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index class on Classifications(fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index anim on Animals(class.fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.2.update.aql
new file mode 100644
index 0000000..fb39879
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.2.update.aql
@@ -0,0 +1,96 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+insert into dataset Ss(
+	{"id":1,"Species":"Gulo"}
+);
+insert into dataset Ss(
+	{"id":2,"Species":"Johnstoni"}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Gulo"
+	return {"id":1,"Genus":"Gulo","lower":$S}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Johnstoni"
+	return {"id":2,"Genus":"Okapia","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Gulo"
+	return {"id":1,"Family":"Mustelinae","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Johnstoni"
+	return {"id":2,"Family":"Giraffidae","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Gulo"
+	return {"id":1,"Order":"Carnivora","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Order":"Artiodactyla","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Class":"Mammalia","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Class":"Mammalia","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"fullClassification":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"fullClassification":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"class":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"class":$S}
+);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.query.aql
new file mode 100644
index 0000000..41a3261
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+for $test in dataset Animals
+where $test.class.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+return $test;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.1.ddl.aql
new file mode 100644
index 0000000..99cfdb4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.1.ddl.aql
@@ -0,0 +1,106 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as closed{
+	id: int64,
+	Species: string
+}
+
+create type GS as closed{
+	id: int64,
+	Genus: string,
+	lower: S
+}
+
+create type FGS as open{
+	id: int64,
+	Family: string
+}
+
+create type OFGS as closed{
+	id: int64,
+	Order: string,
+	lower: FGS
+}
+
+create type COFGS as closed{
+	id: int64,
+	Class: string,
+	lower: OFGS
+}
+
+create type PCOFGS as closed{
+	id: int64,
+	Phylum: string,
+	lower: COFGS
+}
+
+create type KPCOFGS as open{
+	id: int64,
+	Kingdom: string
+}
+
+create type Classification as closed{
+	id: int64,
+	fullClassification:KPCOFGS
+}
+
+create type Animal as open{
+	id: int64
+}
+
+
+create dataset Animals(Animal)
+primary key id;
+
+create dataset Classifications(Classification)
+primary key id;
+
+create dataset KPCOFGSs(KPCOFGS)
+primary key id;
+
+create dataset Ss(S)
+primary key id;
+
+create dataset GSs(GS)
+primary key id;
+
+create dataset FGSs(FGS)
+primary key id;
+
+create dataset OFGSs(OFGS)
+primary key id;
+
+create dataset COFGSs(COFGS)
+primary key id;
+
+create dataset PCOFGSs(PCOFGS)
+primary key id;
+
+create index species on Ss(Species);
+
+create index genus on GSs(lower.Species);
+
+create index family on FGSs(lower.lower.Species:string) enforced;
+
+create index orda on OFGSs(lower.lower.lower.Species:string) enforced;
+
+create index classy on COFGSs(lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on PCOFGSs(lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on KPCOFGSs(lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index class on Classifications(fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index anim on Animals(class.fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.2.update.aql
new file mode 100644
index 0000000..fb39879
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.2.update.aql
@@ -0,0 +1,96 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+insert into dataset Ss(
+	{"id":1,"Species":"Gulo"}
+);
+insert into dataset Ss(
+	{"id":2,"Species":"Johnstoni"}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Gulo"
+	return {"id":1,"Genus":"Gulo","lower":$S}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Johnstoni"
+	return {"id":2,"Genus":"Okapia","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Gulo"
+	return {"id":1,"Family":"Mustelinae","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Johnstoni"
+	return {"id":2,"Family":"Giraffidae","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Gulo"
+	return {"id":1,"Order":"Carnivora","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Order":"Artiodactyla","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Class":"Mammalia","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Class":"Mammalia","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"fullClassification":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"fullClassification":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"class":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"class":$S}
+);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.query.aql
new file mode 100644
index 0000000..41a3261
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+for $test in dataset Animals
+where $test.class.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+return $test;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.1.ddl.aql
new file mode 100644
index 0000000..ac45adf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.1.ddl.aql
@@ -0,0 +1,106 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as open{
+	id: int64
+}
+
+create type GS as closed{
+	id: int64,
+	Genus: string,
+	lower: S
+}
+
+create type FGS as open{
+	id: int64,
+	Family: string
+}
+
+create type OFGS as closed{
+	id: int64,
+	Order: string,
+	lower: FGS
+}
+
+create type COFGS as closed{
+	id: int64,
+	Class: string,
+	lower: OFGS
+}
+
+create type PCOFGS as closed{
+	id: int64,
+	Phylum: string,
+	lower: COFGS
+}
+
+create type KPCOFGS as open{
+	id: int64,
+	Kingdom: string
+}
+
+create type Classification as closed{
+	id: int64,
+	fullClassification:KPCOFGS
+}
+
+create type Animal as closed{
+	id: int64,
+	class:Classification
+}
+
+
+create dataset Animals(Animal)
+primary key id;
+
+create dataset Classifications(Classification)
+primary key id;
+
+create dataset KPCOFGSs(KPCOFGS)
+primary key id;
+
+create dataset Ss(S)
+primary key id;
+
+create dataset GSs(GS)
+primary key id;
+
+create dataset FGSs(FGS)
+primary key id;
+
+create dataset OFGSs(OFGS)
+primary key id;
+
+create dataset COFGSs(COFGS)
+primary key id;
+
+create dataset PCOFGSs(PCOFGS)
+primary key id;
+
+create index species on Ss(Species:string) enforced;
+
+create index genus on GSs(lower.Species:string) enforced;
+
+create index family on FGSs(lower.lower.Species:string) enforced;
+
+create index orda on OFGSs(lower.lower.lower.Species:string) enforced;
+
+create index classy on COFGSs(lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on PCOFGSs(lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on KPCOFGSs(lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index class on Classifications(fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index anim on Animals(class.fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.2.update.aql
new file mode 100644
index 0000000..fb39879
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.2.update.aql
@@ -0,0 +1,96 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+insert into dataset Ss(
+	{"id":1,"Species":"Gulo"}
+);
+insert into dataset Ss(
+	{"id":2,"Species":"Johnstoni"}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Gulo"
+	return {"id":1,"Genus":"Gulo","lower":$S}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Johnstoni"
+	return {"id":2,"Genus":"Okapia","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Gulo"
+	return {"id":1,"Family":"Mustelinae","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Johnstoni"
+	return {"id":2,"Family":"Giraffidae","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Gulo"
+	return {"id":1,"Order":"Carnivora","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Order":"Artiodactyla","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Class":"Mammalia","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Class":"Mammalia","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"fullClassification":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"fullClassification":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"class":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"class":$S}
+);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.query.aql
new file mode 100644
index 0000000..41a3261
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+for $test in dataset Animals
+where $test.class.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+return $test;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.1.ddl.aql
new file mode 100644
index 0000000..eff8e53
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.1.ddl.aql
@@ -0,0 +1,105 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as open{
+	id: int64
+}
+
+create type GS as closed{
+	id: int64,
+	Genus: string,
+	lower: S
+}
+
+create type FGS as open{
+	id: int64,
+	Family: string
+}
+
+create type OFGS as closed{
+	id: int64,
+	Order: string,
+	lower: FGS
+}
+
+create type COFGS as closed{
+	id: int64,
+	Class: string,
+	lower: OFGS
+}
+
+create type PCOFGS as closed{
+	id: int64,
+	Phylum: string,
+	lower: COFGS
+}
+
+create type KPCOFGS as open{
+	id: int64,
+	Kingdom: string
+}
+
+create type Classification as closed{
+	id: int64,
+	fullClassification:KPCOFGS
+}
+
+create type Animal as open{
+	id: int64
+}
+
+
+create dataset Animals(Animal)
+primary key id;
+
+create dataset Classifications(Classification)
+primary key id;
+
+create dataset KPCOFGSs(KPCOFGS)
+primary key id;
+
+create dataset Ss(S)
+primary key id;
+
+create dataset GSs(GS)
+primary key id;
+
+create dataset FGSs(FGS)
+primary key id;
+
+create dataset OFGSs(OFGS)
+primary key id;
+
+create dataset COFGSs(COFGS)
+primary key id;
+
+create dataset PCOFGSs(PCOFGS)
+primary key id;
+
+create index species on Ss(Species:string) enforced;
+
+create index genus on GSs(lower.Species:string) enforced;
+
+create index family on FGSs(lower.lower.Species:string) enforced;
+
+create index orda on OFGSs(lower.lower.lower.Species:string) enforced;
+
+create index classy on COFGSs(lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on PCOFGSs(lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index phylum on KPCOFGSs(lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index class on Classifications(fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
+
+create index anim on Animals(class.fullClassification.lower.lower.lower.lower.lower.lower.Species:string) enforced;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.2.update.aql
new file mode 100644
index 0000000..fb39879
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.2.update.aql
@@ -0,0 +1,96 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+insert into dataset Ss(
+	{"id":1,"Species":"Gulo"}
+);
+insert into dataset Ss(
+	{"id":2,"Species":"Johnstoni"}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Gulo"
+	return {"id":1,"Genus":"Gulo","lower":$S}
+);
+insert into dataset GSs(
+	for $S in dataset Ss
+	where $S.Species = "Johnstoni"
+	return {"id":2,"Genus":"Okapia","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Gulo"
+	return {"id":1,"Family":"Mustelinae","lower":$S}
+);
+insert into dataset FGSs(
+	for $S in dataset GSs
+	where $S.lower.Species = "Johnstoni"
+	return {"id":2,"Family":"Giraffidae","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Gulo"
+	return {"id":1,"Order":"Carnivora","lower":$S}
+);
+insert into dataset OFGSs(
+	for $S in dataset FGSs
+	where $S.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Order":"Artiodactyla","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Class":"Mammalia","lower":$S}
+);
+insert into dataset COFGSs(
+	for $S in dataset OFGSs
+	where $S.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Class":"Mammalia","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset PCOFGSs(
+	for $S in dataset COFGSs
+	where $S.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Phylum":"Chordata","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset KPCOFGSs(
+	for $S in dataset PCOFGSs
+	where $S.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"Kingdom":"Animalia","lower":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"fullClassification":$S}
+);
+insert into dataset Classifications(
+	for $S in dataset KPCOFGSs
+	where $S.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"fullClassification":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+	return {"id":1,"class":$S}
+);
+insert into dataset Animals(
+	for $S in dataset Classifications
+	where $S.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Johnstoni"
+	return {"id":2,"class":$S}
+);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.query.aql
new file mode 100644
index 0000000..41a3261
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Create a highly nested datastructure that uses opened and closed datasets
+				at different levels. Use open-nested indexes at every level
+				to copy from one data set upwards
+				check the final result to see if copies were successful all the way up
+* Expected Res : Success
+* Date         : 20 Oct 2014
+*/
+use dataverse test;
+
+for $test in dataset Animals
+where $test.class.fullClassification.lower.lower.lower.lower.lower.lower.Species = "Gulo"
+return $test;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
new file mode 100644
index 0000000..a2e44bd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
@@ -0,0 +1,48 @@
+/*
+ * Description    : Equi joins two datasets, DBLP and CSX, based on their title.
+ *                  DBLP has a secondary btree open enforced index on authors, and given the 'indexnl' hint
+ *                  we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPTypetmp as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPOpenType as open {
+  id: int64,
+  dblpid: string,
+  title: string,
+  misc: string
+}
+
+create type CSXTypetmp as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create type CSXType as closed {
+nested : CSXTypetmp
+}
+
+create dataset DBLPtmp(DBLPTypetmp) primary key id;
+create dataset CSXtmp(CSXTypetmp) primary key id;
+
+create dataset DBLP(DBLPType) primary key nested.id;
+create dataset CSX(CSXType) primary key nested.id;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
new file mode 100644
index 0000000..713dbb9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
@@ -0,0 +1,46 @@
+/*
+ * Description    : Equi joins two datasets, DBLP and CSX, based on their title.
+ *                  DBLP has a secondary btree open enforced index on authors, and given the 'indexnl' hint
+ *                  we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset DBLPtmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+
+load dataset CSXtmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+
+
+insert into dataset DBLP(
+	for $x in dataset DBLPtmp
+		where ($x.id<50)
+		return {
+			"nested" : $x
+		}
+);
+
+insert into dataset DBLP(
+	for $x in dataset DBLPtmp
+		where ($x.id>=50)
+		return {
+					"nested" : {
+						"id": $x.id,
+						"dblpid": $x.dblpid,
+						"title": $x.title,
+						"misc": $x.misc
+					}
+				}
+);
+
+insert into dataset CSX
+(
+	for $c in dataset('CSXtmp')
+	return {
+		"nested" : $c
+	}	
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
new file mode 100644
index 0000000..8207434
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
@@ -0,0 +1,10 @@
+/*
+ * Description    : Equi joins two datasets, DBLP and CSX, based on their title.
+ *                  DBLP has a secondary btree open enforced index on authors, and given the 'indexnl' hint
+ *                  we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index authors_index on DBLP(nested.authors:string) enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
new file mode 100644
index 0000000..475cc19
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
@@ -0,0 +1,14 @@
+/*
+ * Description    : Equi joins two datasets, DBLP and CSX, based on their title.
+ *                  DBLP has a secondary btree open enforced index on authors, and given the 'indexnl' hint
+ *                  we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('DBLP')
+for $b in dataset('CSX')
+where $a.nested.authors /*+ indexnl */ = $b.nested.authors
+order by $a.nested.id, $b.nested.id
+return {"aid": $a.nested.id, "bid": $b.nested.id, "authors": $a.nested.authors}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql
new file mode 100644
index 0000000..87a4274
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql
@@ -0,0 +1,48 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerOpenNestedType as open {
+  cid: int64,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create type CustomerNestedType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create type CustomerType as closed {
+  nested: CustomerNestedType
+}
+
+create type CustomerOpenType as closed {
+  nested: CustomerOpenNestedType
+}
+
+create dataset Customerstmp(CustomerOpenNestedType) primary key cid;
+create dataset Customers2tmp(CustomerNestedType) primary key cid;
+
+create dataset Customers(CustomerOpenType) primary key nested.cid;
+create dataset Customers2(CustomerType) primary key nested.cid;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql
new file mode 100644
index 0000000..6ff5e00
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql
@@ -0,0 +1,48 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset Customerstmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+load dataset Customers2tmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+insert into dataset Customers
+(
+	for $c in dataset('Customerstmp')
+	where $c.cid < 500
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset Customers
+(
+	for $c in dataset('Customerstmp')
+	where $c.cid >= 500
+	return {
+		"nested" : {
+			"cid": $c.cid,
+			"age": $c.age,
+			"address": $c.address,
+			"interests": $c.interests,
+			"children": $c.children
+		}
+	}	
+);
+
+insert into dataset Customers2
+(
+	for $c in dataset('Customers2tmp')
+	return {
+		"nested" : $c
+	}	
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql
new file mode 100644
index 0000000..47ea10c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql
@@ -0,0 +1,11 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index ngram_index on Customers(nested.name:string) type ngram(3) enforced;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql
new file mode 100644
index 0000000..24ea718
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+let $ed := edit-distance($a.nested.name, $b.nested.name)
+where $ed <= 4 and $a.nested.cid < $b.nested.cid
+order by $ed, $a.nested.cid, $b.nested.cid
+return { "arec": $a.nested, "brec": $b.nested, "ed": $ed }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql
new file mode 100644
index 0000000..623c72d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql
@@ -0,0 +1,47 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerOpenNestedType as open {
+  cid: int64,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create type CustomerNestedType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create type CustomerType as closed {
+  nested: CustomerNestedType
+}
+
+create type CustomerOpenType as closed {
+  nested: CustomerOpenNestedType
+}
+
+create dataset Customerstmp(CustomerOpenNestedType) primary key cid;
+create dataset Customers2tmp(CustomerNestedType) primary key cid;
+
+create dataset Customers(CustomerOpenType) primary key nested.cid;
+create dataset Customers2(CustomerType) primary key nested.cid;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql
new file mode 100644
index 0000000..ef57242
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql
@@ -0,0 +1,47 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset Customerstmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+load dataset Customers2tmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+insert into dataset Customers
+(
+	for $c in dataset('Customerstmp')
+	where $c.cid < 500
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset Customers
+(
+	for $c in dataset('Customerstmp')
+	where $c.cid >= 500
+	return {
+		"nested" : {
+			"cid": $c.cid,
+			"age": $c.age,
+			"address": $c.address,
+			"interests": $c.interests,
+			"children": $c.children
+		}
+	}	
+);
+
+insert into dataset Customers2
+(
+	for $c in dataset('Customers2tmp')
+	return {
+		"nested" : $c
+	}	
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql
new file mode 100644
index 0000000..dd8187b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql
@@ -0,0 +1,10 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index ngram_index on Customers(nested.name:string) type ngram(3) enforced;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql
new file mode 100644
index 0000000..3f28374
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql
@@ -0,0 +1,13 @@
+/*
+ * Description    : Fuzzy joins two datasets, Customers and Customers2, based on the edit-distance function of their names.
+ *                  Customers has a 3-gram index on name, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+where edit-distance($a.nested.name, $b.nested.name) <= 4 and $a.nested.cid < $b.nested.cid
+order by $a.nested.cid, $b.nested.cid
+return { "arec": $a.nested, "brec": $b.nested }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql
new file mode 100644
index 0000000..08a4443
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql
@@ -0,0 +1,48 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ *                  DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type DBLPTypetmp as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPOpenType as open {
+  id: int64,
+  dblpid: string,
+  authors: string,
+  misc: string
+}
+
+create type CSXTypetmp as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create type CSXType as closed {
+nested : CSXTypetmp
+}
+
+create dataset DBLPtmp(DBLPTypetmp) primary key id;
+create dataset CSXtmp(CSXTypetmp) primary key id;
+
+create dataset DBLP(DBLPType) primary key nested.id;
+create dataset CSX(CSXType) primary key nested.id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql
new file mode 100644
index 0000000..2773d30
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql
@@ -0,0 +1,45 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ *                  DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset DBLPtmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000")) pre-sorted;
+
+load dataset CSXtmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+
+
+insert into dataset DBLP(
+	for $x in dataset DBLPtmp
+		where ($x.id<50)
+		return {
+			"nested" : $x
+		}
+);
+
+insert into dataset DBLP(
+	for $x in dataset DBLPtmp
+		where ($x.id>=50)
+		return {
+					"nested" : {
+						"id": $x.id,
+						"dblpid": $x.dblpid,
+						"authors": $x.title,
+						"misc": $x.misc
+					}
+				}
+);
+
+insert into dataset CSX(
+	for $x in dataset CSXtmp
+	return {
+		"nested": $x
+	}
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql
new file mode 100644
index 0000000..f5e5b1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql
@@ -0,0 +1,11 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ *                  DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index ngram_index on DBLP(nested.title: string) type ngram(3) enforced;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql
new file mode 100644
index 0000000..b04550f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql
@@ -0,0 +1,16 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ *                  DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+set import-private-functions 'true';
+
+for $a in dataset('DBLP')
+for $b in dataset('CSX')
+let $jacc := similarity-jaccard(gram-tokens($a.nested.title, 3, false), gram-tokens($b.nested.title, 3, false))
+where $jacc >= 0.5f and $a.nested.id < $b.nested.id
+order by $jacc, $a.nested.id, $b.nested.id
+return { "arec": $a.nested, "brec": $b.nested, "jacc": $jacc }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql
new file mode 100644
index 0000000..4384d00
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql
@@ -0,0 +1,47 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ *                  DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type DBLPTypetmp as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPOpenType as open {
+  id: int64,
+  dblpid: string,
+  authors: string,
+  misc: string
+}
+
+create type CSXTypetmp as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create type CSXType as closed {
+nested : CSXTypetmp
+}
+
+create dataset DBLPtmp(DBLPTypetmp) primary key id;
+create dataset CSXtmp(CSXTypetmp) primary key id;
+
+create dataset DBLP(DBLPType) primary key nested.id;
+create dataset CSX(CSXType) primary key nested.id;
+


Mime
View raw message