asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [14/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:40 GMT
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/ngram-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql
new file mode 100644
index 0000000..783e4a6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * 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 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/ngram-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.2.update.aql
new file mode 100644
index 0000000..12c8d91
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.2.update.aql
@@ -0,0 +1,33 @@
+/*
+ * 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
+ */
+
+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/ngram-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql
new file mode 100644
index 0000000..bc7f2f8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql
@@ -0,0 +1,10 @@
+/*
+ * 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
+ */
+
+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/ngram-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.query.aql
new file mode 100644
index 0000000..0d8443a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.query.aql
@@ -0,0 +1,15 @@
+/*
+ * 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
+ */
+
+use dataverse test;
+set import-private-functions 'true';
+
+for $a in dataset('DBLPOpen')
+for $b in dataset('CSX')
+where similarity-jaccard(gram-tokens($a.title, 3, false), gram-tokens($b.title, 3, false)) >= 0.5f
+      and $a.id < $b.id
+order by $a.id, $b.id
+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/rtree-spatial-intersect-point/rtree-spatial-intersect-point.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.1.ddl.aql
new file mode 100644
index 0000000..8768ab8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * Description    : Joins two datasets on the intersection of their point attributes.
+ *                  The dataset 'MyData1' has an open enforced RTree index, 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 MyRecord as closed {
+  id: int64,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create type MyRecordOpen as open {
+  id: int64,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData1tmp(MyRecord) primary key id;
+create dataset MyData1(MyRecordOpen) primary key id;
+create dataset MyData2(MyRecord) 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/rtree-spatial-intersect-point/rtree-spatial-intersect-point.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.2.update.aql
new file mode 100644
index 0000000..0e461cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.2.update.aql
@@ -0,0 +1,39 @@
+/*
+ * Description    : Joins two datasets on the intersection of their point attributes.
+ *                  The dataset 'MyData1' has an open enforced RTree index, and we expect the
+ *                  join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset MyData1tmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+load dataset MyData2
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+insert into dataset MyData1
+(
+	for $c in dataset('MyData1tmp')
+	where $c.id < 10
+	return $c
+);
+
+insert into dataset MyData1
+(
+	for $c in dataset('MyData1tmp')
+	where $c.id >= 10
+	return {
+		"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/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.3.ddl.aql
new file mode 100644
index 0000000..9e8ed5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.3.ddl.aql
@@ -0,0 +1,11 @@
+/*
+ * Description    : Joins two datasets on the intersection of their point attributes.
+ *                  The dataset 'MyData1' has an open enforced RTree index, and we expect the
+ *                  join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index rtree_index on MyData1(point: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/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.query.aql
new file mode 100644
index 0000000..28dc9a3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.query.aql
@@ -0,0 +1,14 @@
+/*
+ * Description    : Joins two datasets on the intersection of their point attributes.
+ *                  The dataset 'MyData1' has an  open enforced RTree index, and we expect the
+ *                  join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('MyData1')
+for $b in dataset('MyData2')
+where spatial-intersect($a.point, $b.point) and $a.id != $b.id
+order by $a.id, $b.id
+return {"aid": $a.id, "bid": $b.id, "apt": $a.point, "bp": $b.point}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql
new file mode 100644
index 0000000..4ae022f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-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' word tokens.
+ *                  DBLP has a keyword 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/word-jaccard-inline/word-jaccard-inline.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.2.update.aql
new file mode 100644
index 0000000..7ad41d5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-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' word tokens.
+ *                  DBLP has a keyword 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/word-jaccard-inline/word-jaccard-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.3.ddl.aql
new file mode 100644
index 0000000..9c655fd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-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' word tokens.
+ *                  DBLP has a keyword 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 keyword_index on DBLPOpen(title:string) type keyword 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/word-jaccard-inline/word-jaccard-inline.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql
new file mode 100644
index 0000000..c8a9775
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword 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;
+
+for $a in dataset('DBLPOpen')
+for $b in dataset('CSX')
+let $jacc := similarity-jaccard(word-tokens($a.title), word-tokens($b.title))
+where $jacc >= 0.5f and $a.id < $b.id
+order by $jacc, $a.id, $b.id
+return { "arec": $a, "brec": $b, "jacc": $jacc }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.1.ddl.aql
new file mode 100644
index 0000000..b8a85f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword 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 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/word-jaccard/word-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.2.update.aql
new file mode 100644
index 0000000..58bd763
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.2.update.aql
@@ -0,0 +1,33 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and 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/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/word-jaccard/word-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.3.ddl.aql
new file mode 100644
index 0000000..c5740e6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.3.ddl.aql
@@ -0,0 +1,10 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index keyword_index on DBLPOpen(title:string) type keyword 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/word-jaccard/word-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.4.query.aql
new file mode 100644
index 0000000..6f18372
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-join/word-jaccard/word-jaccard.4.query.aql
@@ -0,0 +1,14 @@
+/*
+ * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and 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 similarity-jaccard(word-tokens($a.title), word-tokens($b.title)) >= 0.5f
+      and $a.id < $b.id
+order by $a.id, $b.id
+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-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.1.ddl.aql
new file mode 100644
index 0000000..f65caa8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.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 TweetMessageType as open {
+	tweetid: int64,
+        user: TwitterUserType,
+        sender-location: point,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string,
+	countA: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create dataset TweetMessagesTmp(TweetMessageType)
+primary key tweetid;
+
+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/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.2.update.aql
new file mode 100644
index 0000000..3f106bc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.2.update.aql
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+
+use dataverse test;
+
+
+load dataset TweetMessagesTmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid < int64("125")
+	return $c
+);
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid >= int64("125")
+	return {
+		"tweetid": $c.tweetid,
+		"user": $c.user,
+		"sender-location": $c.sender-location,
+		"send-time": $c.send-time,
+		"referred-topics": $c.referred-topics,
+		"message-text": $c.message-text,
+		"countA": $c.countA
+	}	
+);
\ 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-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.query.aql
new file mode 100644
index 0000000..d97dedb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.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 btree index in index subtree.
+ * Issue        : 730, 741
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
+
+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}
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.1.ddl.aql
new file mode 100644
index 0000000..f65caa8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.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 TweetMessageType as open {
+	tweetid: int64,
+        user: TwitterUserType,
+        sender-location: point,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string,
+	countA: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create dataset TweetMessagesTmp(TweetMessageType)
+primary key tweetid;
+
+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/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.2.update.aql
new file mode 100644
index 0000000..36e5ad7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.2.update.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 btree index in index subtree.
+ * Issue        : 730, 741
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
+
+use dataverse test;
+
+load dataset TweetMessagesTmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid < int64("125")
+	return $c
+);
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid >= int64("125")
+	return {
+		"tweetid": $c.tweetid,
+		"user": $c.user,
+		"sender-location": $c.sender-location,
+		"send-time": $c.send-time,
+		"referred-topics": $c.referred-topics,
+		"message-text": $c.message-text,
+		"countA": $c.countA
+	}	
+);
\ 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-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.query.aql
new file mode 100644
index 0000000..57fba17
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * 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
+ */
+
+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 and
+                        $t1.tweetid != $t2.tweetid
+                        order by $t2.tweetid
+                        return {"tweetid2": $t2.tweetid,
+                                       "count2":$t2.countB}
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.1.ddl.aql
new file mode 100644
index 0000000..7359e0f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.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 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 {
+	tweetid: int64,
+        user: TwitterUserType,
+        sender-location: point,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	countA: int64,
+	countB: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create dataset TweetMessagesTmp(TweetMessageType)
+primary key tweetid;
+
+
+create index msgNgramIx on TweetMessages(message-text: 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-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.2.update.aql
new file mode 100644
index 0000000..9338846
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.2.update.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 btree index in index subtree.
+ * Issue        : 730, 741
+ * Expected Res : Success
+ * Date         : 8th May 2014
+ */
+
+use dataverse test;
+
+load dataset TweetMessagesTmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid < int64("125")
+	return $c
+);
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid >= int64("125")
+	return {
+		"tweetid": $c.tweetid,
+		"user": $c.user,
+		"sender-location": $c.sender-location,
+		"send-time": $c.send-time,
+		"referred-topics": $c.referred-topics,
+		"countA": $c.countA,
+		"countB": $c.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/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.query.aql
new file mode 100644
index 0000000..5dab7e6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.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 keyword inverted index in index subtree.
+ * Issue        : 730, 741
+ * Expected Res : Success
+ * Date         : 16th May 2014
+ */
+
+use dataverse test;
+
+for $t1 in dataset('TweetMessagesTmp')
+where $t1.tweetid > int64("240")
+order by $t1.tweetid
+return {
+    "tweet": {"id": $t1.tweetid, "topics" : $t1.message-text} ,
+    "similar-tweets": for $t2 in dataset('TweetMessages')
+                      let $sim := edit-distance-check($t1.message-text, $t2.message-text, 7)
+		      where $sim[0] and
+                      $t2.tweetid != $t1.tweetid
+                      order by $t2.tweetid
+                      return {"id": $t2.tweetid, "topics" : $t2.message-text}
+};
\ 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-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.1.ddl.aql
new file mode 100644
index 0000000..dcd9af8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.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 TweetMessageType as open {
+	tweetid: int64,
+        user: TwitterUserType,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string,
+	countA: int64,
+	countB: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create dataset TweetMessagesTmp(TweetMessageType)
+primary key tweetid;
+
+
+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/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.2.update.aql
new file mode 100644
index 0000000..41c5ee3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.2.update.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
+ */
+
+use dataverse test;
+
+load dataset TweetMessagesTmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid < int64("125")
+	return $c
+);
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid >= int64("125")
+	return {
+		"tweetid": $c.tweetid,
+		"user": $c.user,
+		"send-time": $c.send-time,
+		"referred-topics": $c.referred-topics,
+		"message-text": $c.message-text,
+		"countA": $c.countA,
+		"countB": $c.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/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.query.aql
new file mode 100644
index 0000000..54f1775
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.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/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.1.ddl.aql
new file mode 100644
index 0000000..dcd9af8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.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 TweetMessageType as open {
+	tweetid: int64,
+        user: TwitterUserType,
+	send-time: datetime,
+        referred-topics: {{ string }},
+	message-text: string,
+	countA: int64,
+	countB: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create dataset TweetMessagesTmp(TweetMessageType)
+primary key tweetid;
+
+
+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/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.2.update.aql
new file mode 100644
index 0000000..41c5ee3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.2.update.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
+ */
+
+use dataverse test;
+
+load dataset TweetMessagesTmp
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid < int64("125")
+	return $c
+);
+
+insert into dataset TweetMessages
+(
+	for $c in dataset('TweetMessagesTmp')
+	where $c.tweetid >= int64("125")
+	return {
+		"tweetid": $c.tweetid,
+		"user": $c.user,
+		"send-time": $c.send-time,
+		"referred-topics": $c.referred-topics,
+		"message-text": $c.message-text,
+		"countA": $c.countA,
+		"countB": $c.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/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.query.aql
new file mode 100644
index 0000000..7599ae9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.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) and $t1.tweetid != $t2.tweetid
+                             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/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.1.ddl.aql
new file mode 100644
index 0000000..c1b5938
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.1.ddl.aql
@@ -0,0 +1,31 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname > "Julio" and $l.lname > "Mattocks" and
+ *					 $l.fname <= "Micco" and $l.lname < "Vangieson"
+ * Expected Result : Success
+ * Issue           : Issue 174
+ * Date            : 27th March, 2014
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as closed {
+id:int64,
+fname:string,
+lname:string,
+age:int64,
+dept:string
+}
+
+create type EmpOpen as open {
+id:int64,
+age:int64,
+dept:string
+}
+
+create dataset employee(Emp) primary key id;
+
+create dataset employeeOpen(EmpOpen) primary key 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-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.2.update.aql
new file mode 100644
index 0000000..7cd6eff
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname > "Julio" and $l.lname > "Mattocks" and
+ *					 $l.fname <= "Micco" and $l.lname < "Vangieson"
+ * Expected Result : Success
+ * Issue           : Issue 174
+ * Date            : 27th March, 2014
+ */
+
+use dataverse test;
+
+load dataset employee
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/names.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+insert into dataset employeeOpen (
+	for $x in dataset employee
+	where $x.id <= 1000
+	return $x
+);
+
+insert into dataset employeeOpen (
+	for $x in dataset employee
+	where $x.id > 1000
+	return {
+	  "id": $x.id,
+  	  "age": $x.age,
+  	  "dept": $x.dept
+	}
+);
\ 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-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ddl.aql
new file mode 100644
index 0000000..0987613
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ddl.aql
@@ -0,0 +1,13 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname > "Julio" and $l.lname > "Mattocks" and
+ *					 $l.fname <= "Micco" and $l.lname < "Vangieson"
+ * Expected Result : Success
+ * Issue           : Issue 174
+ * Date            : 27th March, 2014
+ */
+
+use dataverse test;
+
+create index idx_employee_f_l_name on employeeOpen(fname:string,lname: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/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.query.aql
new file mode 100644
index 0000000..1c028cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname > "Julio" and $l.lname > "Mattocks" and
+ *					 $l.fname <= "Micco" and $l.lname < "Vangieson"
+ * Expected Result : Success
+ * Issue           : Issue 174
+ * Date            : 27th March, 2014
+ */
+
+use dataverse test;
+
+for $l in dataset('employeeOpen')
+where $l.fname > "Julio" and $l.lname > "Mattocks" and $l.fname <= "Micco" and $l.lname < "Vangieson"
+order by $l.id
+return {
+	"id": $l.id,
+	"fname": $l.fname,
+	"lname": $l.lname,
+	"age": $l.age,
+	"dept": $l.dept
+}
\ 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-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql
new file mode 100644
index 0000000..15a2978
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql
@@ -0,0 +1,31 @@
+/*
+ * Description     : Test that BTree open index is used in query plan
+ *                 : define the BTree open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname="Julio" and $l.lname="Isa"
+ * Expected Result : Success
+ * Issue           : Issue 162
+ * Date            : 27th March 2014
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as closed {
+id:int64,
+fname:string,
+lname:string,
+age:int64,
+dept:string
+}
+
+create type EmpOpen as open {
+id:int64,
+age:int64,
+dept:string
+}
+
+create dataset employee(Emp) primary key id;
+
+create dataset employeeOpen(EmpOpen) 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-selection/btree-index-composite-key/btree-index-composite-key.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.2.update.aql
new file mode 100644
index 0000000..7226920
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.2.update.aql
@@ -0,0 +1,19 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname="Julio" and $l.lname="Isa"
+ * Expected Result : Success
+ * Issue           : Issue 162
+ * Date            : 27th March 2014
+ */
+
+use dataverse test;
+
+load dataset employee
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/names.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+insert into dataset employeeOpen (
+	for $x in dataset employee
+		return $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/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql
new file mode 100644
index 0000000..f9740f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql
@@ -0,0 +1,14 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname="Julio" and $l.lname="Isa"
+ * Expected Result : Success
+ * Issue           : Issue 162
+ * Date            : 27th March 2014
+ */
+
+use dataverse test;
+
+// create secondary index
+
+create index idx_employee_f_l_name on employeeOpen(fname:string,lname: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-selection/btree-index-composite-key/btree-index-composite-key.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.query.aql
new file mode 100644
index 0000000..6227c0c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.query.aql
@@ -0,0 +1,20 @@
+/*
+ * Description     : Test that BTree enforced open index is used in query plan
+ *                 : define the BTree enforced open index on a composite key (fname,lanme)
+ *                 : predicate => where $l.fname="Julio" and $l.lname="Isa"
+ * Expected Result : Success
+ * Issue           : Issue 162
+ * Date            : 27th March 2014
+ */
+
+use dataverse test;
+
+for $l in dataset('employeeOpen')
+where $l.fname="Julio" and $l.lname="Isa"
+return {
+	"id": $l.id,
+	"fname": $l.fname,
+	"lname": $l.lname,
+	"age": $l.age,
+	"dept": $l.dept
+}
\ 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-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql
new file mode 100644
index 0000000..5d931cc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * Description     : Test that multiple subtrees in the same query
+ *                   can be rewritten with secondary BTree indexes.
+ *                   Guards against regression to issue 204.
+ * Expected Result : Success
+ * Issue           : Issue 204
+ */
+
+drop dataverse tpch if exists;
+create dataverse tpch;
+use dataverse tpch;
+
+create type OrderType 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 dataset Orders(OrderType) primary key o_orderkey;
+
+create dataset OrdersOpen(OrderOpenType) primary key o_orderkey;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.2.update.aql
new file mode 100644
index 0000000..9d4ee93
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * Description     : Test that multiple subtrees in the same query
+ *                   can be rewritten with secondary BTree indexes.
+ *                   Guards against regression to issue 204.
+ * Expected Result : Success
+ * Issue           : Issue 204
+ */
+
+use dataverse tpch;
+
+load dataset Orders
+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 OrdersOpen (
+	for $x in dataset Orders
+	where $x.o_orderkey <= 4000
+	return $x
+);
+
+insert into dataset OrdersOpen (
+	for $x in dataset Orders
+	where $x.o_orderkey > 4000
+	return {
+	  "o_orderkey": $x.o_orderkey,
+	  "o_orderstatus": $x.o_orderstatus,
+	  "o_totalprice": $x.o_totalprice,
+	  "o_orderdate": $x.o_orderdate,
+	  "o_orderpriority": $x.o_orderpriority,
+	  "o_clerk": $x.o_clerk,
+	  "o_shippriority": $x.o_shippriority,
+	  "o_comment": $x.o_comment
+	}
+);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql
new file mode 100644
index 0000000..ec47f84
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql
@@ -0,0 +1,6 @@
+
+use dataverse tpch;
+
+// create secondary index on OrdersOpen(o_custkey)
+
+create index idx_Orders_Custkey on OrdersOpen(o_custkey:int32) enforced;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.query.aql
new file mode 100644
index 0000000..d14696d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.query.aql
@@ -0,0 +1,24 @@
+/*
+ * Description     : Test that multiple subtrees in the same query
+ *                   can be rewritten with secondary BTree indexes.
+ *                   Guards against regression to issue 204.
+ * Expected Result : Success
+ * Issue           : Issue 204
+ */
+
+use dataverse tpch;
+
+for $o in dataset('OrdersOpen')
+for $o2 in dataset('OrdersOpen')
+where $o.o_custkey = 20 and $o2.o_custkey = 10
+and $o.o_orderstatus < $o2.o_orderstatus
+order by $o.o_orderkey, $o2.o_orderkey
+return {
+  "o_orderkey": $o.o_orderkey,
+  "o_custkey": $o.o_custkey,
+  "o_orderstatus": $o.o_orderstatus,
+  "o_orderkey2": $o2.o_orderkey,
+  "o_custkey2": $o2.o_custkey,
+  "o_orderstatus2": $o2.o_orderstatus
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql
new file mode 100644
index 0000000..9a49a35
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql
@@ -0,0 +1,27 @@
+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 nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLP(DBLPType)
+  primary key id on group1;
+
+create dataset DBLPOpen(DBLPOpenType)
+  primary key id on group1;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.2.update.aql
new file mode 100644
index 0000000..64912ab
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.2.update.aql
@@ -0,0 +1,22 @@
+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"=":")) pre-sorted;
+
+insert into dataset test.DBLPOpen (
+	for $x in dataset test.DBLP
+	where $x.id <= 50
+	return $x
+);
+
+insert into dataset test.DBLPOpen (
+	for $c in dataset test.DBLP
+	where $c.id > 50
+	return {
+		"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/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql
new file mode 100644
index 0000000..fe99181
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql
@@ -0,0 +1,6 @@
+
+use dataverse test;
+
+// create secondary index of type ngram on DBLPOpen(title)
+
+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-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.query.aql
new file mode 100644
index 0000000..5b3396f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+for $o in dataset('DBLPOpen')
+where contains($o.title, "Multimedia")
+order by $o.id
+return {
+  "id": $o.id,
+  "dblpid": $o.dblpid,
+  "title": $o.title,
+  "authors": $o.authors,
+  "misc": $o.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-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.1.ddl.aql
new file mode 100644
index 0000000..bd0e5be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.1.ddl.aql
@@ -0,0 +1,28 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type DBLPOpenType as open {
+  id: int64,
+  dblpid: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPType as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLPtmp(DBLPType)
+  primary key id on group1;
+
+create dataset DBLP(DBLPOpenType)
+  primary key id on group1;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.2.update.aql
new file mode 100644
index 0000000..7f9a088
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.2.update.aql
@@ -0,0 +1,22 @@
+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 $x
+);
+
+insert into dataset test.DBLP (
+	for $c in dataset test.DBLPtmp
+	where $c.id > 50
+	return {
+		"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/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.3.ddl.aql
new file mode 100644
index 0000000..a7a6155
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index ngram_index on DBLP(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-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.query.aql
new file mode 100644
index 0000000..9749da8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.query.aql
@@ -0,0 +1,9 @@
+use dataverse test;
+
+for $paper in dataset('DBLP')
+where edit-distance-contains($paper.title, "Multmedia", 1)[0]
+order by $paper.id
+return {
+  "id" : $paper.id,
+  "title" : $paper.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/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql
new file mode 100644
index 0000000..7ed84ac
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql
@@ -0,0 +1,26 @@
+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 nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLP(DBLPType)
+  primary key id on group1;
+
+create dataset DBLPOpen(DBLPOpenType)
+  primary key 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/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.2.update.aql
new file mode 100644
index 0000000..41ae803
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.2.update.aql
@@ -0,0 +1,22 @@
+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"=":")) pre-sorted;
+
+insert into dataset test.DBLPOpen (
+	for $x in dataset test.DBLP
+	where $x.id <= 50
+	return $x
+);
+
+insert into dataset test.DBLPOpen (
+	for $c in dataset test.DBLP
+	where $c.id > 50
+	return {
+		"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/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql
new file mode 100644
index 0000000..88f3d5c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql
@@ -0,0 +1,4 @@
+
+use dataverse test;
+
+create index ngram_index on DBLPOpen(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/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.query.aql
new file mode 100644
index 0000000..41dfee6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+for $o in dataset('DBLPOpen')
+let $ed := edit-distance-check($o.authors, "Amihay Motro", 5)
+where $ed[0]
+return {
+  "id": $o.id,
+  "dblpid": $o.dblpid,
+  "title": $o.title,
+  "authors": $o.authors,
+  "misc": $o.misc
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.1.ddl.aql
new file mode 100644
index 0000000..51b22ad
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.1.ddl.aql
@@ -0,0 +1,27 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type DBLPOpenType as open {
+  id: int64,
+  dblpid: string,
+  authors: string,
+  misc: string
+}
+
+create type DBLPType as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create nodegroup group1 if not exists on nc1, nc2;
+
+create dataset DBLPtmp(DBLPType)
+  primary key id on group1;
+
+create dataset DBLP(DBLPOpenType)
+  primary key id on group1;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/04b2b77a/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/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/open-index-enforced/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/open-index-enforced/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..7f9a088
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.2.update.aql
@@ -0,0 +1,22 @@
+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 $x
+);
+
+insert into dataset test.DBLP (
+	for $c in dataset test.DBLPtmp
+	where $c.id > 50
+	return {
+		"id": $c.id,
+		"dblpid": $c.dblpid,
+		"authors": $c.authors,
+		"misc": $c.misc
+	}
+);
\ No newline at end of file


Mime
View raw message