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:40 UTC

[32/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-open-index/btree-index/btree-secondary-37.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-37.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-37.sqlpp
new file mode 100644
index 0000000..2ca1b99
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-37.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-38.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-38.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-38.sqlpp
new file mode 100644
index 0000000..8e131b3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-38.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-39.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-39.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-39.sqlpp
new file mode 100644
index 0000000..64cf6ed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-39.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 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-40.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-40.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-40.sqlpp
new file mode 100644
index 0000000..a6866bd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-40.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 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-41.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-41.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-41.sqlpp
new file mode 100644
index 0000000..4111bdb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-41.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-42.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-42.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-42.sqlpp
new file mode 100644
index 0000000..ced0a75
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-42.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-43.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-43.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-43.sqlpp
new file mode 100644
index 0000000..99ab006
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-43.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-44.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-44.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-44.sqlpp
new file mode 100644
index 0000000..409c15e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-44.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-45.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-45.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-45.sqlpp
new file mode 100644
index 0000000..7be8ee7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-45.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-46.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-46.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-46.sqlpp
new file mode 100644
index 0000000..2a439de
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-46.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-47.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-47.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-47.sqlpp
new file mode 100644
index 0000000..4555731
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-47.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-48.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-48.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-48.sqlpp
new file mode 100644
index 0000000..9488631
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-48.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-49.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-49.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-49.sqlpp
new file mode 100644
index 0000000..c638c3e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-49.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-50.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-50.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-50.sqlpp
new file mode 100644
index 0000000..86a4e80
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-50.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-51.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-51.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-51.sqlpp
new file mode 100644
index 0000000..d8ab1cc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-51.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-52.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-52.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-52.sqlpp
new file mode 100644
index 0000000..ab1a592
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-52.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-53.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-53.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-53.sqlpp
new file mode 100644
index 0000000..be5fa7e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-53.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-54.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-54.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-54.sqlpp
new file mode 100644
index 0000000..72cdf55
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-54.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-55.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-55.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-55.sqlpp
new file mode 100644
index 0000000..847f47d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-55.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-56.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-56.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-56.sqlpp
new file mode 100644
index 0000000..98aeb72
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-56.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-57.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-57.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-57.sqlpp
new file mode 100644
index 0000000..0448bbb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-57.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-58.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-58.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-58.sqlpp
new file mode 100644
index 0000000..0b1760c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-58.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-59.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-59.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-59.sqlpp
new file mode 100644
index 0000000..25d2a86
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-59.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-60.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-60.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-60.sqlpp
new file mode 100644
index 0000000..6cb8dd2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-60.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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,
+  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:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-61.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-61.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-61.sqlpp
new file mode 100644
index 0000000..33511e5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-61.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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-59.adm"
+create type test.TestTypetmp as
+{
+  id : int32
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-62.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-62.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-62.sqlpp
new file mode 100644
index 0000000..d21967a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-62.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/btree-index/btree-secondary-63.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-63.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-63.sqlpp
new file mode 100644
index 0000000..0fa570d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-63.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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
+}
+
+create type test.TestType as
+{
+  nested : TestTypetmp
+}
+
+create  table testdst(TestType) primary key nested.id;
+
+create  index sec_Idx  on testdst (nested.fname:string,nested.lname:string) type btree enforced;
+
+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-open-index/inverted-index-basic/ngram-contains-panic.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.sqlpp
new file mode 100644
index 0000000..bbfaaaf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.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    : 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
+{
+  id : int32,
+  dblpid : 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:string) type ngram (3) enforced;
+
+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
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.sqlpp
new file mode 100644
index 0000000..d62e983
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.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    : Tests whether an ngram_index is applied to optimize a selection query using the contains function.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : 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:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-contains.adm"
+select element o
+from  DBLP as o
+where test.contains(o.nested.title,'Multimedia')
+order by o.nested.id
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
new file mode 100644
index 0000000..740f873
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.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    : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings.
+ *                  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
+{
+  id : int32,
+  dblpid : string,
+  title : 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.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm"
+select element o
+from  DBLP as o
+with  ed as test."edit-distance-check"(o.nested.authors,'Amihay Motro',5)
+where ed[0]
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.sqlpp
new file mode 100644
index 0000000..154bc8f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.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    : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : string,
+  title : 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.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-edit-distance-check.adm"
+select element o
+from  DBLP as o
+where test."edit-distance-check"(o.nested.authors,'Amihay Motro',1)[0]
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.sqlpp
new file mode 100644
index 0000000..39bc4a5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.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    : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance function on strings.
+ *                  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
+{
+  id : int32,
+  dblpid : string,
+  title : 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.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-edit-distance-panic.adm"
+select element o
+from  DBLP as o
+where (test."edit-distance"(o.nested.authors,'Amihay Motro') <= 5)
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.sqlpp
new file mode 100644
index 0000000..214cefa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.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    : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance function on strings.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : string,
+  title : 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.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-edit-distance.adm"
+select element o
+from  DBLP as o
+where (test."edit-distance"(o.nested.authors,'Amihay Motro') <= 1)
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..59347e2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
@@ -0,0 +1,56 @@
+/*
+ * 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 with ~= using edit-distance on strings.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : string,
+  title : 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.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-fuzzyeq-edit-distance.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "1";
+
+select element o
+from  DBLP as o
+where (o.nested.authors ~= 'Amihay Motro')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..19fb844
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * 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 with ~= using Jaccard on 3-gram tokens.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : 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:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.8f";
+
+select element o
+from  DBLP as o
+where (test."gram-tokens"(o.nested.title,3,false) ~= test."gram-tokens"('Transactions for Cooperative Environments',3,false))
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.sqlpp
new file mode 100644
index 0000000..4ceb420
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.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 similarity-jaccard-check function on 3-gram tokens.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : 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:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-jaccard-check.adm"
+select element o
+from  DBLP as o
+where test."similarity-jaccard-check"(test."gram-tokens"(o.nested.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)[0]
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.sqlpp
new file mode 100644
index 0000000..cba627f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.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 similarity-jaccard function on 3-gram tokens.
+ *                  The index should be applied.
+ * Success        : Yes
+ */
+
+drop  database test if exists;
+create  database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+{
+  id : int32,
+  dblpid : 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:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-basic_ngram-jaccard.adm"
+select element o
+from  DBLP as o
+where (test."similarity-jaccard"(test."gram-tokens"(o.nested.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false)) >= 0.500000f)
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-contains.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-contains.sqlpp
new file mode 100644
index 0000000..37f3e39
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-contains.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    : Tests whether a keyword 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
+{
+  id : int32,
+  dblpid : string,
+  authors : string,
+  misc : string
+}
+
+create type test.DBLPType as
+ closed {
+  nested : DBLPTypetmp
+}
+
+create  table DBLP(DBLPType) primary key nested.id;
+
+create  index keyword_index  on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-contains.adm"
+select element o
+from  DBLP as o
+where test.contains(o.nested.title,'Multimedia')
+order by o.nested.id
+;