You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2015/10/31 00:16:44 UTC

[36/51] [partial] incubator-asterixdb git commit: SQL++ parser: 1. refactored asterix-aql to become asterix-lang-common and asterix-lang-aql, where the former is the common part for different languages; 2. added asterix-lang-sqlpp on top of asterix-lang-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-26.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-26.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-26.sqlpp
new file mode 100644
index 0000000..6f2e3d1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-26.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-26.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Max') and (emp.nested.fname <= 'Roger'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-27.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-27.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-27.sqlpp
new file mode 100644
index 0000000..1b8a684
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-27.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 5th Feb 2013
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-27.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname,nested.lname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Craig') and (emp.nested.lname > 'Kevin') and (emp.nested.fname <= 'Mary') and (emp.nested.lname < 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-28.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-28.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-28.sqlpp
new file mode 100644
index 0000000..4fec8ca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-28.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 5th Feb 2013
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-28.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname,nested.lname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Craig') and (emp.nested.lname > 'Kevin') and (emp.nested.fname < 'Mary') and (emp.nested.lname <= 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-29.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-29.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-29.sqlpp
new file mode 100644
index 0000000..cf82b34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-29.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 5th Feb 2013
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-29.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname,nested.lname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Craig') and (emp.nested.lname >= 'Kevin') and (emp.nested.fname < 'Mary') and (emp.nested.lname < 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-30.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-30.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-30.sqlpp
new file mode 100644
index 0000000..0984940
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-30.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 5th Feb 2013
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-30.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname,nested.lname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Craig') and (emp.nested.lname > 'Kevin') and (emp.nested.fname < 'Mary') and (emp.nested.lname < 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-31.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-31.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-31.sqlpp
new file mode 100644
index 0000000..9980f11
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-31.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 11th Nov 2014
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-31.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname,nested.lname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname = 'Julio') and (emp.nested.lname > 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-32.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-32.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-32.sqlpp
new file mode 100644
index 0000000..3b5c1eb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-32.sqlpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the primary BTree index is used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 11th Nov 2014
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-32.adm"
+create type test.TestTypetmp as
+{
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.fname,nested.lname;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname < 'Julio') and (emp.nested.lname = 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-33.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-33.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-33.sqlpp
new file mode 100644
index 0000000..62577dd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-33.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-31.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname > 'Roger')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-34.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-34.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-34.sqlpp
new file mode 100644
index 0000000..b946c58
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-34.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-32.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname >= 'Susan')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-35.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-35.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-35.sqlpp
new file mode 100644
index 0000000..a9cc94a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-35.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification (usage) test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-33.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname < 'Isa')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-36.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-36.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-36.sqlpp
new file mode 100644
index 0000000..04fcab2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-36.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-34.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname <= 'Vanpatten')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-37.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-37.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-37.sqlpp
new file mode 100644
index 0000000..590a533
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-37.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-35.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname != 'Max')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-38.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-38.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-38.sqlpp
new file mode 100644
index 0000000..c0fe4fd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-38.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-36.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname = 'Julio')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-39.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-39.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-39.sqlpp
new file mode 100644
index 0000000..1523dab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-39.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-37.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.lname = 'Kim')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-40.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-40.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-40.sqlpp
new file mode 100644
index 0000000..41f1ea1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-40.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used in the optimized query plan
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-38.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname = 'Young Seok') and (emp.nested.lname = 'Kim'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-41.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-41.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-41.sqlpp
new file mode 100644
index 0000000..e327ebc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-41.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-39.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname = 'Julio') or (emp.nested.lname = 'Malaika'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-42.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-42.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-42.sqlpp
new file mode 100644
index 0000000..7fdade6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-42.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-40.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Alex') and (emp.nested.lname < 'Zach'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-43.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-43.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-43.sqlpp
new file mode 100644
index 0000000..aa7d980
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-43.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-41.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Allan') and (emp.nested.lname < 'Zubi'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-44.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-44.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-44.sqlpp
new file mode 100644
index 0000000..69e07c3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-44.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-42.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Allan') and (emp.nested.lname = 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-45.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-45.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-45.sqlpp
new file mode 100644
index 0000000..6045cad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-45.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-43.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname = 'Julio') and (emp.nested.lname < 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-46.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-46.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-46.sqlpp
new file mode 100644
index 0000000..07f297e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-46.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-44.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Michael') and (emp.nested.lname <= 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-47.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-47.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-47.sqlpp
new file mode 100644
index 0000000..93e495b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-47.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-45.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Craig') and (emp.nested.lname > 'Kevin') and (emp.nested.fname < 'Mary') and (emp.nested.lname < 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-48.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-48.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-48.sqlpp
new file mode 100644
index 0000000..3471ac9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-48.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-46.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Craig') and (emp.nested.lname >= 'Kevin') and (emp.nested.fname <= 'Mary') and (emp.nested.lname <= 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-49.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-49.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-49.sqlpp
new file mode 100644
index 0000000..3c14bc7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-49.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-47.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname <= 'Craig') and (emp.nested.lname > 'Kevin'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-50.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-50.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-50.sqlpp
new file mode 100644
index 0000000..f9d5030
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-50.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification 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  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-48.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname != 'Michael') and (emp.nested.lname != 'Carey'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-51.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-51.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-51.sqlpp
new file mode 100644
index 0000000..16a6018
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-51.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-49.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Craig') and (emp.nested.lname > 'Kevin') and (emp.nested.fname <= 'Mary') and (emp.nested.lname <= 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-52.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-52.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-52.sqlpp
new file mode 100644
index 0000000..b04d18f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-52.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-50.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Craig') and (emp.nested.lname >= 'Kevin') and (emp.nested.fname < 'Mary') and (emp.nested.lname < 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-53.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-53.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-53.sqlpp
new file mode 100644
index 0000000..e2e860d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-53.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-51.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Craig') and (emp.nested.lname <= 'Kevin') and (emp.nested.fname <= 'Mary') and (emp.nested.lname >= 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-54.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-54.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-54.sqlpp
new file mode 100644
index 0000000..1cb7aea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-54.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-52.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname > 'Max')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-55.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-55.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-55.sqlpp
new file mode 100644
index 0000000..7a17c0f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-55.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-53.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname >= 'Sofia')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-56.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-56.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-56.sqlpp
new file mode 100644
index 0000000..d4324f1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-56.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-54.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname < 'Chen')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-57.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-57.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-57.sqlpp
new file mode 100644
index 0000000..4fbc811
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-57.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-55.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname <= 'Julio')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-58.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-58.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-58.sqlpp
new file mode 100644
index 0000000..3f312c7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-58.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the primary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-56.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Neil') and (emp.nested.fname < 'Roger'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-59.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-59.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-59.sqlpp
new file mode 100644
index 0000000..d1ecbbf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-59.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-57.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname >= 'Max') and (emp.nested.fname <= 'Roger'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-60.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-60.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-60.sqlpp
new file mode 100644
index 0000000..d32e6d1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-60.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-58.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname) type btree;
+
+select element emp
+from  testdst as emp
+where (emp.nested.fname = 'Max')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-61.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-61.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-61.sqlpp
new file mode 100644
index 0000000..7767a27
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-61.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 13th Aug 2012
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-61.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname > 'Craig') and (emp.nested.lname > 'Kevin') and (emp.nested.fname <= 'Mary') and (emp.nested.lname < 'Tomes'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-62.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-62.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-62.sqlpp
new file mode 100644
index 0000000..386030e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-62.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 11th Nov 2014
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-62.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname = 'Julio') and (emp.nested.lname > 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-63.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-63.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-63.sqlpp
new file mode 100644
index 0000000..1bd6d66
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-secondary-63.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ *  Description     : BTree Index verification test
+ *                  : This test is intended to verify that the secondary BTree index is used 
+ *                  : in the optimized query plan.
+ *  Expected Result : Success
+ *  Date            : 11th Nov 2014
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-63.adm"
+create type test.TestTypetmp as
+{
+  id : int32,
+  fname : string,
+  lname : string
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname,nested.lname) type btree;
+
+select element emp
+from  testdst as emp
+where ((emp.nested.fname < 'Julio') and (emp.nested.lname = 'Xu'))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.sqlpp
new file mode 100644
index 0000000..4a61bb6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description    : Tests whether an ngram_index is applied to optimize a selection query using the contains function.
+ *                  The index should *not* be applied (see below).
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+create type test.DBLPTypetmp as
+ closed {
+  id : int32,
+  dblpid : string,
+  title : string,
+  authors : string,
+  misc : string
+}
+
+create type test.DBLPType as
+ closed {
+  nested : DBLPTypetmp
+}
+
+create  table DBLP(DBLPType) primary key nested.id;
+
+create  index ngram_index  on DBLP (nested.title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-basic_ngram-contains-panic.adm"
+select element o
+from  DBLP as o
+where test.contains(o.nested.title,'Mu')
+order by o.nested.id
+;