asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [15/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:41 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.2.update.aql
new file mode 100644
index 0000000..02c6cf6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.2.update.aql
@@ -0,0 +1,26 @@
+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"=":")) pre-sorted;
+
+insert into dataset test.DBLP (
+	for $x in dataset test.DBLPtmp
+	where $x.id <= 50
+	return {
+		"nested": $x
+	}
+);
+
+insert into dataset test.DBLP (
+	for $c in dataset test.DBLPtmp
+	where $c.id > 50
+	return {
+		"nested":	{
+			"id": $c.id,
+			"dblpid": $c.dblpid,
+			"authors": $c.authors,
+			"misc": $c.misc
+		}
+	}
+);
\ 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-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.3.ddl.aql
new file mode 100644
index 0000000..0cec8fd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.3.ddl.aql
@@ -0,0 +1,3 @@
+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-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.query.aql
new file mode 100644
index 0000000..c9c5f7e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.query.aql
@@ -0,0 +1,11 @@
+use dataverse test;
+
+for $paper in dataset('DBLP')
+for $word in word-tokens($paper.nested.title)
+where edit-distance-check($word, "Multmedia", 1)[0]
+distinct by $paper.nested.id
+order by $paper.nested.id
+return {
+  "id" : $paper.nested.id,
+  "title" : $paper.nested.title
+}
\ 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-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql
new file mode 100644
index 0000000..d45d39a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql
@@ -0,0 +1,30 @@
+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 DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLPtmp(DBLPTypetmp)
+  primary key id on group1;
+
+create dataset DBLP(DBLPType)
+  primary key nested.id on group1;
\ 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-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.2.update.aql
new file mode 100644
index 0000000..853e02d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.2.update.aql
@@ -0,0 +1,28 @@
+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"=":")) pre-sorted;
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id <= 50
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id > 50
+	return {
+		"nested" : {
+			"id": $c.id,
+			"dblpid": $c.dblpid,
+			"title": $c.title,
+			"misc": $c.misc
+		}
+	}	
+);
\ 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-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql
new file mode 100644
index 0000000..58618f8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index ngram_index on DBLP(nested.authors: 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-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.query.aql
new file mode 100644
index 0000000..3b164c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+let $ed := edit-distance-check($o.nested.authors, "Amihay Motro", 1)
+where $ed[0]
+return $o.nested

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql
new file mode 100644
index 0000000..361a31b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql
@@ -0,0 +1,30 @@
+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 DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLPtmp(DBLPTypetmp)
+  primary key id on group1;
+
+create dataset DBLP(DBLPType)
+  primary key nested.id on group1;
\ 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-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.2.update.aql
new file mode 100644
index 0000000..39a16d3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.2.update.aql
@@ -0,0 +1,28 @@
+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"=":")) pre-sorted;
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id <= 50
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id > 50
+	return {
+		"nested" : {
+			"id": $c.id,
+			"dblpid": $c.dblpid,
+			"authors": $c.authors,
+			"misc": $c.misc
+		}
+	}	
+);
\ 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-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql
new file mode 100644
index 0000000..f937066
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index ngram_index on DBLP(nested.title: string) type ngram(3) 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/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
new file mode 100644
index 0000000..0c21fbf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+set import-private-functions 'true';
+
+for $o in dataset('DBLP')
+let $jacc := similarity-jaccard-check(gram-tokens($o.nested.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false), 0.5f)
+where $jacc[0]
+return $o.nested

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql
new file mode 100644
index 0000000..361a31b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql
@@ -0,0 +1,30 @@
+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 DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLPtmp(DBLPTypetmp)
+  primary key id on group1;
+
+create dataset DBLP(DBLPType)
+  primary key nested.id on group1;
\ 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-selection/inverted-index-word-contains/inverted-index-word-contains.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.2.update.aql
new file mode 100644
index 0000000..037789d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.2.update.aql
@@ -0,0 +1,29 @@
+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"=":")) pre-sorted;
+
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id <= 50
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id > 50
+	return {
+		"nested" : {
+			"id": $c.id,
+			"dblpid": $c.dblpid,
+			"authors": $c.authors,
+			"misc": $c.misc
+		}
+	}	
+);
\ 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-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql
new file mode 100644
index 0000000..cb0ae64
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql
@@ -0,0 +1,4 @@
+use dataverse test;
+
+create index keyword_index on DBLP(nested.title: string) type keyword enforced;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.query.aql
new file mode 100644
index 0000000..a106105
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+where contains($o.nested.title, "Multimedia")
+order by $o.nested.id
+return $o.nested

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql
new file mode 100644
index 0000000..361a31b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql
@@ -0,0 +1,30 @@
+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 DBLPType as closed {
+nested : DBLPOpenType
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLPtmp(DBLPTypetmp)
+  primary key id on group1;
+
+create dataset DBLP(DBLPType)
+  primary key nested.id on group1;
\ 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-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.2.update.aql
new file mode 100644
index 0000000..037789d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.2.update.aql
@@ -0,0 +1,29 @@
+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"=":")) pre-sorted;
+
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id <= 50
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset DBLP
+(
+	for $c in dataset('DBLPtmp')
+	where $c.id > 50
+	return {
+		"nested" : {
+			"id": $c.id,
+			"dblpid": $c.dblpid,
+			"authors": $c.authors,
+			"misc": $c.misc
+		}
+	}	
+);
\ 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-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql
new file mode 100644
index 0000000..b3592ca
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index keyword_index on DBLP(nested.title: string) type keyword enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.query.aql
new file mode 100644
index 0000000..9da808a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+let $jacc := similarity-jaccard-check(word-tokens($o.nested.title), word-tokens("Transactions for Cooperative Environments"), 0.5f)
+where $jacc[0]
+return $o.nested
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql
new file mode 100644
index 0000000..f571b58
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql
@@ -0,0 +1,36 @@
+drop dataverse tpch if exists;
+create dataverse tpch;
+use dataverse tpch;
+
+create type OrderTypetmp as closed {
+  o_orderkey: int64,
+  o_custkey: int64,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int64,
+  o_comment: string
+}
+
+create type OrderOpenType as open {
+  o_orderkey: int64,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int64,
+  o_comment: string
+}
+
+create type OrderType as closed {
+  nested : OrderOpenType
+}
+
+create dataset Orderstmp(OrderTypetmp)
+  primary key o_orderkey;
+
+create dataset Orders(OrderType)
+  primary key nested.o_orderkey;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.2.update.aql
new file mode 100644
index 0000000..a51bfda
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.2.update.aql
@@ -0,0 +1,13 @@
+use dataverse tpch;
+
+load dataset Orderstmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+insert into dataset Orders
+(
+	for $c in dataset('Orderstmp')
+	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-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql
new file mode 100644
index 0000000..73bb94f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse tpch;
+
+create index idx_Orders_Custkey on Orders(nested.o_custkey: int32) enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.query.aql
new file mode 100644
index 0000000..0dcf30f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.query.aql
@@ -0,0 +1,10 @@
+use dataverse tpch;
+
+for $o in dataset('Orders')
+where
+  $o.nested.o_custkey = 40 and $o.nested.o_totalprice > 150000.0
+order by $o.nested.o_orderkey
+return {
+  "o_orderkey": $o.nested.o_orderkey,
+  "o_custkey": $o.nested.o_custkey
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql
new file mode 100644
index 0000000..5359eec
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql
@@ -0,0 +1,37 @@
+drop dataverse tpch if exists;
+create dataverse tpch;
+use dataverse tpch;
+
+create type OrderTypetmp as closed {
+  o_orderkey: int64,
+  o_custkey: int64,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int64,
+  o_comment: string
+}
+
+create type OrderOpenType as open {
+  o_orderkey: int64,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int64,
+  o_comment: string
+}
+
+create type OrderType as closed {
+  nested : OrderOpenType
+}
+
+create dataset Orderstmp(OrderTypetmp)
+  primary key o_orderkey;
+
+create dataset Orders(OrderType)
+  primary key nested.o_orderkey;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.2.update.aql
new file mode 100644
index 0000000..7ae4edb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.2.update.aql
@@ -0,0 +1,32 @@
+use dataverse tpch;
+
+load dataset Orderstmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+insert into dataset Orders
+(
+	for $c in dataset('Orderstmp')
+	where $c.o_orderkey <= 3000
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset Orders
+(
+	for $c in dataset('Orderstmp')
+	where $c.o_orderkey > 3000
+	return {
+		"nested" : {
+			"o_orderkey": $c.o_orderkey,
+			"o_orderstatus": $c.o_orderstatus,
+			"o_totalprice": $c.o_totalprice,
+			"o_orderdate": $c.o_orderdate,
+			"o_orderpriority": $c.o_orderpriority,
+			"o_clerk": $c.o_clerk,
+			"o_shippriority": $c.o_shippriority,
+			"o_comment": $c.o_comment
+		}
+	}	
+);
\ 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-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql
new file mode 100644
index 0000000..73bb94f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse tpch;
+
+create index idx_Orders_Custkey on Orders(nested.o_custkey: int32) enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.query.aql
new file mode 100644
index 0000000..2bf4301
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.query.aql
@@ -0,0 +1,10 @@
+use dataverse tpch;
+
+for $o in dataset('Orders')
+where
+  $o.nested.o_custkey = 40
+order by $o.nested.o_orderkey
+return {
+  "o_orderkey": $o.nested.o_orderkey,
+  "o_custkey": $o.nested.o_custkey
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.1.ddl.aql
new file mode 100644
index 0000000..2139bd5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.1.ddl.aql
@@ -0,0 +1,51 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type LineItemTypetmp as closed {
+  l_orderkey: int64,
+  l_partkey: int64,
+  l_suppkey: int64,
+  l_linenumber: int64,
+  l_quantity: double,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create type LineItemOpenType as open {
+  l_orderkey: int64,
+  l_partkey: int64,
+  l_linenumber: int64,
+  l_quantity: double,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create type LineItemType as closed {
+nested : LineItemOpenType
+}
+
+create dataset LineItemtmp(LineItemTypetmp)
+  primary key l_orderkey, l_linenumber;
+
+create dataset LineItem(LineItemType)
+  primary key nested.l_orderkey, nested.l_linenumber;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.2.update.aql
new file mode 100644
index 0000000..8e9006d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.2.update.aql
@@ -0,0 +1,39 @@
+use dataverse test;
+
+load dataset LineItemtmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+insert into dataset LineItem
+(
+	for $c in dataset('LineItemtmp')
+	where $c.l_orderkey < 3000
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset LineItem
+(
+	for $x in dataset('LineItemtmp')
+	where $x.l_orderkey >= 3000
+	return {
+		"nested" : {
+			"l_orderkey": $x.l_orderkey,
+			"l_partkey": $x.l_partkey,
+			"l_linenumber": $x.l_linenumber,
+			"l_quantity": $x.l_quantity,
+			"l_extendedprice": $x.l_extendedprice,
+			"l_discount": $x.l_discount,
+			"l_tax": $x.l_tax,
+			"l_returnflag": $x.l_returnflag,
+			"l_linestatus": $x.l_linestatus,
+			"l_shipdate": $x.l_shipdate,
+			"l_commitdate": $x.l_commitdate,
+			"l_receiptdate": $x.l_receiptdate,
+			"l_shipinstruct": $x.l_shipinstruct,
+			"l_shipmode": $x.l_shipmode,
+			"l_comment": $x.l_comment
+		}
+	}	
+);
\ 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-selection/range-search/range-search.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.3.ddl.aql
new file mode 100644
index 0000000..30ae1d4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index idx_LineItem_suppkey on LineItem(nested.l_suppkey: int32) enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.4.query.aql
new file mode 100644
index 0000000..8050106
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/range-search/range-search.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $c in dataset('LineItem')
+where $c.nested.l_suppkey < 100 and $c.nested.l_suppkey>5
+order by $c.nested.l_orderkey, $c.nested.l_linenumber
+return $c.nested
\ 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-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
new file mode 100644
index 0000000..8b65d31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.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,
+  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-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql
new file mode 100644
index 0000000..a578a6c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.2.update.aql
@@ -0,0 +1,32 @@
+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')
+	where $c.id < 15
+	return {
+		"nested" : $c
+	}	
+);
+
+insert into dataset MyData
+(
+	for $c in dataset('MyDatatmp')
+	where $c.id >= 15
+	return {
+		"nested" : {
+			"id": $c.id,
+			"kwds": $c.kwds,
+			"line1": $c.line1,
+			"line2": $c.line2,
+			"poly1": $c.poly1,
+			"poly2": $c.poly2,
+			"rec": $c.rec,
+			"circle": $c.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/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
new file mode 100644
index 0000000..5b7e13c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-open-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: 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/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-open-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-open-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/open-index-enforced/error-checking/enforced-field-name-collision/enforced-field-name-collision.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/enforced-field-name-collision/enforced-field-name-collision.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/enforced-field-name-collision/enforced-field-name-collision.1.ddl.aql
new file mode 100644
index 0000000..9aac9f3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/enforced-field-name-collision/enforced-field-name-collision.1.ddl.aql
@@ -0,0 +1,11 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type testType as open {
+   "id": int32,
+   "value": string
+}
+
+create dataset testDS(testType) primary key id;
+create index testIdx on testDS(value: 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/open-index-enforced/error-checking/enforced-field-type-collision/enforced-field-name-collision.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/enforced-field-type-collision/enforced-field-name-collision.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/enforced-field-type-collision/enforced-field-name-collision.1.ddl.aql
new file mode 100644
index 0000000..4a6a99b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/enforced-field-type-collision/enforced-field-name-collision.1.ddl.aql
@@ -0,0 +1,11 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type testType as open {
+   "id": int32,
+   "value": string
+}
+
+create dataset testDS(testType) primary key id;
+create index testIdx on testDS(value: 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/open-index-enforced/error-checking/index-on-closed-type/index-on-closed-type.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/index-on-closed-type/index-on-closed-type.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/index-on-closed-type/index-on-closed-type.1.ddl.aql
new file mode 100644
index 0000000..278d9b0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/index-on-closed-type/index-on-closed-type.1.ddl.aql
@@ -0,0 +1,10 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type testType as closed {
+   "id": int32
+}
+
+create dataset testDS(testType) primary key id;
+create index testIdx on testDS(value: 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/open-index-enforced/error-checking/missing-enforce-statement/missing-enforce-statement.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/missing-enforce-statement/missing-enforce-statement.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/missing-enforce-statement/missing-enforce-statement.1.ddl.aql
new file mode 100644
index 0000000..668241d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/error-checking/missing-enforce-statement/missing-enforce-statement.1.ddl.aql
@@ -0,0 +1,10 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type testType as open {
+   "id": int32
+}
+
+create dataset testDS(testType) primary key id;
+create index testIdx on testDS(value: string);
\ 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/open-index-enforced/external-indexing/adm-format/adm-format.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.1.ddl.aql
new file mode 100644
index 0000000..e618a59
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.1.ddl.aql
@@ -0,0 +1,28 @@
+/*
+* 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 MyRecord as open {
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create external dataset MyData(MyRecord)
+using hdfs
+(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/spatialData.json"),("input-format"="text-input-format"),("input-format"="text-input-format"),("format"="adm"));
+
+create index idx on MyData(id:int64) 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/open-index-enforced/external-indexing/adm-format/adm-format.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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/open-index-enforced/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/open-index-enforced/external-indexing/adm-format/adm-format.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.3.query.aql
new file mode 100644
index 0000000..22de026
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/adm-format/adm-format.3.query.aql
@@ -0,0 +1,12 @@
+/*
+* 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.id = 10
+return $d;
\ 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/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql
new file mode 100644
index 0000000..41456a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.1.ddl.aql
@@ -0,0 +1,34 @@
+/*
+ * 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 TweetMessageType as open {
+        user: TwitterUserType,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string
+}
+
+create external dataset TweetMessages(TweetMessageType) using hdfs(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/tw_for_indexleftouterjoin.adm"),("input-format"="text-input-format"),("format"="adm"));
+
+create index IdIx on TweetMessages(tweetid:int64) type btree enforced;
+create index msgCountAIx on TweetMessages(countA:int64) type btree enforced;
+create index msgCountBIx on TweetMessages(countB:int64) type btree enforced;
+create index twmSndLocIx on TweetMessages(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/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.query.aql
new file mode 100644
index 0000000..50e72e3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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.sender-location, 0.5)
+where $t1.tweetid < int64("10")
+order by $t1.tweetid
+return {
+"tweetid1": $t1.tweetid,
+"loc1":$t1.sender-location,
+"nearby-message": for $t2 in dataset('TweetMessages')
+                             where spatial-intersect($t2.sender-location, $n) 
+                             order by $t2.tweetid 
+                             return {"tweetid2":$t2.tweetid, "loc2":$t2.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/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql
new file mode 100644
index 0000000..405f751
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.1.ddl.aql
@@ -0,0 +1,33 @@
+/*
+ * 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 TweetMessageType as open {
+        user: TwitterUserType,
+        sender-location: point,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string
+}
+
+create external dataset TweetMessages(TweetMessageType) using hdfs(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/tw_for_indexleftouterjoin.adm"),("input-format"="text-input-format"),("format"="adm"));
+
+create index IdIx on TweetMessages(tweetid:int64) type btree enforced;
+create index msgCountAIx on TweetMessages(countA:int64) type btree enforced;
+create index msgCountBIx on TweetMessages(countB:int64) type btree enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.2.update.aql
new file mode 100644
index 0000000..16cbac3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.query.aql
new file mode 100644
index 0000000..408a2e1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.query.aql
@@ -0,0 +1,14 @@
+use dataverse test;
+
+for $t1 in dataset('TweetMessages')
+where $t1.tweetid < int64("10")
+order by $t1.tweetid
+return {
+"tweetid1": $t1.tweetid,
+"count1":$t1.countA,
+"t2info": for $t2 in dataset('TweetMessages') 
+          where $t1.countA /* +indexnl */= $t2.countB
+          order by $t2.tweetid 
+          return {"tweetid2": $t2.tweetid,
+                  "count2":$t2.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/open-index-enforced/external-indexing/rtree-index/rtree-index.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/rtree-index/rtree-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/rtree-index/rtree-index.1.ddl.aql
new file mode 100644
index 0000000..85e0305
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/rtree-index/rtree-index.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as open {
+  id: int64,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create external dataset MyData(MyRecord) using hdfs(("hdfs"="hdfs://127.0.0.1:31888"),("path"="/asterix/spatialData.json"),("input-format"="text-input-format"),("format"="adm"));
+
+create index rtree_index_point on MyData(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/open-index-enforced/external-indexing/rtree-index/rtree-index.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/rtree-index/rtree-index.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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/open-index-enforced/external-indexing/rtree-index/rtree-index.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/rtree-index/rtree-index.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/external-indexing/rtree-index/rtree-index.3.query.aql
new file mode 100644
index 0000000..9986216
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+order by $o.id
+return {"id":$o.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/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
new file mode 100644
index 0000000..0860c0b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * 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 DBLPType 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 CSXType as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+create dataset DBLPOpen(DBLPOpenType) primary key id;
+create dataset CSX(CSXType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
new file mode 100644
index 0000000..c74f64e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
@@ -0,0 +1,33 @@
+/*
+ * 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 DBLP
+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 CSX
+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 DBLPOpen(
+	for $x in dataset DBLP
+		where ($x.id<50)
+		return $x
+);
+
+insert into dataset DBLPOpen(
+	for $x in dataset DBLP
+		where ($x.id>=50)
+		return {
+					"id": $x.id,
+					"dblpid": $x.dblpid,
+					"title": $x.title,
+					"misc": $x.misc
+				}
+); 
\ 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/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
new file mode 100644
index 0000000..414d940
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
@@ -0,0 +1,11 @@
+/*
+ * 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 DBLPOpen(authors:string) enforced;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
new file mode 100644
index 0000000..c626146
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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('DBLPOpen')
+for $b in dataset('CSX')
+where $a.authors /*+ indexnl */ = $b.authors
+order by $a.id, $b.id
+return {"aid": $a.id, "bid": $b.id, "authors": $a.authors}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql
new file mode 100644
index 0000000..547c0f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.1.ddl.aql
@@ -0,0 +1,40 @@
+/*
+ * 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 CustomerType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create type CustomerOpenType as open {
+  cid: int64,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerOpenType) primary key cid;
+
+create dataset Customerstmp(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql
new file mode 100644
index 0000000..a5b3feb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.2.update.aql
@@ -0,0 +1,36 @@
+/*
+ * 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 Customers2
+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  $c
+);
+
+insert into dataset Customers
+(
+	for $c in dataset('Customerstmp')
+	where $c.cid >= 500
+	return {
+		"cid": $c.cid,
+		"age": $c.age,
+		"address": $c.address,
+		"interests": $c.interests,
+		"children": $c.children
+	}	
+);
\ 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/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.3.ddl.aql
new file mode 100644
index 0000000..b65e0df
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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(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/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.query.aql
new file mode 100644
index 0000000..fae1b49
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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.name, $b.name)
+where $ed <= 4 and $a.cid < $b.cid
+order by $ed, $a.cid, $b.cid
+return { "arec": $a, "brec": $b, "ed": $ed }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql
new file mode 100644
index 0000000..b443e4e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * 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 CustomerOpenType as open {
+  cid: int64,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerOpenType) primary key cid;
+
+create dataset Customerstmp(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql
new file mode 100644
index 0000000..4fb5609
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.2.update.aql
@@ -0,0 +1,35 @@
+/*
+ * 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 Customers2
+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  $c
+);
+
+insert into dataset Customers
+(
+	for $c in dataset('Customerstmp')
+	where $c.cid >= 500
+	return {
+		"cid": $c.cid,
+		"age": $c.age,
+		"address": $c.address,
+		"interests": $c.interests,
+		"children": $c.children
+	}	
+);
\ 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/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.3.ddl.aql
new file mode 100644
index 0000000..fb416be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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(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/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.query.aql
new file mode 100644
index 0000000..af3f92f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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.name, $b.name) <= 4 and $a.cid < $b.cid
+order by $a.cid, $b.cid
+return { "arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql
new file mode 100644
index 0000000..6e4bb17
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.1.ddl.aql
@@ -0,0 +1,40 @@
+/*
+ * 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 DBLPType 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 CSXType as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+
+create dataset DBLPOpen(DBLPOpenType) primary key id;
+
+create dataset CSX(CSXType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql
new file mode 100644
index 0000000..5f26efc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * 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 DBLP
+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;
+
+insert into dataset DBLPOpen(
+	for $x in dataset DBLP
+		where ($x.id<50)
+		return $x
+);
+
+insert into dataset DBLPOpen(
+	for $x in dataset DBLP
+		where ($x.id>=50)
+		return {
+					"id": $x.id,
+					"dblpid": $x.dblpid,
+					"authors": $x.title,
+					"misc": $x.misc
+				}
+);
+
+load dataset CSX
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.3.ddl.aql
new file mode 100644
index 0000000..05b3c03
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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 DBLPOpen(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/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.query.aql
new file mode 100644
index 0000000..61fb9f3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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('DBLPOpen')
+for $b in dataset('CSX')
+let $jacc := similarity-jaccard(gram-tokens($a.title, 3, false), gram-tokens($b.title, 3, false))
+where $jacc >= 0.5f and $a.id < $b.id
+order by $jacc, $a.id, $b.id
+return { "arec": $a, "brec": $b, "jacc": $jacc }


Mime
View raw message