Added secondary index BTree search tests for composite key

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@665 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-31.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-31.aql
new file mode 100644
index 0000000..5f975c9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-31.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for this predicate.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Please note this is a Negative test and the BTree index should NOT be used in the plan.
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-primary-31.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with id, fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname > "Roger"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-32.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-32.aql
new file mode 100644
index 0000000..2baec2f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-32.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// This is a Negative test - prefix search, BTree index should not be used in the plan.
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-32.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname >= "Susan"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-33.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-33.aql
new file mode 100644
index 0000000..0782bb3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-33.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for the predicates that satisfy BTree index look up rule.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test - prefix search, BTree index should not be used.
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-33.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname < "Isa"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-34.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-34.aql
new file mode 100644
index 0000000..9e244d8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-34.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test - prefix search, BTree index should not be used in query plan
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-34.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname <= "Vanpatten"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-35.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-35.aql
new file mode 100644
index 0000000..847e38c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-35.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test - BTree index should NOT be used in query plan
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-35.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname != "Max"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-36.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-36.aql
new file mode 100644
index 0000000..44a3fe7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-36.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for the predicates that satisfy BTree index look up rule.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test - prefix search, BTree index should NOT be used in the query plan.
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-36.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname = "Julio"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-37.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-37.aql
new file mode 100644
index 0000000..1ae840e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-37.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// THE BTREE INDEX IN THIS CASE SHOULD NOT BE PICKED UP!!!!
+// Verify that the optimized query plan does not have the BTree search
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-37.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.lname = "Kim"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-38.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-38.aql
new file mode 100644
index 0000000..d093ac4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-38.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used in the optimized query plan 
+ *                  : predicate => where $emp.fname = "Young Seok" and $emp.lname = "Kim"      
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-38.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname = "Young Seok" and $emp.lname = "Kim"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-39.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-39.aql
new file mode 100644
index 0000000..9249e21
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-39.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for predicates like (predicate 1 or predicate 2).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-39.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname = "Julio" or $emp.lname = "Malaika"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-40.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-40.aql
new file mode 100644
index 0000000..cfc1319
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-40.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for predicates like (predicate 1 and predicate 2).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-40.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname > "Alex" and $emp.lname < "Zach"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-41.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-41.aql
new file mode 100644
index 0000000..38e4d6b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-41.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for predicates like the one used in this test.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-41.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname > "Allan" and $emp.lname < "Zubi"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-42.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-42.aql
new file mode 100644
index 0000000..5224aaf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-42.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for predicates like ($v1 > v2 and $v3 = v4)
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test - prefix search
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-42.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname > "Allan" and $emp.lname = "Xu"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-43.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-43.aql
new file mode 100644
index 0000000..44f6983
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-43.aql
@@ -0,0 +1,39 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for predicates like ( $V1 = V2 and $V3 < V4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+// Negative test - prefix search
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-43.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname = "Julio" and $emp.lname < "Xu"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-44.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-44.aql
new file mode 100644
index 0000000..6fd0577
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-44.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for predicates like ($v1 >= v2 and $v3 <= v4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-44.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname >= "Michael" and $emp.lname <= "Xu"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-45.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-45.aql
new file mode 100644
index 0000000..02723cb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-45.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for predicates like (predicate1 and predicate2 and predicate3 and predicate4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-45.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname > "Craig" and $emp.lname > "Kevin" and $emp.fname < "Mary" and $emp.lname < "Tomes"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-46.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-46.aql
new file mode 100644
index 0000000..86c4f84
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-46.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for predicates like (predicate1 and predicate2 and predicate3 and predicate4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-46.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname >= "Craig" and $emp.lname >= "Kevin" and $emp.fname <= "Mary" and $emp.lname <= "Tomes"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-47.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-47.aql
new file mode 100644
index 0000000..b9d3eed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-47.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan for predicates like ($v1 <= v2 and $v3 > v4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-47.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname <= "Craig" and $emp.lname > "Kevin"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-48.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-48.aql
new file mode 100644
index 0000000..96e81ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-48.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is NOT used 
+ *                  : in the optimized query plan 
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-48.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname != "Michael" and $emp.lname != "Carey"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-49.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-49.aql
new file mode 100644
index 0000000..0bd3f78
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-49.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for predicates like (predicate1 and predicate2 and predicate3 and predicate4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-49.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname > "Craig" and $emp.lname > "Kevin" and $emp.fname <= "Mary" and $emp.lname <= "Tomes"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-50.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-50.aql
new file mode 100644
index 0000000..9bd5b5a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-50.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for predicates like (predicate1 and predicate2 and predicate3 and predicate4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-50.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst') 
+where $emp.fname >= "Craig" and $emp.lname >= "Kevin" and $emp.fname < "Mary" and $emp.lname < "Tomes"
+return $emp
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-51.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-51.aql
new file mode 100644
index 0000000..d4860ec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-secondary-51.aql
@@ -0,0 +1,37 @@
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan for predicates like (predicate1 and predicate2 and predicate3 and predicate4).
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/btree-index_btree-secondary-51.adm";
+
+create type TestType as open {
+    id : int32,
+    fname : string,
+    lname : string
+}
+
+// create internal dataset
+create dataset testdst(TestType) partitioned by key id;
+
+// create secondary index
+create index sec_Idx on testdst(fname,lname);
+
+// load valid data with fname and lname entries
+
+load dataset testdst
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/id-fn-ln.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+// Query the data that was loaded above. 
+
+for $emp in dataset('testdst')
+where $emp.fname >= "Craig" and $emp.lname <= "Kevin" and $emp.fname <= "Mary" and $emp.lname >= "Tomes"
+return $emp