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-common;
3. ported parser tests, optimizer tests and runtime tests in asterix-app to their sql++ version, and added parser tests for all the queries.
Change-Id: Ie5af4e3b692ca017ec047a1ba3b404a51beb3a2e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/466
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/optimizerts/queries/skip-index/skip-ngram-index.aql b/asterix-app/src/test/resources/optimizerts/queries/skip-index/skip-ngram-index.aql
index f5f4dbf..0758ea0 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/skip-index/skip-ngram-index.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/skip-index/skip-ngram-index.aql
@@ -41,6 +41,6 @@
write output to nc1:"rttest/inverted-index-basic_ngram-contains.adm";
for $o in dataset('DBLP')
-where /*+ skip-index */ contains($o.title, "Multimedia")
+where /*+ skip-index */ test.contains($o.title, "Multimedia")
order by $o.id
return $o
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.sqlpp
new file mode 100644
index 0000000..674e149
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm"
+select element {'tweetid1':t1.tweetid,'count1':t1.countA,'t2info':(
+ select element {'tweetid2':t2.tweetid,'count2':t2.countB}
+ from TweetMessages as t2
+ where (t1.countA /*+ indexnl */ = t2.countB)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.sqlpp
new file mode 100644
index 0000000..46be922
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm"
+select element {'tweetid1':t1.tweetid,'count1':t1.countA,'t2info':(
+ select element {'tweetid2':t2.tweetid,'count2':t2.countB}
+ from TweetMessages as t2
+ where ((t1.countA /*+ indexnl */ = t2.countB) and (t1.tweetid != t2.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_01.sqlpp
new file mode 100644
index 0000000..7852d42
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_01.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ > emp2.fname) and (emp1.lname /*+ indexnl */ > emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_02.sqlpp
new file mode 100644
index 0000000..004c2c8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_02.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ < emp2.fname) and (emp1.lname /*+ indexnl */ < emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_03.sqlpp
new file mode 100644
index 0000000..759c9e4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-join_03.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ = emp2.fname) and (emp1.lname /*+ indexnl */ = emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.sqlpp
new file mode 100644
index 0000000..b6cedb7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ < emp2.fname) and (emp1.lname /*+ indexnl */ > emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.sqlpp
new file mode 100644
index 0000000..467a6c0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ > emp2.fname) and (emp1.lname /*+ indexnl */ < emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.sqlpp
new file mode 100644
index 0000000..0c6f6d3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ > emp2.fname) and (emp1.lname /*+ indexnl */ = emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.sqlpp
new file mode 100644
index 0000000..0bfa882
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_04.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ < emp2.fname) and (emp1.lname /*+ indexnl */ = emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.sqlpp
new file mode 100644
index 0000000..389feb8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_05.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ = emp2.fname) and (emp1.lname /*+ indexnl */ > emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.sqlpp
new file mode 100644
index 0000000..f4e741b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ fname : string,
+ lname : string
+}
+
+create table Names(Name) primary key fname,lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_06.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ = emp2.fname) and (emp1.lname /*+ indexnl */ < emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-multipred.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-multipred.sqlpp
new file mode 100644
index 0000000..4c57e9e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-multipred.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Equi joins two datasets, Customers and Orders, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * We expect the additional predicates to be put into a select above the
+ * primary index search.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.OrderType as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Orders(OrderType) primary key oid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join-multipred.adm"
+select element {'customer':c,'order':o}
+from Customers as c,
+ Orders as o
+where ((c.cid /*+ indexnl */ = o.cid) and (c.name < o.orderstatus) and (c.age < o.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-neg_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-neg_01.sqlpp
new file mode 100644
index 0000000..1806d5d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-neg_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 is a negative test, mis-spelt/incorrect HINT should result in
+ * a plan not using an indexed-nested loops join strategy. We expect a hash join.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join-neg_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key1 = y.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-neg_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-neg_02.sqlpp
new file mode 100644
index 0000000..551bd8b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join-neg_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 is a negative test, mis-spelt/incorrect HINT should result in
+ * a plan not using an indexed-nested loops join strategy. We expect a hash join.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join-neg_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key2 = y.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_01.sqlpp
new file mode 100644
index 0000000..4628891
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that hash-exchanges internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key1 /*+ indexnl */ = y.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_02.sqlpp
new file mode 100644
index 0000000..4022363
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that hash-exchanges internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key2 /*+ indexnl */ = y.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_03.sqlpp
new file mode 100644
index 0000000..0ce834c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_03.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Equi joins two datasets, Customers and Orders, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.OrderType as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Orders(OrderType) primary key oid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_04.adm"
+select element {'customer':c,'order':o}
+from Customers as c,
+ Orders as o
+where (c.cid /*+ indexnl */ = o.cid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_04.sqlpp
new file mode 100644
index 0000000..3e198aa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_04.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Equi joins two datasets, Customers and Orders, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.OrderType as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Orders(OrderType) primary key oid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_05.adm"
+select element {'customer':c,'order':o}
+from Orders as o,
+ Customers as c
+where (o.cid /*+ indexnl */ = c.cid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_05.sqlpp
new file mode 100644
index 0000000..3dbb8e3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-equi-join_05.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Self-equi joins a dataset, Customers, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create table Customers(CustomerType) primary key cid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_06.adm"
+select element {'customer1':c1,'customer2':c2}
+from Customers as c1,
+ Customers as c2
+where (c1.cid /*+ indexnl */ = c2.cid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-ge-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-ge-join_01.sqlpp
new file mode 100644
index 0000000..64f3c59
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-ge-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-ge-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key1 /*+ indexnl */ >= y.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-ge-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-ge-join_02.sqlpp
new file mode 100644
index 0000000..3c2e9f3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-ge-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-ge-join_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key2 /*+ indexnl */ <= y.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-gt-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-gt-join_01.sqlpp
new file mode 100644
index 0000000..e1e5ce2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-gt-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-gt-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key1 /*+ indexnl */ > y.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-gt-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-gt-join_02.sqlpp
new file mode 100644
index 0000000..49677d4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-gt-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-gt-join_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key2 /*+ indexnl */ < y.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-le-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-le-join_01.sqlpp
new file mode 100644
index 0000000..e22bed0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-le-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-le-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key1 /*+ indexnl */ <= y.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-le-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-le-join_02.sqlpp
new file mode 100644
index 0000000..8bcbcff
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-le-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-le-join_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key2 /*+ indexnl */ >= y.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-lt-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-lt-join_01.sqlpp
new file mode 100644
index 0000000..1e70a4d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-lt-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-lt-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key1 /*+ indexnl */ < y.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-lt-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-lt-join_02.sqlpp
new file mode 100644
index 0000000..0cd44d0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/primary-lt-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne’s primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestType as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create table test1.DsOne(TestType) primary key key1;
+
+create table test1.DsTwo(TestType) primary key key1;
+
+write output to nc1:"rttest/btree-index-join_primary-lt-join_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.key2 /*+ indexnl */ > y.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join-multiindex.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join-multiindex.sqlpp
new file mode 100644
index 0000000..c15319b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join-multiindex.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 : Equi joins two datasets, FacebookUsers and FacebookMessages, based on their user's id.
+ * We first expect FacebookUsers' primary index to be used
+ * to satisfy the range condition on it's primary key.
+ * FacebookMessages has a secondary btree index on author-id-copy, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.EmploymentType as
+ closed {
+ "organization-name" : string,
+ "start-date" : date,
+ "end-date" : date?
+}
+
+create type test.FacebookUserType as
+ closed {
+ id : int32,
+ "id-copy" : int32,
+ alias : string,
+ name : string,
+ "user-since" : datetime,
+ "user-since-copy" : datetime,
+ "friend-ids" : {{int32}},
+ employment : [EmploymentType]
+}
+
+create type test.FacebookMessageType as
+ closed {
+ "message-id" : int32,
+ "message-id-copy" : int32,
+ "author-id" : int32,
+ "author-id-copy" : int32,
+ "in-response-to" : int32?,
+ "sender-location" : point?,
+ message : string
+}
+
+create table FacebookUsers(FacebookUserType) primary key id;
+
+create table FacebookMessages(FacebookMessageType) primary key "message-id";
+
+create index fbmIdxAutId if not exists on FacebookMessages ("author-id-copy") type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multiindex.adm"
+select element {'fbu-ID':user.id,'fbm-auth-ID':message."author-id",'uname':user.name,'message':message.message}
+from FacebookUsers as user,
+ FacebookMessages as message
+where ((user.id /*+ indexnl */ = message."author-id-copy") and (user.id >= 11000) and (user.id <= 12000))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join-multipred.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join-multipred.sqlpp
new file mode 100644
index 0000000..93cac14
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join-multipred.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the additional predicates to be put into a select above the
+ * primary index search.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on DBLP (title) type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.title /*+ indexnl */ = b.title) and (a.authors < b.authors) and (a.misc > b.misc))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_01.sqlpp
new file mode 100644
index 0000000..28d1996
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_01.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on DBLP (title) type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_02.sqlpp
new file mode 100644
index 0000000..368d5de
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_02.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * CSX has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on CSX (title) type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_03.sqlpp
new file mode 100644
index 0000000..817f1e5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index-join/secondary-equi-join_03.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 : Equi self-joins a dataset, DBLP, based on its title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index title_index on DBLP (title) type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-01.sqlpp
new file mode 100644
index 0000000..390b32f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * : for an invocation of current-datetime()
+ * Expected Result : Success
+ * Date : 27th Aug 2015
+ * Author : Steven Jacobs
+ */
+
+drop database emergencyTest if exists;
+create database emergencyTest;
+
+use emergencyTest;
+
+
+create type emergencyTest.CHPReport as
+{
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+}
+
+create table CHPReports(CHPReport) primary key timestamp;
+
+select element emergency.message
+from CHPReports as emergency
+where ((emergency.timestamp >= (emergencyTest."current-datetime"() - emergencyTest."day-time-duration"('PT10H'))) and (emergency.title = 'ghost'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-02.sqlpp
new file mode 100644
index 0000000..0f3577a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-02.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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
+ * : for an invocation of current-datetime()
+ * Expected Result : Success
+ * Date : 27th Aug 2015
+ * Author : Steven Jacobs
+ */
+
+drop database emergencyTest if exists;
+create database emergencyTest;
+
+use emergencyTest;
+
+
+create type emergencyTest.CHPReport as
+{
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+}
+
+create table CHPReports(CHPReport) primary key timestamp;
+
+select element emergency
+from CHPReports as emergency
+with time as (emergencyTest."current-datetime"() - emergencyTest."day-time-duration"('PT10H'))
+where (emergency.timestamp >= time)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-03.sqlpp
new file mode 100644
index 0000000..ae94e7b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-03.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * : for an invocation of current-datetime()
+ * Expected Result : Success
+ * Date : 27th Aug 2015
+ * Author : Steven Jacobs
+ */
+
+drop database emergencyTest if exists;
+create database emergencyTest;
+
+use emergencyTest;
+
+
+create type emergencyTest.CHPReport as
+{
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+}
+
+create table CHPReports(CHPReport) primary key timestamp;
+
+select element emergency
+from CHPReports as emergency
+where (emergency.timestamp >= emergencyTest."current-datetime"())
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-04.sqlpp
new file mode 100644
index 0000000..16b0fc6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-datetime-04.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 makes sure that the plan is still okay when not converted to index search
+ * Expected Result : Success
+ * Date : 27th Aug 2015
+ * Author : Steven Jacobs
+ */
+
+drop database emergencyTest if exists;
+create database emergencyTest;
+
+use emergencyTest;
+
+
+create type emergencyTest.CHPReport as
+{
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+}
+
+create table CHPReports(CHPReport) primary key id;
+
+select element emergency
+from CHPReports as emergency
+where (emergency.timestamp >= emergencyTest."current-datetime"())
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-01.sqlpp
new file mode 100644
index 0000000..ac242c9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-01.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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-01.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.fname > 'Roger')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-02.sqlpp
new file mode 100644
index 0000000..078fbfc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-02.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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-02.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.fname >= 'Susan')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-03.sqlpp
new file mode 100644
index 0000000..70ebdf5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-03.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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-03.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.fname < 'Isa')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-04.sqlpp
new file mode 100644
index 0000000..d0938fd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-04.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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-04.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.fname <= 'Vanpatten')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-05.sqlpp
new file mode 100644
index 0000000..5efab34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-05.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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 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-05.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.fname != 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-06.sqlpp
new file mode 100644
index 0000000..47aae4e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-06.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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-06.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.fname = 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-07.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-07.sqlpp
new file mode 100644
index 0000000..dcfdcc6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-07.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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 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-07.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where (emp.lname = 'Kim')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-08.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-08.sqlpp
new file mode 100644
index 0000000..c205a75
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-08.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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-08.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Young Seok') and (emp.lname = 'Kim'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-09.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-09.sqlpp
new file mode 100644
index 0000000..2a1bbe2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-09.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 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-09.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') or (emp.lname = 'Malaika'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-10.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-10.sqlpp
new file mode 100644
index 0000000..7194424
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-10.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 primary 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-10.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Alex') and (emp.lname < 'Zach'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-11.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-11.sqlpp
new file mode 100644
index 0000000..764a57e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-11.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 for predicates.
+ * 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-11.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Allan') and (emp.lname < 'Zubi'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-12.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-12.sqlpp
new file mode 100644
index 0000000..0e000ca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-12.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 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-12.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Allan') and (emp.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-13.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-13.sqlpp
new file mode 100644
index 0000000..31002c8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-13.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-13.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') and (emp.lname < 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-14.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-14.sqlpp
new file mode 100644
index 0000000..d5c0fab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-14.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-14.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Michael') and (emp.lname <= 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-15.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-15.sqlpp
new file mode 100644
index 0000000..6fb032c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-15.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-15.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-16.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-16.sqlpp
new file mode 100644
index 0000000..f229494
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-16.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-16.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname >= 'Kevin') and (emp.fname <= 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-17.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-17.sqlpp
new file mode 100644
index 0000000..cea3c05
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-17.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-17.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname <= 'Craig') and (emp.lname > 'Kevin'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-18.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-18.sqlpp
new file mode 100644
index 0000000..9269f32
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-18.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 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-18.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname != 'Michael') and (emp.lname != 'Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-19.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-19.sqlpp
new file mode 100644
index 0000000..7a70c2a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-19.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-19.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname <= 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-20.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-20.sqlpp
new file mode 100644
index 0000000..23b158c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-20.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-20.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname >= 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-21.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-21.sqlpp
new file mode 100644
index 0000000..c9de7fb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-21.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-21.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname;
+
+select element emp
+from testdst as emp
+where (emp.fname > 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-22.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-22.sqlpp
new file mode 100644
index 0000000..c290924
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-22.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-22.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname;
+
+select element emp
+from testdst as emp
+where (emp.fname >= 'Sofia')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-23.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-23.sqlpp
new file mode 100644
index 0000000..94366d8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-23.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-23.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname;
+
+select element emp
+from testdst as emp
+where (emp.fname < 'Chen')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-24.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-24.sqlpp
new file mode 100644
index 0000000..7f68270
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-24.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-24.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname;
+
+select element emp
+from testdst as emp
+where (emp.fname <= 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-25.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-25.sqlpp
new file mode 100644
index 0000000..17bfe7b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-25.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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-25.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Neil') and (emp.fname < 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-26.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-26.sqlpp
new file mode 100644
index 0000000..4414710
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-26.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Max') and (emp.fname <= 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-27.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-27.sqlpp
new file mode 100644
index 0000000..1f5b044
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-27.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname <= 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-28.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-28.sqlpp
new file mode 100644
index 0000000..cfdd0f8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-28.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname < 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-29.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-29.sqlpp
new file mode 100644
index 0000000..1653fb8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-29.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname >= 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-30.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-30.sqlpp
new file mode 100644
index 0000000..ab70312
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-30.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname > 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-31.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-31.sqlpp
new file mode 100644
index 0000000..1f5341e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-31.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') and (emp.lname > 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-32.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-32.sqlpp
new file mode 100644
index 0000000..c579348
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-primary-32.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname < 'Julio') and (emp.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-33.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-33.sqlpp
new file mode 100644
index 0000000..1d588af
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-33.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-primary-33.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname > 'Roger')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-34.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-34.sqlpp
new file mode 100644
index 0000000..7db2833
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-34.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-34.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname >= 'Susan')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-35.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-35.sqlpp
new file mode 100644
index 0000000..ae7992f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-35.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-35.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname < 'Isa')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-36.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-36.sqlpp
new file mode 100644
index 0000000..bdd6630
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-36.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname <= 'Vanpatten')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-37.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-37.sqlpp
new file mode 100644
index 0000000..5dd5c02
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-37.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname != 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-38.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-38.sqlpp
new file mode 100644
index 0000000..20a4907
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-38.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname = 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-39.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-39.sqlpp
new file mode 100644
index 0000000..f6cea67
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-39.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.lname = 'Kim')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-40.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-40.sqlpp
new file mode 100644
index 0000000..a4ce4f9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-40.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Young Seok') and (emp.lname = 'Kim'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-41.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-41.sqlpp
new file mode 100644
index 0000000..26a412c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-41.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') or (emp.lname = 'Malaika'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-42.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-42.sqlpp
new file mode 100644
index 0000000..3242469
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-42.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-42.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Alex') and (emp.lname < 'Zach'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-43.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-43.sqlpp
new file mode 100644
index 0000000..88ca141
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-43.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-43.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Allan') and (emp.lname < 'Zubi'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-44.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-44.sqlpp
new file mode 100644
index 0000000..79a8c6b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-44.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-44.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Allan') and (emp.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-45.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-45.sqlpp
new file mode 100644
index 0000000..6b04a6c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-45.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') and (emp.lname < 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-46.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-46.sqlpp
new file mode 100644
index 0000000..17894da
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-46.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Michael') and (emp.lname <= 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-47.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-47.sqlpp
new file mode 100644
index 0000000..05f0eb0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-47.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-47.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-48.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-48.sqlpp
new file mode 100644
index 0000000..0d740e6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-48.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-48.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname >= 'Kevin') and (emp.fname <= 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-49.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-49.sqlpp
new file mode 100644
index 0000000..afd739f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-49.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname <= 'Craig') and (emp.lname > 'Kevin'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-50.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-50.sqlpp
new file mode 100644
index 0000000..a641886
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-50.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-50.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname != 'Michael') and (emp.lname != 'Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-51.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-51.sqlpp
new file mode 100644
index 0000000..48b4d8f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-51.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname <= 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-52.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-52.sqlpp
new file mode 100644
index 0000000..4b2f5df
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-52.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-52.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname >= 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-53.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-53.sqlpp
new file mode 100644
index 0000000..8d1ec8a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-53.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-53.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname <= 'Kevin') and (emp.fname <= 'Mary') and (emp.lname >= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-54.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-54.sqlpp
new file mode 100644
index 0000000..3f0ba33
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-54.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname > 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-55.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-55.sqlpp
new file mode 100644
index 0000000..fdf8e02
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-55.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname >= 'Sofia')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-56.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-56.sqlpp
new file mode 100644
index 0000000..d7e6482
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-56.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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-56.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname < 'Chen')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-57.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-57.sqlpp
new file mode 100644
index 0000000..e664250
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-57.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname <= 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-58.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-58.sqlpp
new file mode 100644
index 0000000..cafa0c8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-58.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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-58.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Neil') and (emp.fname < 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-59.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-59.sqlpp
new file mode 100644
index 0000000..9f316b3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-59.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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-59.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Max') and (emp.fname <= 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-60.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-60.sqlpp
new file mode 100644
index 0000000..2636b3c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-60.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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-60.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where (emp.fname = 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-61.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-61.sqlpp
new file mode 100644
index 0000000..499b9ff
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-61.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname <= 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-62.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-62.sqlpp
new file mode 100644
index 0000000..45ef71b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-62.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') and (emp.lname > 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-63.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-63.sqlpp
new file mode 100644
index 0000000..b172a39
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/btree-index/btree-secondary-63.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname,lname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname < 'Julio') and (emp.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/collocated.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/collocated.sqlpp
new file mode 100644
index 0000000..ee85e93
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/collocated.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+drop database colocated if exists;
+create database colocated;
+
+use colocated;
+
+
+create type colocated.UserType as
+{
+ uid : int32,
+ name : string,
+ lottery_numbers : {{int32}}
+}
+
+create type colocated.VisitorType as
+{
+ vid : int32,
+ name : string,
+ lottery_numbers : {{int32}}
+}
+
+create table Users(UserType) primary key uid;
+
+create table Visitors(VisitorType) primary key vid;
+
+write output to nc1:"/tmp/fuzzy1.adm"
+select element {'user_name':user.name,'visitor_name':visitor.name}
+from Users as user,
+ Visitors as visitor
+where (user.uid = visitor.vid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/consolidate-selects-complex.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/consolidate-selects-complex.sqlpp
new file mode 100644
index 0000000..2580817
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/consolidate-selects-complex.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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table DBLP(DBLPType) primary key id on group1;
+
+load table DBLP using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted;
+
+write output to nc1:"rttest/consolidate-complex-selects.aql"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."word-tokens"(paper.title),
+ query_tokens as test."word-tokens"('Transactions for Cooperative Environments'),
+ jacca as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.800000f),
+ jaccb as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.500000f),
+ jaccc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.300000f)
+where (jacca[0] and jaccb[0] and (paper.authors = 'testauth') and jaccc)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/consolidate-selects-simple.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/consolidate-selects-simple.sqlpp
new file mode 100644
index 0000000..e034b8c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/consolidate-selects-simple.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+write output to nc1:"rttest/consolidate-selects-simple.aql"
+select element c
+from Customers as c
+where ((c.c_name = 'testname') and (c.c_address = 'testaddr') and (c.c_nationkey = 1) and (c.c_phone = '123456789'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/const-folding.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/const-folding.sqlpp
new file mode 100644
index 0000000..f742174
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/const-folding.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/divide.adm"
+{'a':(1 + 2),'b':['foo','bar'][0]}.b;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp
new file mode 100644
index 0000000..04a3b15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+drop database twitter if exists;
+create database twitter;
+
+use twitter;
+
+
+create type twitter.Tweet as
+{
+ id : int32,
+ tweetid : int64,
+ loc : point,
+ time : datetime,
+ text : string
+}
+
+create external table TwitterData(Tweet) using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter"(("path"="nc1://data/twitter/smalltweets.txt"),("format"="adm"));
+
+write output to nc1:"/tmp/count-tweets.adm"
+select element {'word':tok,'count':twitter.count(token)}
+from TwitterData as t,
+ tokens as token
+with tokens as twitter."word-tokens"(t.text)
+group by token as tok
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/cust_group_no_agg.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/cust_group_no_agg.sqlpp
new file mode 100644
index 0000000..bef6677
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/cust_group_no_agg.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+drop database group_no_agg if exists;
+create database group_no_agg;
+
+use group_no_agg;
+
+
+create type group_no_agg.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+write output to nc1:"/tmp/.adm"
+select element name
+from Customers as c
+group by c.c_name as name
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp
new file mode 100644
index 0000000..0bcdfaa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+drop database custorder if exists;
+create database custorder;
+
+use custorder;
+
+
+create type custorder.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type custorder.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type custorder.OrderType as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Customers(CustomerType) primary key cid on group1;
+
+create table Orders(OrderType) primary key oid on group1;
+
+write output to nc1:"/tmp/custorder.adm"
+select element {'cid':cid,'cust':cust,'cnt-orders':custorder.count(o),'orders':o}
+from Customers as c,
+ Orders as o
+where (c.cid = o.cid)
+group by c.cid as cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-1.sqlpp
new file mode 100644
index 0000000..421975b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-1.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TestType as
+{
+ id : string,
+ idx : string,
+ "no-idx" : string
+}
+
+create table TestSet(TestType) primary key id;
+
+create index TestSetIndex on TestSet (idx) type btree;
+
+delete x from TestSet
+ where ((x.id = 'one') or (x.id = 'two'));
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-2.sqlpp
new file mode 100644
index 0000000..f6407be
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-2.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TestType as
+{
+ id : string,
+ idx : string,
+ "no-idx" : string
+}
+
+create table TestSet(TestType) primary key id;
+
+create index TestSetIndex on TestSet (idx) type btree;
+
+delete x from TestSet
+ where ((x.idx = 'one') or (x.idx = 'two'));
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-3.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-3.sqlpp
new file mode 100644
index 0000000..e7185e8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/disjunction-to-join-delete-3.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TestType as
+{
+ id : string,
+ idx : string,
+ "no-idx" : string
+}
+
+create table TestSet(TestType) primary key id;
+
+create index TestSetIndex on TestSet (idx) type btree;
+
+delete x from TestSet
+ where ((x."no-idx" = 'one') or (x."no-idx" = 'two'));
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp
new file mode 100644
index 0000000..22df976
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems_q1(LineItemType) primary key l_orderkey,l_linenumber on group1;
+
+write output to nc1:"rttest/tpch_q1_pricing_summary_report_nt.adm"
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_suppkey':tpch.count(g)}
+from (
+ select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'l_suppkey':l_suppkey}
+ from LineItems_q1 as l
+ where (l.l_shipdate <= '1998-09-02')
+ group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus,l.l_suppkey as l_suppkey
+) as g
+group by g.l_returnflag as l_returnflag,g.l_linestatus as l_linestatus
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/filter-nested.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/filter-nested.sqlpp
new file mode 100644
index 0000000..d9de921
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/filter-nested.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/filter-nested.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 with filter on nested.lname;
+
+select element emp.nested
+from testdst as emp
+where (emp.nested.lname > 'Roger')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-dblp-csx.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-dblp-csx.sqlpp
new file mode 100644
index 0000000..fc899bc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-dblp-csx.sqlpp
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+drop database "fj-dblp-csx" if exists;
+create database "fj-dblp-csx";
+
+use "fj-dblp-csx";
+
+
+create type "fj-dblp-csx".DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type "fj-dblp-csx".CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table DBLP(DBLPType) primary key id on group1;
+
+create table CSX(CSXType) primary key id on group1;
+
+write output to nc1:"rttest/fj-dblp-csx.adm"
+select element {'idDBLP':idDBLP,'idCSX':idCSX}
+from DBLP as paperDBLP,
+ tokensDBLP as prefixTokenDBLP,
+ CSX as paperCSX,
+ tokensCSX as prefixTokenCSX
+with idDBLP as paperDBLP.id,
+ unrankedTokensDBLP as "fj-dblp-csx"."counthashed-word-tokens"(paperDBLP.title),
+ tokensDBLP as (
+ select element i
+ from unrankedTokensDBLP as token,
+ (
+ select element paper.title
+ from DBLP as paper
+ ) as tokenRanked at i
+ where (token = tokenRanked)
+ order by i
+ ),
+ idCSX as paperCSX.id,
+ unrankedTokensCSX as "fj-dblp-csx"."counthashed-word-tokens"(paperCSX.title),
+ tokensCSX as (
+ select element i
+ from unrankedTokensCSX as token,
+ (
+ select element paper.title
+ from DBLP as paper
+ ) as tokenRanked at i
+ where (token = tokenRanked)
+ order by i
+ )
+where (prefixTokenDBLP = prefixTokenCSX)
+group by idDBLP as idDBLP,idCSX as idCSX
+order by idDBLP,idCSX
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp
new file mode 100644
index 0000000..2b832ec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+drop database rares03 if exists;
+create database rares03;
+
+use rares03;
+
+
+create type rares03.UserType as
+{
+ uid : int32,
+ name : string,
+ lottery_numbers : {{int32}}
+}
+
+create type rares03.VisitorType as
+{
+ vid : int32,
+ name : string,
+ lottery_numbers : {{int32}}
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Users(UserType) primary key uid on group1;
+
+create table Visitors(VisitorType) primary key vid on group1;
+
+write output to nc1:"/tmp/rares03.adm"
+select element {'uid':user.uid,'tokens':tokens}
+from Users as user
+with tokens as (
+ select element i
+ from user.lottery_numbers as lottery_number,
+ (
+ select element item
+ from Users as user,
+ user.lottery_numbers as lottery_number
+ group by lottery_number as item
+ with count as rares03.count(user)
+ order by count desc
+ ) as token at i
+ where (lottery_number = token)
+ order by token
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp
new file mode 100644
index 0000000..96abac0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+drop database fuzzyjoin_078 if exists;
+create database fuzzyjoin_078;
+
+use fuzzyjoin_078;
+
+
+create type fuzzyjoin_078.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table DBLP_fuzzyjoin_078(DBLPType) primary key id on group1;
+
+write output to nc1:"rttest/fuzzyjoin_078.adm"
+select element {'id':paperDBLP.id,'tokens':tokensDBLP}
+from DBLP_fuzzyjoin_078 as paperDBLP
+with unrankedTokensDBLP as fuzzyjoin_078."counthashed-word-tokens"(paperDBLP.title),
+ tokensDBLP as (
+ select element i
+ from unrankedTokensDBLP as token,
+ (
+ select element tokenGroupped
+ from DBLP_fuzzyjoin_078 as paper,
+ fuzzyjoin_078."counthashed-word-tokens"(paper.title) as token
+ /* +hash */
+ group by token as tokenGroupped
+ order by fuzzyjoin_078.count(paper),tokenGroupped
+ ) as tokenRanked at i
+ where (token = tokenRanked)
+ order by i
+ )
+order by paperDBLP.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/hashjoin-with-unnest.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/hashjoin-with-unnest.sqlpp
new file mode 100644
index 0000000..b2b64fb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/hashjoin-with-unnest.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 that non-datascan unnests are pushed through join and
+ * : the query plan is rewritten as hybrid hash join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TestType as
+{
+ id : int32,
+ name : string
+}
+
+create table t1(TestType) primary key id;
+
+create table t2(TestType) primary key id;
+
+write output to nc1:"rttest/hahsjoin-with-unnest.adm"
+select element {'t1':m,'t2':n}
+from t1 as m,
+ t2 as n,
+ m.hobbies as a,
+ n.hobbies as b
+where (a = b)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inline-funs.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inline-funs.sqlpp
new file mode 100644
index 0000000..d815ea6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inline-funs.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"/tmp/inline_funs.adm"
+declare function f1() {
+(1 + test.f2())
+};
+declare function f2() {
+(2 + test.f3() + test.f3() + test.f3() + test.f4())
+};
+declare function f3() {
+(0 - 1)
+};
+declare function f4() {
+1001
+};
+select element test.f1();
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp
new file mode 100644
index 0000000..a402585
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+drop database inlined_q18_large_volume_customer if exists;
+create database inlined_q18_large_volume_customer;
+
+use inlined_q18_large_volume_customer;
+
+
+create type inlined_q18_large_volume_customer.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type inlined_q18_large_volume_customer.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type inlined_q18_large_volume_customer.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems(LineItemType) primary key l_orderkey,l_linenumber on group1;
+
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+write output to nc1:"/tmp/inlined_q18_large_volume_customer.adm"
+select element {'c_name':c_name,'c_custkey':c_custkey,'o_orderkey':o_orderkey,'o_orderdate':o_orderdate,'o_totalprice':o_totalprice,'sum_quantity':inlined_q18_large_volume_customer.sum((
+ select element j.l_quantity
+ from l as j
+ ))}
+from Customers as c,
+ Orders as o,
+ (
+ select element {'l_orderkey':l_orderkey,'t_sum_quantity':inlined_q18_large_volume_customer.sum((
+ select element i.l_quantity
+ from l as i
+ ))}
+ from LineItems as l
+ group by l.l_orderkey as l_orderkey
+) as t,
+ LineItems as l
+where ((c.c_custkey = o.o_custkey) and ((o.o_orderkey = t.l_orderkey) and (t.t_sum_quantity > 300)) and (l.l_orderkey = o.o_orderkey))
+group by c.c_name as c_name,c.c_custkey as c_custkey,o.o_orderkey as o_orderkey,o.o_orderdate as o_orderdate,o.o_totalprice as o_totalprice
+order by o_totalprice desc,o_orderdate
+limit 100
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-dataset-with-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-dataset-with-index.sqlpp
new file mode 100644
index 0000000..f98e6b3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-dataset-with-index.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+/*
+ * Test case Name : insert-and-scan-dataset-with-index.aql
+ * Description : This test is intended to test inserting into a dataset that has a secondary index and scan
+ * the data at the same time where we insert a materializing to prevent the possibility of deadlatch.
+ * Expected Result : Success
+ * Date : July 11 2013
+ */
+
+drop database test if exists;
+create database test;
+
+create type test.Emp as
+ closed {
+ id : int32,
+ fname : string,
+ lname : string,
+ age : int32,
+ dept : string
+}
+
+create table test.employee(Emp) primary key id;
+
+create index idx_employee_first_name on test.employee (fname) type btree;
+
+insert into test.employee
+select element {'id':(x.id + 10000),'fname':x.fname,'lname':x.lname,'age':x.age,'dept':x.dept}
+from "test.employee" as x
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-dataset.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-dataset.sqlpp
new file mode 100644
index 0000000..c01c825
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-dataset.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+/*
+ * Test case Name : insert-and-scan-dataset.aql
+ * Description : This test is intended to test inserting into a dataset and scan it at the same time
+ * where we insert a materializing to prevent the possibility of deadlatch.
+ * Expected Result : Success
+ * Date : July 11 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.myDataType as
+{
+ id : int32
+}
+
+create table myData(myDataType) primary key id;
+
+insert into myData
+select element {'id':(x.id + 1)}
+from myData as x
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-joined-datasets.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-joined-datasets.sqlpp
new file mode 100644
index 0000000..b8f7f33
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/insert-and-scan-joined-datasets.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+/*
+ * Test case Name : insert-and-scan-joined-datasets.aql
+ * Description : This test is intended to test inserting into a dataset where the incoming stream
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.myDataType as
+{
+ id : int32
+}
+
+create table myData(myDataType) primary key id;
+
+create table myData2(myDataType) primary key id;
+
+insert into myData
+select element {'id':(x.id + 1)}
+from myData2 as x,
+ myData as y
+where (x.id = y.id)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/introhashpartitionmerge.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/introhashpartitionmerge.sqlpp
new file mode 100644
index 0000000..b3aa493
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/introhashpartitionmerge.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+drop database fuzzyjoin if exists;
+create database fuzzyjoin;
+
+use fuzzyjoin;
+
+
+create type fuzzyjoin.TOKENSRANKEDADMType as
+ closed {
+ token : int32,
+ rank : int32
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table TOKENSRANKEDADM(TOKENSRANKEDADMType) primary key rank on group1;
+
+write output to nc1:"rttest/introhashpartitionmerge.adm"
+select element token2.rank
+from TOKENSRANKEDADM as token1,
+ (
+ select element tokenRanked
+ from TOKENSRANKEDADM as tokenRanked
+ order by tokenRanked.rank
+) as token2
+where (token1.token = token2.token)
+order by token2.rank
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-contains-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-contains-panic.sqlpp
new file mode 100644
index 0000000..6146565
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-contains-panic.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.title,'Mu')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-contains.sqlpp
new file mode 100644
index 0000000..ed755be
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-contains.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-basic_ngram-contains.adm"
+select element o
+from DBLP as o
+where test.contains(o.title,'Multimedia')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
new file mode 100644
index 0000000..be87443
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+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.authors,'Amihay Motro',5)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-check.sqlpp
new file mode 100644
index 0000000..3d39e56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-check.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+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.authors,'Amihay Motro',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-panic.sqlpp
new file mode 100644
index 0000000..6c4993a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance-panic.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+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.authors,'Amihay Motro') <= 5)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance.sqlpp
new file mode 100644
index 0000000..dfa9dc7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-edit-distance.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-basic_ngram-edit-distance.adm"
+select element o
+from DBLP as o
+where (test."edit-distance"(o.authors,'Amihay Motro') <= 1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..49564bc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-fuzzyeq-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 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+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.authors ~= 'Amihay Motro')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..0fa1bd5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-fuzzyeq-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 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+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.title,3,false) ~= test."gram-tokens"('Transactions for Cooperative Environments',3,false))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-jaccard-check.sqlpp
new file mode 100644
index 0000000..b39d0f7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-jaccard-check.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 : 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+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.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-jaccard.sqlpp
new file mode 100644
index 0000000..1c28b11
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ngram-jaccard.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 : 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+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.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false)) >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.sqlpp
new file mode 100644
index 0000000..859f585
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 edit-distance-check function on lists.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-check-panic.adm"
+select element c
+from Customers as c
+where test."edit-distance-check"(c.interests,['computers','wine','walking'],3)[0]
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-check.sqlpp
new file mode 100644
index 0000000..992933f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-check.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 edit-distance-check function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-check.adm"
+select element c
+from Customers as c
+where test."edit-distance-check"(c.interests,['computers','wine','walking'],1)[0]
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-panic.sqlpp
new file mode 100644
index 0000000..3397de8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance-panic.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 edit-distance function on lists.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-panic.adm"
+select element c
+from Customers as c
+where (test."edit-distance"(c.interests,['computers','wine','walking']) <= 3)
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance.sqlpp
new file mode 100644
index 0000000..4f835d1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-edit-distance.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 edit-distance function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance.adm"
+select element c
+from Customers as c
+where (test."edit-distance"(c.interests,['computers','wine','walking']) <= 1)
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..af22885
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 with ~= using edit-distance on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-fuzzyeq-edit-distance.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "1";
+
+select element c
+from Customers as c
+where (c.interests ~= ['computers','wine','walking'])
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..40df5f9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 is applied to optimize a selection query with ~= using Jaccard on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.8f";
+
+select element c
+from Customers as c
+where (c.interests ~= ['databases','computers','wine'])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-jaccard-check.sqlpp
new file mode 100644
index 0000000..b30a924
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-jaccard-check.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 similarity-jaccard-check function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-jaccard-check.adm"
+select element c
+from Customers as c
+where test."similarity-jaccard-check"(c.interests,['databases','computers','wine'],0.700000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-jaccard.sqlpp
new file mode 100644
index 0000000..635face
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/olist-jaccard.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 similarity-jaccard function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-jaccard.adm"
+select element c
+from Customers as c
+where (test."similarity-jaccard"(c.interests,['databases','computers','wine']) >= 0.700000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..f56d978
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 is applied to optimize a selection query with ~= using Jaccard on sets.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_ulist-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.8f";
+
+select element c
+from Customers as c
+where (c.interests ~= {{'computers','wine','databases'}})
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-jaccard-check.sqlpp
new file mode 100644
index 0000000..266b18a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-jaccard-check.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 similarity-jaccard-check function on sets.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_ulist-jaccard.adm"
+select element c
+from Customers as c
+where test."similarity-jaccard-check"(c.interests,{{'computers','wine','databases'}},0.700000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-jaccard.sqlpp
new file mode 100644
index 0000000..1e3c845
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/ulist-jaccard.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 similarity-jaccard function on sets.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_ulist-jaccard.adm"
+select element c
+from Customers as c
+where (test."similarity-jaccard"(c.interests,{{'computers','databases','wine'}}) >= 0.700000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-contains.sqlpp
new file mode 100644
index 0000000..41f8234
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-contains.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-contains.adm"
+select element o
+from DBLP as o
+where test.contains(o.title,'Multimedia')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..5ff613d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.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 a keyword is applied to optimize a selection query with ~= using Jaccard on word tokens.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element o
+from DBLP as o
+where (test."word-tokens"(o.title) ~= test."word-tokens"('Transactions for Cooperative Environments'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-jaccard-check.sqlpp
new file mode 100644
index 0000000..7317c59
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-jaccard-check.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 similarity-jaccard-check function on word tokens.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard-check.adm"
+select element o
+from DBLP as o
+where test."similarity-jaccard-check"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-jaccard.sqlpp
new file mode 100644
index 0000000..faee18b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-basic/word-jaccard.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 similarity-jaccard function on word tokens.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard.adm"
+select element o
+from DBLP as o
+where (test."similarity-jaccard"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments')) >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp
new file mode 100644
index 0000000..754e614
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.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
+ * two edit-distance-check function of which only the first can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with eda as test."edit-distance-check"(o.authors,'Amihay Motro',3),
+ edb as test."edit-distance-check"(o.authors,'Amihay Motro',5)
+where (eda[0] and edb[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp
new file mode 100644
index 0000000..dacf18b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.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
+ * two edit-distance-check function of which only the second can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with edb as test."edit-distance-check"(o.authors,'Amihay Motro',5),
+ eda as test."edit-distance-check"(o.authors,'Amihay Motro',3)
+where (edb[0] and eda[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp
new file mode 100644
index 0000000..31b1e23
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.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 : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm"
+select element o
+from DBLP as o
+with ed as test."edit-distance-check"(o.authors,'Amihay Motro',5)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.sqlpp
new file mode 100644
index 0000000..61925e7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.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 : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let.adm"
+select element o
+from DBLP as o
+with ed as test."edit-distance-check"(o.authors,'Amihay Motro',1)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp
new file mode 100644
index 0000000..cddd14c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 index is applied to optimize a selection query using the similarity-edit-distance-check function on the substring of the field.
+ * Tests that the optimizer rule correctly drills through the substring function.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm"
+select element {'id':paper.id,'title':paper.title}
+from DBLP as paper
+where test."edit-distance-check"(test.substring(paper.title,0,8),'datbase',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp
new file mode 100644
index 0000000..72dbd3b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.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 : Tests whether an ngram_index index is applied to optimize a selection query using the similarity-edit-distance-check function on individual word tokens.
+ * Tests that the optimizer rule correctly drills through the word-tokens function and existential query.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-word-tokens.adm"
+select element {'id':paper.id,'title':paper.title}
+from DBLP as paper,
+ test."word-tokens"(paper.title) as word
+where test."edit-distance-check"(word,'Multmedia',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..32ebdc6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-jaccard-check-let.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 similarity-jaccard-check function on 3-gram tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."gram-tokens"(o.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..f5886b3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."gram-tokens"(paper.title,3,false),
+ query_tokens as test."gram-tokens"('Transactions for Cooperative Environments',3,false),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.sqlpp
new file mode 100644
index 0000000..4be9f47
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_olist-edit-distance-check-let-panic.adm"
+select element c
+from Customers as c
+with ed as test."edit-distance-check"(c.interests,['computers','wine','walking'],3)
+where ed[0]
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-edit-distance-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-edit-distance-check-let.sqlpp
new file mode 100644
index 0000000..f6c4ba1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-edit-distance-check-let.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_olist-edit-distance-check-let.adm"
+select element c
+from Customers as c
+with ed as test."edit-distance-check"(c.interests,['computers','wine','walking'],1)
+where ed[0]
+order by c.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..5dbb332
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/olist-jaccard-check-let.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 similarity-jaccard-check function on lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_olist-jaccard-check-let.adm"
+select element c
+from Customers as c
+with jacc as test."similarity-jaccard-check"(c.interests,['databases','computers','wine'],0.700000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ulist-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ulist-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..05eaf9b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/ulist-jaccard-check-let.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 similarity-jaccard-check function on lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_ulist-jaccard-check-let.adm"
+select element c
+from Customers as c
+with jacc as test."similarity-jaccard-check"(c.interests,['databases','computers','wine'],0.700000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/word-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/word-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..9458c4c4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/word-jaccard-check-let.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 : Tests whether a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..a1e3a82
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.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 a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."word-tokens"(paper.title),
+ query_tokens as test."word-tokens"('Transactions for Cooperative Environments'),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.800000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.sqlpp
new file mode 100644
index 0000000..7f1951e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-edit-distance-inline.adm"
+select element {'aauthors':a.authors,'bauthors':b.authors,'ed':ed}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance"(a.authors,b.authors)
+where ((ed < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.sqlpp
new file mode 100644
index 0000000..82492f0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-edit-distance.adm"
+select element {'aauthors':a.authors,'bauthors':b.authors}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..e6d57c1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-edit-distance.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'aauthors':a.authors,'bauthors':b.authors}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..6a4e7b4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'atitle':a.title,'btitle':b.title}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.sqlpp
new file mode 100644
index 0000000..4bdcb05
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-jaccard-inline.adm"
+select element {'atitle':a.title,'btitle':b.title,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false))
+where ((jacc >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.sqlpp
new file mode 100644
index 0000000..0981ab2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-jaccard.adm"
+select element {'atitle':a.title,'btitle':b.title}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp
new file mode 100644
index 0000000..456eba1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the edit-distance function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-edit-distance-inline.adm"
+select element {'ainterests':a.interests,'binterests':b.interests,'ed':ed}
+from Customers as a,
+ Customers as b
+with ed as test."edit-distance"(a.interests,b.interests)
+where ((ed <= 2) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.sqlpp
new file mode 100644
index 0000000..89a9f07
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-edit-distance.adm"
+select element {'ainterests':a.interests,'binterests':b.interests}
+from Customers as a,
+ Customers2 as b
+where ((test."edit-distance"(a.interests,b.interests) <= 2) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..16ddaf7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using edit distance of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-fuzzyeq-edit-distance.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'ainterests':a.interests,'binterests':b.interests}
+from Customers as a,
+ Customers2 as b
+where ((a.interests ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..d5f9ad8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'ainterests':a.interests,'binterests':b.interests}
+from Customers as a,
+ Customers2 as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.sqlpp
new file mode 100644
index 0000000..ba1f784
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-jaccard-inline.adm"
+select element {'ainterests':a.interests,'binterests':b.interests,'jacc':jacc}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests)
+where ((jacc >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.sqlpp
new file mode 100644
index 0000000..c600a84
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-jaccard.adm"
+select element {'ainterests':a.interests,'binterests':b.interests}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..5039c74
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ulist-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'ainterests':a.interests,'binterests':b.interests}
+from Customers as a,
+ Customers2 as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.sqlpp
new file mode 100644
index 0000000..5046dcf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ulist-jaccard-inline.adm"
+select element {'ainterests':a.interests,'binterests':b.interests,'jacc':jacc}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests)
+where ((jacc >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.sqlpp
new file mode 100644
index 0000000..c8c310b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ulist-jaccard.adm"
+select element {'ainterests':a.interests,'binterests':b.interests}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..dc298c0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_word-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'atitle':a.title,'btitle':b.title}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.sqlpp
new file mode 100644
index 0000000..318b202
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_word-jaccard-inline.adm"
+select element {'atitle':a.title,'btitle':b.title,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title))
+where ((jacc >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-jaccard.sqlpp
new file mode 100644
index 0000000..1f07f4a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join-noeqjoin/word-jaccard.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_word-jaccard.adm"
+select element {'atitle':a.title,'btitle':b.title}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/issue741.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/issue741.sqlpp
new file mode 100644
index 0000000..f3ba2ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/issue741.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Test that left-outer-join may use an available inverted index in index subtree.
+ * Issue : 741
+ * Expected Res : Success
+ * Date : 16th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+{
+ screen_name : string,
+ lang : string,
+ friends_count : int32,
+ statuses_count : int32,
+ name : string,
+ followers_count : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ sender_location : point?,
+ send_time : datetime,
+ referred_topics : {{string}},
+ message_text : string
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index topicIIx on TweetMessages (referred_topics) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_issue741.adm"
+select element {'tweet':t.tweetid,'similar-tweets':(
+ select element t2.tweetid
+ from TweetMessages as t2
+ with sim as test."similarity-jaccard-check"(t.referred_topics,t2.referred_topics,0.600000f)
+ where (sim[0] and (t2.tweetid != t.tweetid))
+ )}
+from TweetMessages as t
+where ((t.send_time >= test.datetime('2011-06-18T14:10:17')) and (t.send_time < test.datetime('2011-06-18T15:10:17')))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
new file mode 100644
index 0000000..d29180d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
@@ -0,0 +1,79 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgKeywordIx on TweetMessages ("message-text") type keyword;
+
+create index msgNgramIx on TweetMessages ("message-text") type ngram (3);
+
+create index topicKeywordIx on TweetMessages ("referred-topics") type keyword;
+
+write output to nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm"
+select element {'tweet':{'id':t1.tweetid,'topics':t1."message-text"},'similar-tweets':(
+ select element {'id':t2.tweetid,'topics':t2."message-text"}
+ from TweetMessages as t2
+ with sim as test."edit-distance-check"(t1."message-text",t2."message-text",7)
+ where (sim[0] and (t2.tweetid != t1.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid > test.int64('240'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.sqlpp
new file mode 100644
index 0000000..5afe4b6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.sqlpp
@@ -0,0 +1,79 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgKeywordIx on TweetMessages ("message-text") type keyword;
+
+create index msgNgramIx on TweetMessages ("message-text") type ngram (3);
+
+create index topicKeywordIx on TweetMessages ("referred-topics") type keyword;
+
+write output to nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-jaccard-check_idx_01.adm"
+select element {'tweet':{'id':t1.tweetid,'topics':t1."referred-topics"},'similar-tweets':(
+ select element {'id':t2.tweetid,'topics':t2."referred-topics"}
+ from TweetMessages as t2
+ with sim as test."similarity-jaccard-check"(t1."referred-topics",t2."referred-topics",0.500000f)
+ where (sim[0] and (t2.tweetid != t1.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid > test.int64('240'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-contains.sqlpp
new file mode 100644
index 0000000..38dccaf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-contains.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 : Tests whether an ngram_index is applied to optimize a join 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ DBLP as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..89f490c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_02.sqlpp
new file mode 100644
index 0000000..4353249
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * CSX has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_03.sqlpp
new file mode 100644
index 0000000..91a2c8e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance-check function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_04.sqlpp
new file mode 100644
index 0000000..e32b243
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-check_04.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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance-check function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_04.adm"
+select element {'arec':a,'brec':b,'ed':ed[1]}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance-check"(a.authors,b.authors,3)
+where (ed[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-contains.sqlpp
new file mode 100644
index 0000000..01fffe4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance-contains.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-contains function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-contains"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_01.sqlpp
new file mode 100644
index 0000000..84842a0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_02.sqlpp
new file mode 100644
index 0000000..bfd9111
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * CSX has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_03.sqlpp
new file mode 100644
index 0000000..c27456f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_04.sqlpp
new file mode 100644
index 0000000..e302d06
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-edit-distance_04.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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_03.adm"
+select element {'arec':a,'brec':b,'ed':ed}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance"(a.authors,b.authors)
+where ((ed < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
new file mode 100644
index 0000000..124f818
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp
new file mode 100644
index 0000000..8fc2a0c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * CSX has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
new file mode 100644
index 0000000..55880e4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.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 : Fuzzy self joins a dataset, DBLP, based on ~= using edit distance of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_03.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..a561118
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..a91dd7b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard their titles' 3-gram tokens.
+ * CSX has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_02.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..fdd7f86
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on ~= using Jaccard of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_03.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..9a3dd33
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_01.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..9c43865
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_02.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * CSX has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..3f3e334
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..90497fc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard-check_04.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc[1]}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)
+where (jacc[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_01.sqlpp
new file mode 100644
index 0000000..8a456c6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_01.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_02.sqlpp
new file mode 100644
index 0000000..b8bde23
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_02.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based the similarity-jaccard function of their titles' 3-gram tokens.
+ * CSX has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_03.sqlpp
new file mode 100644
index 0000000..63f919a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_04.sqlpp
new file mode 100644
index 0000000..a4ea206
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ngram-jaccard_04.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false))
+where ((jacc >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..ddabd13
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance-check function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (test."edit-distance-check"(a.interests,b.interests,3)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_02.sqlpp
new file mode 100644
index 0000000..1ac5ba3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance-check function of their interest lists.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance-check_02.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (test."edit-distance-check"(a.interests,b.interests,3)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_03.sqlpp
new file mode 100644
index 0000000..d3f3e68
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_03.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the edit-distance-check function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance-check_03.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where (test."edit-distance-check"(a.interests,b.interests,3)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_04.sqlpp
new file mode 100644
index 0000000..105b8df
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance-check_04.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the edit-distance-check function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance-check_04.adm"
+select element {'arec':a,'brec':b,'ed':ed[1]}
+from Customers as a,
+ Customers as b
+with ed as test."edit-distance-check"(a.interests,b.interests,3)
+where (ed[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_01.sqlpp
new file mode 100644
index 0000000..d5939e4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((test."edit-distance"(a.interests,b.interests) <= 2) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_02.sqlpp
new file mode 100644
index 0000000..f96eb88
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance function of their interest lists.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance_02.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((test."edit-distance"(a.interests,b.interests) <= 2) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_03.sqlpp
new file mode 100644
index 0000000..69fff61
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_03.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the edit-distance function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance_03.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where ((test."edit-distance"(a.interests,b.interests) <= 2) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_04.sqlpp
new file mode 100644
index 0000000..b0176eb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-edit-distance_04.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the edit-distance function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance_04.adm"
+select element {'arec':a,'brec':b,'ed':ed}
+from Customers as a,
+ Customers as b
+with ed as test."edit-distance"(a.interests,b.interests)
+where ((ed <= 2) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.sqlpp
new file mode 100644
index 0000000..05a758c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using edit distance of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.interests ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp
new file mode 100644
index 0000000..e3282e8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using edit distance of their interest lists.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_02.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.interests ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp
new file mode 100644
index 0000000..7d1fbf8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on ~= using edit distance of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_03.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where ((a.interests ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..56ec6d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..a9a066a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest lists.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_02.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..92608a3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on ~= using Jaccard of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_03.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..bbb9906
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard-check function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..e173199
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard-check function of their interest lists.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..0281d93
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_03.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard-check function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard-check_03.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..49801dd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard-check_04.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard-check function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard-check_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc[1]}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)
+where (jacc[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_01.sqlpp
new file mode 100644
index 0000000..b1e40f0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_02.sqlpp
new file mode 100644
index 0000000..1165362
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest lists.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_03.sqlpp
new file mode 100644
index 0000000..d30cfb0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_03.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard_03.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_04.sqlpp
new file mode 100644
index 0000000..ff40544
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/olist-jaccard_04.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests)
+where ((jacc >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..bb6c1bc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..863280d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest sets.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-fuzzyeq-jaccard_02.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..c333464
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on ~= using Jaccard of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-fuzzyeq-jaccard_03.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where ((a.interests /*+ indexnl */ ~= b.interests) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..6d91e5f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard-check function of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..e2e6953
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard-check function of their interest sets.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..4165db4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_03.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard-check function of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard-check_03.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..6e29270
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard-check_04.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard-check function of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard-check_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc[1]}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard-check"(a.interests,b.interests,0.700000f)
+where (jacc[0] and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_01.sqlpp
new file mode 100644
index 0000000..f468e97
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_02.sqlpp
new file mode 100644
index 0000000..57aa4c7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest sets.
+ * Customers2 has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create table Customers2(CustomerType) primary key cid;
+
+create index interests_index on Customers2 (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_03.sqlpp
new file mode 100644
index 0000000..0a0e384
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_03.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard_03.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests) >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_04.sqlpp
new file mode 100644
index 0000000..60a47fe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/ulist-jaccard_04.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index interests_index on Customers (interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard"(a.interests,b.interests)
+where ((jacc >= 0.700000f) and (a.cid < b.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..07eafcc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..278e67b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * CSX has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on CSX (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_02.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..7059c4a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.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 : Fuzzy self joins a dataset, DBLP, based on ~= using Jaccard of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_03.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
new file mode 100644
index 0000000..a8af07c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy self joins a dataset, TweetMessages, based on the similarity-jaccard-check function of its text-messages' word tokens.
+ * TweetMessages has a keyword index on text-message and btree index on the primary key tweetid, and we expect the join to be
+ * transformed into btree and inverted indexed nested-loop joins. We test whether the join condition can be transformed into
+ * multiple indexed nested loop joins of various type of indexes.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm"
+select element {'t1':t1.tweetid,'t2':t2.tweetid,'sim':sim[1]}
+from TweetMessages as t1,
+ TweetMessages as t2
+with sim as test."similarity-jaccard-check"(test."word-tokens"(t1."message-text"),test."word-tokens"(t2."message-text"),0.600000f)
+where (sim[0] and (t1.tweetid < test.int64('20')) and (t2.tweetid != t1.tweetid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..d35694a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..963dee2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * CSX has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on CSX (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..9b7ffb2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..96fa6de
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard-check_04.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc[1]}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)
+where (jacc[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_01.sqlpp
new file mode 100644
index 0000000..8ba66ca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_02.sqlpp
new file mode 100644
index 0000000..e525469
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * CSX has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on CSX (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_03.sqlpp
new file mode 100644
index 0000000..e9d670d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_04.sqlpp
new file mode 100644
index 0000000..2782951
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inverted-index-join/word-jaccard_04.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title))
+where ((jacc >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/join-super-key_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/join-super-key_01.sqlpp
new file mode 100644
index 0000000..0a4bd2b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/join-super-key_01.sqlpp
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+drop database "join-super-key_1" if exists;
+create database "join-super-key_1";
+
+use "join-super-key_1";
+
+
+create type "join-super-key_1".SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type "join-super-key_1".NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type "join-super-key_1".LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type "join-super-key_1".PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create type "join-super-key_1".PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+write output to nc1:"/tmp/join-super-key_01.adm"
+create table LineItems(LineItemType) primary key l_partkey,l_linenumber on group1;
+
+create table PartSupp(PartSuppType) primary key ps_partkey,ps_suppkey on group1;
+
+select element {'l_partkey':li.l_partkey}
+from LineItems as li,
+ PartSupp as ps
+where ((li.l_partkey = ps.ps_partkey) and (li.l_suppkey = ps.ps_suppkey) and (li.l_extendedprice = ps.ps_supplycost))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/join-super-key_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/join-super-key_02.sqlpp
new file mode 100644
index 0000000..7aab555
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/join-super-key_02.sqlpp
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+drop database "join-super-key_01" if exists;
+create database "join-super-key_01";
+
+use "join-super-key_01";
+
+
+create type "join-super-key_01".SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type "join-super-key_01".NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type "join-super-key_01".LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type "join-super-key_01".PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create type "join-super-key_01".PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+write output to nc1:"/tmp/join-super-key_01.adm"
+create table LineItems(LineItemType) primary key l_partkey,l_linenumber on group1;
+
+create table PartSupp(PartSuppType) primary key ps_partkey,ps_suppkey on group1;
+
+select element {'l_partkey':li.l_partkey}
+from PartSupp as ps,
+ LineItems as li
+where ((li.l_partkey = ps.ps_partkey) and (li.l_suppkey = ps.ps_suppkey) and (li.l_extendedprice = ps.ps_supplycost))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/limit-issue353.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/limit-issue353.sqlpp
new file mode 100644
index 0000000..e0b1b89
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/limit-issue353.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 : This test case is to verify the fix for issue353
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+write output to nc1:"/tmp/push_limit.adm"
+select element {'l_returnflag':l.l_returnflag,'l_linestatus':l.l_linestatus,'l_shipmode':l.l_shipmode}
+from LineItem as l
+limit 2
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/loj-super-key_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/loj-super-key_01.sqlpp
new file mode 100644
index 0000000..9215f6d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/loj-super-key_01.sqlpp
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+drop database "loj-super-key_01" if exists;
+create database "loj-super-key_01";
+
+use "loj-super-key_01";
+
+
+create type "loj-super-key_01".SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type "loj-super-key_01".NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type "loj-super-key_01".LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type "loj-super-key_01".PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create type "loj-super-key_01".PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+write output to nc1:"/tmp/loj-super-key_01.adm"
+create table LineItems(LineItemType) primary key l_partkey,l_linenumber on group1;
+
+create table PartSupp(PartSuppType) primary key ps_partkey,ps_suppkey on group1;
+
+select element {'li':li,'partsupp':partsupp}
+from LineItems as li
+with partsupp as (
+ select element ps
+ from PartSupp as ps
+ where ((li.l_partkey = ps.ps_partkey) and (li.l_suppkey = ps.ps_suppkey) and (li.l_extendedprice = ps.ps_supplycost))
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/loj-super-key_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/loj-super-key_02.sqlpp
new file mode 100644
index 0000000..a80fa61
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/loj-super-key_02.sqlpp
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+drop database "loj-super-key_02" if exists;
+create database "loj-super-key_02";
+
+use "loj-super-key_02";
+
+
+create type "loj-super-key_02".SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type "loj-super-key_02".NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type "loj-super-key_02".LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type "loj-super-key_02".PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create type "loj-super-key_02".PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+write output to nc1:"/tmp/loj-super-key_01.adm"
+create table LineItems(LineItemType) primary key l_partkey,l_linenumber on group1;
+
+create table PartSupp(PartSuppType) primary key ps_partkey,ps_suppkey on group1;
+
+select element {'partsupp':ps,'li':items}
+from PartSupp as ps
+with items as (
+ select element li
+ from LineItems as li
+ where ((li.l_partkey = ps.ps_partkey) and (li.l_suppkey = ps.ps_suppkey) and (li.l_extendedprice = ps.ps_supplycost))
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp
new file mode 100644
index 0000000..2b67f09
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp
@@ -0,0 +1,137 @@
+/*
+ * 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 case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date : 2nd Jun 2014
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create table Orders(OrderType) primary key o_orderkey;
+
+create table Supplier(SupplierType) primary key s_suppkey;
+
+create table Region(RegionType) primary key r_regionkey;
+
+create table Nation(NationType) primary key n_nationkey;
+
+create table Part(PartType) primary key p_partkey;
+
+create table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create table Customer(CustomerType) primary key c_custkey;
+
+create table SelectedNation(NationType) primary key n_nationkey;
+
+select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates':(
+ select element {'order_date':orderdate,'sum_price':sum}
+ from Orders as orders,
+ Customer as customer
+ where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = nation.n_nationkey))
+ group by orders.o_orderdate as orderdate
+ with sum as tpch.sum((
+ select element o.o_totalprice
+ from orders as o
+ ))
+ order by sum
+ limit 3
+ )}
+from Nation as nation,
+ SelectedNation as sn
+where (nation.n_nationkey = sn.n_nationkey)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/disjunction-to-join.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/disjunction-to-join.sqlpp
new file mode 100644
index 0000000..d5acf89
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/disjunction-to-join.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 : Disjunctive predicate should be transformed into collection scan.
+ * Secondary index should be used to probe the values retrieved from collection.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.NestedTestType as
+{
+ idx : string
+}
+
+create type test.TestType as
+{
+ id : string,
+ "no-idx" : string,
+ nested : NestedTestType
+}
+
+create table TestSet(TestType) primary key id;
+
+create index TestSetIndex on TestSet (nested.idx) type btree;
+
+select element x
+from TestSet as x
+where ((x.nested.idx = 'one') or (x.nested.idx = 'two'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.sqlpp
new file mode 100644
index 0000000..36e4c79
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm"
+select element {'tweetid1':t1.nested.tweetid,'count1':t1.nested.countA,'t2info':(
+ select element {'tweetid2':t2.nested.tweetid,'count2':t2.nested.countB}
+ from TweetMessages as t2
+ where (t1.nested.countA /*+ indexnl */ = t2.nested.countB)
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.sqlpp
new file mode 100644
index 0000000..bf0a60f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm"
+select element {'tweetid1':t1.nested.tweetid,'count1':t1.nested.countA,'t2info':(
+ select element {'tweetid2':t2.nested.tweetid,'count2':t2.nested.countB}
+ from TweetMessages as t2
+ where ((t1.nested.countA /*+ indexnl */ = t2.nested.countB) and (t1.nested.tweetid != t2.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.sqlpp
new file mode 100644
index 0000000..b5db202
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ > emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ > emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.sqlpp
new file mode 100644
index 0000000..f6b191a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ < emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ < emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.sqlpp
new file mode 100644
index 0000000..141fd42
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ = emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ = emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.sqlpp
new file mode 100644
index 0000000..c8aee57
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ < emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ > emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.sqlpp
new file mode 100644
index 0000000..c38f606
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ > emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ < emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.sqlpp
new file mode 100644
index 0000000..05f5d9f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ > emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ = emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.sqlpp
new file mode 100644
index 0000000..cd462d3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_04.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ < emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ = emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.sqlpp
new file mode 100644
index 0000000..2ef6a91
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_05.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ = emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ > emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.sqlpp
new file mode 100644
index 0000000..d95fe11
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its primary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ fname : string,
+ lname : string
+}
+
+create type test.Name as
+{
+ nested : Nametmp
+}
+
+create table Names(Name) primary key nested.fname,nested.lname;
+
+write output to nc1:"rttest/btree-index-join_primary-composite-key-prefix-prefix-join_06.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ = emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ < emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.sqlpp
new file mode 100644
index 0000000..ded8580
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.sqlpp
@@ -0,0 +1,83 @@
+/*
+ * 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 : Equi joins two datasets, Customers and Orders, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * We expect the additional predicates to be put into a select above the
+ * primary index search.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.OrderTypetmp as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create type test.OrderType as
+ closed {
+ nested : OrderTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Orders(OrderType) primary key nested.oid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join-multipred.adm"
+select element {'customer':c.nested,'order':o.nested}
+from Customers as c,
+ Orders as o
+where ((c.nested.cid /*+ indexnl */ = o.nested.cid) and (c.nested.name < o.nested.orderstatus) and (c.nested.age < o.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.sqlpp
new file mode 100644
index 0000000..fcb60c3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.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 is a negative test, mis-spelt/incorrect HINT should result in
+ * a plan not using an indexed-nested loops join strategy. We expect a hash join.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join-neg_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key1 = y.nested.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_01.sqlpp
new file mode 100644
index 0000000..2602ff3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_01.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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that hash-exchanges internal dataset DsTwo, then probes internal dataset DsOne's primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key1 /*+ indexnl */ = y.nested.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_02.sqlpp
new file mode 100644
index 0000000..edac5f3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_02.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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that hash-exchanges internal dataset DsTwo, then probes internal dataset DsOne's primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_02.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key2 /*+ indexnl */ = y.nested.key1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_03.sqlpp
new file mode 100644
index 0000000..75e669a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_03.sqlpp
@@ -0,0 +1,81 @@
+/*
+ * 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 : Equi joins two datasets, Customers and Orders, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.OrderTypetmp as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create type test.OrderType as
+ closed {
+ nested : OrderTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Orders(OrderType) primary key nested.oid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_04.adm"
+select element {'customer':c.nested,'order':o.nested}
+from Customers as c,
+ Orders as o
+where (c.nested.cid /*+ indexnl */ = o.nested.cid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_04.sqlpp
new file mode 100644
index 0000000..eb25a0c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_04.sqlpp
@@ -0,0 +1,81 @@
+/*
+ * 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 : Equi joins two datasets, Customers and Orders, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.OrderTypetmp as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create type test.OrderType as
+ closed {
+ nested : OrderTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Orders(OrderType) primary key nested.oid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_05.adm"
+select element {'customer':c.nested,'order':o.nested}
+from Orders as o,
+ Customers as c
+where (o.nested.cid /*+ indexnl */ = c.nested.cid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_05.sqlpp
new file mode 100644
index 0000000..98eee3e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-equi-join_05.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Self-equi joins a dataset, Customers, based on the customer id.
+ * Given the 'indexnl' hint we expect the join to be transformed
+ * into an indexed nested-loop join using Customers' primary index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+write output to nc1:"rttest/btree-index-join_primary-equi-join_06.adm"
+select element {'customer1':c1.nested,'customer2':c2.nested}
+from Customers as c1,
+ Customers as c2
+where (c1.nested.cid /*+ indexnl */ = c2.nested.cid)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-ge-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-ge-join_01.sqlpp
new file mode 100644
index 0000000..a93546f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-ge-join_01.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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOne's primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-ge-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key1 /*+ indexnl */ >= y.nested.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-gt-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-gt-join_01.sqlpp
new file mode 100644
index 0000000..e478f8f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-gt-join_01.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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOnes primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-gt-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key1 /*+ indexnl */ > y.nested.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-le-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-le-join_01.sqlpp
new file mode 100644
index 0000000..ef88ee3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-le-join_01.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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOnes primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-le-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key1 /*+ indexnl */ <= y.nested.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-lt-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-lt-join_01.sqlpp
new file mode 100644
index 0000000..e72eb83
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/primary-lt-join_01.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 : Notice the query hint to use an indexed nested-loops join plan.
+ * : We expect a plan that broadcasts internal dataset DsTwo, then probes internal dataset DsOnes primary index.
+ * Expected Res : Success
+ * Date : 29th November 2012
+ */
+
+drop database test1 if exists;
+create database test1;
+
+create type test1.TestTypetmp as
+{
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+}
+
+create type test1.TestType as
+{
+ nested : TestTypetmp
+}
+
+create table test1.DsOne(TestType) primary key nested.key1;
+
+create table test1.DsTwo(TestType) primary key nested.key1;
+
+write output to nc1:"rttest/btree-index-join_primary-lt-join_01.adm"
+select element x
+from "test1.DsOne" as x,
+ "test1.DsTwo" as y
+where (x.nested.key1 /*+ indexnl */ < y.nested.key2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.sqlpp
new file mode 100644
index 0000000..ddfcffb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.sqlpp
@@ -0,0 +1,85 @@
+/*
+ * 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 : Equi joins two datasets, FacebookUsers and FacebookMessages, based on their user's id.
+ * We first expect FacebookUsers' primary index to be used
+ * to satisfy the range condition on it's primary key.
+ * FacebookMessages has a secondary btree index on author-id-copy, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.EmploymentType as
+ closed {
+ "organization-name" : string,
+ "start-date" : date,
+ "end-date" : date?
+}
+
+create type test.FacebookUserTypetmp as
+ closed {
+ id : int32,
+ "id-copy" : int32,
+ alias : string,
+ name : string,
+ "user-since" : datetime,
+ "user-since-copy" : datetime,
+ "friend-ids" : {{int32}},
+ employment : [EmploymentType]
+}
+
+create type test.FacebookMessageTypetmp as
+ closed {
+ "message-id" : int32,
+ "message-id-copy" : int32,
+ "author-id" : int32,
+ "author-id-copy" : int32,
+ "in-response-to" : int32?,
+ "sender-location" : point?,
+ message : string
+}
+
+create type test.FacebookUserType as
+ closed {
+ nested : FacebookUserTypetmp
+}
+
+create type test.FacebookMessageType as
+ closed {
+ nested : FacebookMessageTypetmp
+}
+
+create table FacebookUsers(FacebookUserType) primary key nested.id;
+
+create table FacebookMessages(FacebookMessageType) primary key nested."message-id";
+
+create index fbmIdxAutId if not exists on FacebookMessages (nested."author-id-copy") type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multiindex.adm"
+select element {'fbu-ID':user.nested.id,'fbm-auth-ID':message.nested."author-id",'uname':user.nested.name,'message':message.nested.message}
+from FacebookUsers as user,
+ FacebookMessages as message
+where ((user.nested.id /*+ indexnl */ = message.nested."author-id-copy") and (user.nested.id >= 11000) and (user.nested.id <= 12000))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.sqlpp
new file mode 100644
index 0000000..10adfc6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the additional predicates to be put into a select above the
+ * primary index search.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index on DBLP (nested.title) type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.nested.title /*+ indexnl */ = b.nested.title) and (a.nested.authors < b.nested.authors) and (a.nested.misc > b.nested.misc))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.sqlpp
new file mode 100644
index 0000000..41af3b9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index on DBLP (nested.title) type btree;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.nested.title /*+ indexnl */ = b.nested.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-01.sqlpp
new file mode 100644
index 0000000..653591f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-01.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 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-01.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.nested
+from testdst as emp
+where (emp.nested.fname > 'Roger')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-02.sqlpp
new file mode 100644
index 0000000..2450dd8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-02.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 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-02.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.nested
+from testdst as emp
+where (emp.nested.fname >= 'Susan')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-03.sqlpp
new file mode 100644
index 0000000..721e906
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 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-03.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.nested
+from testdst as emp
+where (emp.nested.fname < 'Isa')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-04.sqlpp
new file mode 100644
index 0000000..b770353
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-04.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 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-04.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.nested
+from testdst as emp
+where (emp.nested.fname <= 'Vanpatten')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-05.sqlpp
new file mode 100644
index 0000000..bea6079
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-05.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 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-05.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.nested
+from testdst as emp
+where (emp.nested.fname != 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-06.sqlpp
new file mode 100644
index 0000000..5e9feea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-06.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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-06.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.nested
+from testdst as emp
+where (emp.nested.fname = 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-07.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-07.sqlpp
new file mode 100644
index 0000000..b05b895
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-07.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 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-07.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.nested
+from testdst as emp
+where (emp.nested.lname = 'Kim')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-08.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-08.sqlpp
new file mode 100644
index 0000000..9a9f663
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-08.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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-08.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 = 'Young Seok') and (emp.nested.lname = 'Kim'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-09.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-09.sqlpp
new file mode 100644
index 0000000..eb5c695
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-09.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 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-09.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.nested
+from testdst as emp
+where ((emp.nested.fname = 'Julio') or (emp.nested.lname = 'Malaika'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-10.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-10.sqlpp
new file mode 100644
index 0000000..46a5192
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-10.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 (usage) test
+ * : This test is intended to verify that the primary 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-10.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 > 'Alex') and (emp.nested.lname < 'Zach'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-11.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-11.sqlpp
new file mode 100644
index 0000000..f5b32e7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-11.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 NOT used
+ * : in the optimized query plan for predicates.
+ * 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-11.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.nested
+from testdst as emp
+where ((emp.nested.fname > 'Allan') and (emp.nested.lname < 'Zubi'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-12.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-12.sqlpp
new file mode 100644
index 0000000..1a48bd8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-12.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 (usage) test
+ * : This test is intended to verify that the primary 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-12.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.nested
+from testdst as emp
+where ((emp.nested.fname > 'Allan') and (emp.nested.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-13.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-13.sqlpp
new file mode 100644
index 0000000..f9a434f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-13.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 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-13.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.nested
+from testdst as emp
+where ((emp.nested.fname = 'Julio') and (emp.nested.lname < 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-14.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-14.sqlpp
new file mode 100644
index 0000000..6ce745d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-14.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 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-14.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.nested
+from testdst as emp
+where ((emp.nested.fname >= 'Michael') and (emp.nested.lname <= 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-15.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-15.sqlpp
new file mode 100644
index 0000000..93f1835
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-15.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-15.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'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-16.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-16.sqlpp
new file mode 100644
index 0000000..aa403aa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-16.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-16.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'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-17.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-17.sqlpp
new file mode 100644
index 0000000..c85d28d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-17.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 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-17.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.nested
+from testdst as emp
+where ((emp.nested.fname <= 'Craig') and (emp.nested.lname > 'Kevin'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-18.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-18.sqlpp
new file mode 100644
index 0000000..228a3c3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-18.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 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-18.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.nested
+from testdst as emp
+where ((emp.nested.fname != 'Michael') and (emp.nested.lname != 'Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-19.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-19.sqlpp
new file mode 100644
index 0000000..1e8cbe3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-19.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-19.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'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-20.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-20.sqlpp
new file mode 100644
index 0000000..5eb4acd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-20.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-20.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'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-21.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-21.sqlpp
new file mode 100644
index 0000000..053f740
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-21.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-21.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')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-22.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-22.sqlpp
new file mode 100644
index 0000000..6fd56e4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-22.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-22.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 >= 'Sofia')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-23.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-23.sqlpp
new file mode 100644
index 0000000..870d33e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-23.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-23.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 < 'Chen')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-24.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-24.sqlpp
new file mode 100644
index 0000000..71fd2c7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-24.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-24.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 <= 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-25.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-25.sqlpp
new file mode 100644
index 0000000..a7bba9c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/btree-index/btree-primary-25.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-25.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 > 'Neil') and (emp.nested.fname < 'Roger'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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')
+;
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')
+;
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')
+;
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')
+;
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')
+;
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')
+;
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')
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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')
+;
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')
+;
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')
+;
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')
+;
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'))
+;
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'))
+;
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')
+;
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'))
+;
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'))
+;
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'))
+;
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
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains.sqlpp
new file mode 100644
index 0000000..5b0a0ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-contains.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 be applied.
+ * 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.adm"
+select element o
+from DBLP as o
+where test.contains(o.nested.title,'Multimedia')
+order by o.nested.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
new file mode 100644
index 0000000..3b941cb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-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 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
+ 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.authors) type ngram (3);
+
+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]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.sqlpp
new file mode 100644
index 0000000..aa56210
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.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 be applied.
+ * 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.authors) type ngram (3);
+
+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]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.sqlpp
new file mode 100644
index 0000000..aae398d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-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 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
+ 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.authors) type ngram (3);
+
+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)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.sqlpp
new file mode 100644
index 0000000..1d0cc53
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.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 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
+ 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.authors) type ngram (3);
+
+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)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..b247363
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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
+ 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.authors) type ngram (3);
+
+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')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..c387cb0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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
+ 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-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))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.sqlpp
new file mode 100644
index 0000000..8b97cb1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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
+ 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-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]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.sqlpp
new file mode 100644
index 0000000..1400a11
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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
+ 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-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)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.sqlpp
new file mode 100644
index 0000000..0ea3a7a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 edit-distance-check function on lists.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-check-panic.adm"
+select element c
+from Customers as c
+where test."edit-distance-check"(c.nested.interests,['computers','wine','walking'],3)[0]
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.sqlpp
new file mode 100644
index 0000000..044d99a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 edit-distance-check function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-check.adm"
+select element c
+from Customers as c
+where test."edit-distance-check"(c.nested.interests,['computers','wine','walking'],1)[0]
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.sqlpp
new file mode 100644
index 0000000..62dcac7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 edit-distance function on lists.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance-panic.adm"
+select element c
+from Customers as c
+where (test."edit-distance"(c.nested.interests,['computers','wine','walking']) <= 3)
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.sqlpp
new file mode 100644
index 0000000..1eefdde
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 edit-distance function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-edit-distance.adm"
+select element c
+from Customers as c
+where (test."edit-distance"(c.nested.interests,['computers','wine','walking']) <= 1)
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..4ab5a56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 with ~= using edit-distance on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-fuzzyeq-edit-distance.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "1";
+
+select element c
+from Customers as c
+where (c.nested.interests ~= ['computers','wine','walking'])
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..7528155
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 is applied to optimize a selection query with ~= using Jaccard on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.8f";
+
+select element c
+from Customers as c
+where (c.nested.interests ~= ['databases','computers','wine'])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.sqlpp
new file mode 100644
index 0000000..02a1918
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 similarity-jaccard-check function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-jaccard-check.adm"
+select element c
+from Customers as c
+where test."similarity-jaccard-check"(c.nested.interests,['databases','computers','wine'],0.700000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-jaccard.sqlpp
new file mode 100644
index 0000000..1d12e90
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/olist-jaccard.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 similarity-jaccard function on lists.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_olist-jaccard.adm"
+select element c
+from Customers as c
+where (test."similarity-jaccard"(c.nested.interests,['databases','computers','wine']) >= 0.700000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..eb29a16
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 is applied to optimize a selection query with ~= using Jaccard on sets.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_ulist-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.8f";
+
+select element c
+from Customers as c
+where (c.nested.interests ~= {{'computers','wine','databases'}})
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.sqlpp
new file mode 100644
index 0000000..22e4922
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 similarity-jaccard-check function on sets.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_ulist-jaccard.adm"
+select element c
+from Customers as c
+where test."similarity-jaccard-check"(c.nested.interests,{{'computers','wine','databases'}},0.700000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.sqlpp
new file mode 100644
index 0000000..0fb7440
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 similarity-jaccard function on sets.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_ulist-jaccard.adm"
+select element c
+from Customers as c
+where (test."similarity-jaccard"(c.nested.interests,{{'computers','databases','wine'}}) >= 0.700000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-contains.sqlpp
new file mode 100644
index 0000000..b2d2ba3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-contains.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 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
+ 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 keyword_index on DBLP (nested.title) type keyword;
+
+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
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..54b0d56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 is applied to optimize a selection query with ~= using Jaccard on word tokens.
+ * The index should be applied.
+ * 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 keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element o
+from DBLP as o
+where (test."word-tokens"(o.nested.title) ~= test."word-tokens"('Transactions for Cooperative Environments'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.sqlpp
new file mode 100644
index 0000000..519fbdd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.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 similarity-jaccard-check function on word tokens.
+ * The index should be applied.
+ * 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 keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard-check.adm"
+select element o
+from DBLP as o
+where test."similarity-jaccard-check"(test."word-tokens"(o.nested.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-jaccard.sqlpp
new file mode 100644
index 0000000..b4ac67e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-basic/word-jaccard.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 similarity-jaccard function on word tokens.
+ * The index should be applied.
+ * 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 keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard.adm"
+select element o
+from DBLP as o
+where (test."similarity-jaccard"(test."word-tokens"(o.nested.title),test."word-tokens"('Transactions for Cooperative Environments')) >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp
new file mode 100644
index 0000000..8b31bb1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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
+ * two edit-distance-check function of which only the first can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * 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.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with eda as test."edit-distance-check"(o.nested.authors,'Amihay Motro',3),
+ edb as test."edit-distance-check"(o.nested.authors,'Amihay Motro',5)
+where (eda[0] and edb[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp
new file mode 100644
index 0000000..b45f4d3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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
+ * two edit-distance-check function of which only the second can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * 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.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with edb as test."edit-distance-check"(o.nested.authors,'Amihay Motro',5),
+ eda as test."edit-distance-check"(o.nested.authors,'Amihay Motro',3)
+where (edb[0] and eda[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp
new file mode 100644
index 0000000..fdbd28a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-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]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.sqlpp
new file mode 100644
index 0000000..148f77b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * 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.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let.adm"
+select element o
+from DBLP as o
+with ed as test."edit-distance-check"(o.nested.authors,'Amihay Motro',1)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp
new file mode 100644
index 0000000..ba20bbe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.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 index is applied to optimize a selection query using the similarity-edit-distance-check function on the substring of the field.
+ * Tests that the optimizer rule correctly drills through the substring function.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPNestedType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPNestedType
+}
+
+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-complex_ngram-edit-distance-check-substring.adm"
+select element {'id':paper.nested.id,'title':paper.nested.title}
+from DBLP as paper
+where test."edit-distance-check"(test.substring(paper.nested.title,0,8),'datbase',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp
new file mode 100644
index 0000000..95d27a8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 index is applied to optimize a selection query using the similarity-edit-distance-check function on individual word tokens.
+ * Tests that the optimizer rule correctly drills through the word-tokens function and existential query.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPNestedType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPNestedType
+}
+
+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-complex_ngram-edit-distance-check-word-tokens.adm"
+select element {'id':paper.nested.id,'title':paper.nested.title}
+from DBLP as paper,
+ test."word-tokens"(paper.nested.title) as word
+where test."edit-distance-check"(word,'Multmedia',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..a3c19e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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
+ 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-complex_ngram-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."gram-tokens"(o.nested.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..3da4ee5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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
+ 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-complex_ngram-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."gram-tokens"(paper.nested.title,3,false),
+ query_tokens as test."gram-tokens"('Transactions for Cooperative Environments',3,false),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.sqlpp
new file mode 100644
index 0000000..8c75008
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_olist-edit-distance-check-let-panic.adm"
+select element c
+from Customers as c
+with ed as test."edit-distance-check"(c.nested.interests,['computers','wine','walking'],3)
+where ed[0]
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.sqlpp
new file mode 100644
index 0000000..7c5ff03
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_olist-edit-distance-check-let.adm"
+select element c
+from Customers as c
+with ed as test."edit-distance-check"(c.nested.interests,['computers','wine','walking'],1)
+where ed[0]
+order by c.nested.cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..fb9e5c2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 similarity-jaccard-check function on lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_olist-jaccard-check-let.adm"
+select element c
+from Customers as c
+with jacc as test."similarity-jaccard-check"(c.nested.interests,['databases','computers','wine'],0.700000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..0adc2ba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 similarity-jaccard-check function on lists.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_ulist-jaccard-check-let.adm"
+select element c
+from Customers as c
+with jacc as test."similarity-jaccard-check"(c.nested.interests,['databases','computers','wine'],0.700000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..c2bc04a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * 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 keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."word-tokens"(o.nested.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..fff2dc6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * 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 keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."word-tokens"(paper.nested.title),
+ query_tokens as test."word-tokens"('Transactions for Cooperative Environments'),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.800000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
new file mode 100644
index 0000000..f4fe12d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgNgramIx on TweetMessages (nested."message-text") type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm"
+select element {'tweet':{'id':t1.nested.tweetid,'topics':t1.nested."message-text"},'similar-tweets':(
+ select element {'id':t2.nested.tweetid,'topics':t2.nested."message-text"}
+ from TweetMessages as t2
+ with sim as test."edit-distance-check"(t1.nested."message-text",t2.nested."message-text",7)
+ where (sim[0] and (t2.nested.tweetid != t1.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid > test.int64('240'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.sqlpp
new file mode 100644
index 0000000..a60538b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index topicKeywordIx on TweetMessages (nested."referred-topics") type keyword;
+
+write output to nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-jaccard-check_idx_01.adm"
+select element {'tweet':{'id':t1.nested.tweetid,'topics':t1.nested."referred-topics"},'similar-tweets':(
+ select element {'id':t2.nested.tweetid,'topics':t2.nested."referred-topics"}
+ from TweetMessages as t2
+ with sim as test."similarity-jaccard-check"(t1.nested."referred-topics",t2.nested."referred-topics",0.500000f)
+ where (sim[0] and (t2.nested.tweetid != t1.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid > test.int64('240'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..6308bb6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.sqlpp
new file mode 100644
index 0000000..53b87e5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-contains function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-contains"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.sqlpp
new file mode 100644
index 0000000..2dac7e2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * 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.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-edit-distance-inline.adm"
+select element {'aauthors':a.nested.authors,'bauthors':b.nested.authors,'ed':ed}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance"(a.nested.authors,b.nested.authors)
+where ((ed < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.sqlpp
new file mode 100644
index 0000000..1006106
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.nested.authors,b.nested.authors) < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
new file mode 100644
index 0000000..ac2c821
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.authors) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.nested.authors ~= b.nested.authors) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..23e6458
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,76 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.nested.title,3,false) ~= test."gram-tokens"(b.nested.title,3,false)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..acdc1e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.sqlpp
new file mode 100644
index 0000000..c829209
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+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-join-noeqjoin_ngram-jaccard-inline.adm"
+select element {'atitle':a.nested.title,'btitle':b.nested.title,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false))
+where ((jacc >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.sqlpp
new file mode 100644
index 0000000..94970e7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..013ee34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance-check function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (test."edit-distance-check"(a.nested.interests,b.nested.interests,3)[0] and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.sqlpp
new file mode 100644
index 0000000..c218e34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the edit-distance function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-edit-distance-inline.adm"
+select element {'ainterests':a.nested.interests,'binterests':b.nested.interests,'ed':ed}
+from Customers as a,
+ Customers as b
+with ed as test."edit-distance"(a.nested.interests,b.nested.interests)
+where ((ed <= 2) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.sqlpp
new file mode 100644
index 0000000..827c194
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the edit-distance function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((test."edit-distance"(a.nested.interests,b.nested.interests) <= 2) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.sqlpp
new file mode 100644
index 0000000..20ac47d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using edit distance of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.nested.interests ~= b.nested.interests) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..b4cd886
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.nested.interests /*+ indexnl */ ~= b.nested.interests) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..40d94ea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard-check function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.nested.interests,b.nested.interests,0.700000f)[0] and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.sqlpp
new file mode 100644
index 0000000..3890206
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_olist-jaccard-inline.adm"
+select element {'ainterests':a.nested.interests,'binterests':b.nested.interests,'jacc':jacc}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard"(a.nested.interests,b.nested.interests)
+where ((jacc >= 0.700000f) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.sqlpp
new file mode 100644
index 0000000..8a9d98a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest lists.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : [string],
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_olist-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.nested.interests,b.nested.interests) >= 0.700000f) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..b2007ad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on ~= using Jaccard of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.7f";
+
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ((a.nested.interests /*+ indexnl */ ~= b.nested.interests) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..4267ccd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard-check function of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where ( /*+ indexnl */ test."similarity-jaccard-check"(a.nested.interests,b.nested.interests,0.700000f)[0] and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.sqlpp
new file mode 100644
index 0000000..80ad630
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy self joins a dataset, Customers, based on the similarity-jaccard function of its interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_ulist-jaccard-inline.adm"
+select element {'ainterests':a.nested.interests,'binterests':b.nested.interests,'jacc':jacc}
+from Customers as a,
+ Customers as b
+with jacc as /*+ indexnl */ test."similarity-jaccard"(a.nested.interests,b.nested.interests)
+where ((jacc >= 0.700000f) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.sqlpp
new file mode 100644
index 0000000..9252836
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, Customer and Customer2, based on the similarity-jaccard function of their interest sets.
+ * Customers has a keyword index on interests, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerTypetmp as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create type test.CustomerType as
+ closed {
+ nested : CustomerTypetmp
+}
+
+create table Customers(CustomerType) primary key nested.cid;
+
+create table Customers2(CustomerType) primary key nested.cid;
+
+create index interests_index on Customers (nested.interests) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_ulist-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from Customers as a,
+ Customers2 as b
+where (( /*+ indexnl */ test."similarity-jaccard"(a.nested.interests,b.nested.interests) >= 0.700000f) and (a.nested.cid < b.nested.cid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..f4630b4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.nested.title) ~= test."word-tokens"(b.nested.title)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
new file mode 100644
index 0000000..143f848
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
@@ -0,0 +1,76 @@
+/*
+ * 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 : Fuzzy self joins a dataset, TweetMessages, based on the similarity-jaccard-check function of its text-messages' word tokens.
+ * TweetMessages has a keyword index on text-message and btree index on the primary key tweetid, and we expect the join to be
+ * transformed into btree and inverted indexed nested-loop joins. We test whether the join condition can be transformed into
+ * multiple indexed nested loop joins of various type of indexes.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index twmSndLocIx on TweetMessages (nested."sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (nested.countA) type btree;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+create index msgTextIx on TweetMessages (nested."message-text") type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm"
+select element {'t1':t1.nested.tweetid,'t2':t2.nested.tweetid,'sim':sim[1]}
+from TweetMessages as t1,
+ TweetMessages as t2
+with sim as test."similarity-jaccard-check"(test."word-tokens"(t1.nested."message-text"),test."word-tokens"(t2.nested."message-text"),0.600000f)
+where (sim[0] and (t1.nested.tweetid < test.int64('20')) and (t2.nested.tweetid != t1.nested.tweetid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..e6180ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.sqlpp
new file mode 100644
index 0000000..55a3381
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * 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 keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join-noeqjoin_word-jaccard-inline.adm"
+select element {'atitle':a.nested.title,'btitle':b.nested.title,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title))
+where ((jacc >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard_01.sqlpp
new file mode 100644
index 0000000..db05dd2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/inverted-index-join/word-jaccard_01.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title) type keyword;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
new file mode 100644
index 0000000..7cb8b59
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
@@ -0,0 +1,80 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index twmSndLocIx on TweetMessages (nested."sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (nested.countA) type btree;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+create index msgTextIx on TweetMessages (nested."message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm"
+select element {'tweetid1':t1.nested.tweetid,'loc1':t1.nested."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.nested.tweetid,'loc2':t2.nested."sender-location"}
+ from TweetMessages as t2
+ where test."spatial-intersect"(t2.nested."sender-location",n)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1.nested."sender-location",0.5)
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
new file mode 100644
index 0000000..03e3a34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
@@ -0,0 +1,80 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index twmSndLocIx on TweetMessages (nested."sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (nested.countA) type btree;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+create index msgTextIx on TweetMessages (nested."message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm"
+select element {'tweetid1':t1.nested.tweetid,'loc1':t1.nested."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.nested.tweetid,'loc2':t2.nested."sender-location"}
+ from TweetMessages as t2
+ where (test."spatial-intersect"(t2.nested."sender-location",n) and (t1.nested.tweetid != t2.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1.nested."sender-location",0.5)
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.sqlpp
new file mode 100644
index 0000000..0458c9f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData1' has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordNested as
+ closed {
+ nested : MyRecord
+}
+
+create table MyData1(MyRecordNested) primary key nested.id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData1 (nested.point) type rtree;
+
+write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.nested.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.sqlpp
new file mode 100644
index 0000000..7893c9b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData2' has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordNested as
+ closed {
+ nested : MyRecord
+}
+
+create table MyData1(MyRecordNested) primary key nested.id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData2 (point) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.nested.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.sqlpp
new file mode 100644
index 0000000..35c6196
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.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 : Self-joins a dataset on the intersection of its point attribute.
+ * The dataset has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordNested as
+ closed {
+ nested : MyRecord
+}
+
+create table MyData(MyRecordNested) primary key nested.id;
+
+create index rtree_index on MyData (nested.point) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_03.adm"
+select element {'a':a,'b':b}
+from MyData as a,
+ MyData as b
+where test."spatial-intersect"(a.nested.point,b.nested.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.sqlpp
new file mode 100644
index 0000000..12514d2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.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 : Disjunctive predicate should be transformed into collection scan.
+ * Secondary index should be used to probe the values retrieved from collection.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.NestedTestType as
+{
+
+}
+
+create type test.TestType as
+{
+ id : string,
+ "no-idx" : string,
+ nested : NestedTestType
+}
+
+create table TestSet(TestType) primary key id;
+
+create index TestSetIndex on TestSet (nested.idx:string) type btree enforced;
+
+select element x
+from TestSet as x
+where ((x.nested.idx = 'one') or (x.nested.idx = 'two'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.sqlpp
new file mode 100644
index 0000000..66397ac6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgCountBIx on TweetMessages (nested.countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm"
+select element {'tweetid1':t1.nested.tweetid,'count1':t1.nested.countA,'t2info':(
+ select element {'tweetid2':t2.nested.tweetid,'count2':t2.nested.countB}
+ from TweetMessages as t2
+ where (t1.nested.countA /*+ indexnl */ = t2.nested.countB)
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.sqlpp
new file mode 100644
index 0000000..b704758
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgCountAIx on TweetMessages (nested.countA:int32) type btree enforced;
+
+create index msgCountBIx on TweetMessages (nested.countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm"
+select element {'tweetid1':t1.nested.tweetid,'count1':t1.nested.countA,'t2info':(
+ select element {'tweetid2':t2.nested.tweetid,'count2':t2.nested.countB}
+ from TweetMessages as t2
+ where (t1.nested.countA /*+ indexnl */ = t2.nested.countB)
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.sqlpp
new file mode 100644
index 0000000..32fb70c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgCountBIx on TweetMessages (nested.countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm"
+select element {'tweetid1':t1.nested.tweetid,'count1':t1.nested.countA,'t2info':(
+ select element {'tweetid2':t2.nested.tweetid,'count2':t2.nested.countB}
+ from TweetMessages as t2
+ where ((t1.nested.countA /*+ indexnl */ = t2.nested.countB) and (t1.nested.tweetid != t2.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.sqlpp
new file mode 100644
index 0000000..53bcc3b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgCountAIx on TweetMessages (nested.countA:int32) type btree enforced;
+
+create index msgCountBIx on TweetMessages (nested.countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm"
+select element {'tweetid1':t1.nested.tweetid,'count1':t1.nested.countA,'t2info':(
+ select element {'tweetid2':t2.nested.tweetid,'count2':t2.nested.countB}
+ from TweetMessages as t2
+ where ((t1.nested.countA /*+ indexnl */ = t2.nested.countB) and (t1.nested.tweetid != t2.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.sqlpp
new file mode 100644
index 0000000..d006faf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ > emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ > emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.sqlpp
new file mode 100644
index 0000000..aa673af
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ < emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ < emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.sqlpp
new file mode 100644
index 0000000..ac00e9c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ = emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ = emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.sqlpp
new file mode 100644
index 0000000..41e6642
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ < emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ > emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.sqlpp
new file mode 100644
index 0000000..9dd20ba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ > emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ < emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.sqlpp
new file mode 100644
index 0000000..8d384b4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ > emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ = emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.sqlpp
new file mode 100644
index 0000000..68e4f37
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_04.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ < emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ = emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.sqlpp
new file mode 100644
index 0000000..f551416
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_05.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ = emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ > emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.sqlpp
new file mode 100644
index 0000000..03fc651
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Nametmp as
+{
+ id : int32
+}
+
+create type test.NameType as
+{
+ nested : Nametmp
+}
+
+create table Names(NameType) primary key nested.id;
+
+create index Name_idx on Names (nested.fname:string,lnested.name:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_06.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.nested.fname /*+ indexnl */ = emp2.nested.fname) and (emp1.nested.lname /*+ indexnl */ < emp2.nested.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.sqlpp
new file mode 100644
index 0000000..4a2f0b5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.sqlpp
@@ -0,0 +1,84 @@
+/*
+ * 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 : Equi joins two datasets, FacebookUsers and FacebookMessages, based on their user's id.
+ * We first expect FacebookUsers' primary index to be used
+ * to satisfy the range condition on it's primary key.
+ * FacebookMessages has a secondary btree index on author-id-copy, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.EmploymentType as
+ closed {
+ "organization-name" : string,
+ "start-date" : date,
+ "end-date" : date?
+}
+
+create type test.FacebookUserTypetmp as
+ closed {
+ id : int32,
+ "id-copy" : int32,
+ alias : string,
+ name : string,
+ "user-since" : datetime,
+ "user-since-copy" : datetime,
+ "friend-ids" : {{int32}},
+ employment : [EmploymentType]
+}
+
+create type test.FacebookMessageTypetmp as
+{
+ "message-id" : int32,
+ "message-id-copy" : int32,
+ "author-id" : int32,
+ "in-response-to" : int32?,
+ "sender-location" : point?,
+ message : string
+}
+
+create type test.FacebookUserType as
+ closed {
+ nested : FacebookUserTypetmp
+}
+
+create type test.FacebookMessageType as
+ closed {
+ nested : FacebookMessageTypetmp
+}
+
+create table FacebookUsers(FacebookUserType) primary key nested.id;
+
+create table FacebookMessages(FacebookMessageType) primary key nested."message-id";
+
+create index fbmIdxAutId if not exists on FacebookMessages (nested."author-id-copy":int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multiindex.adm"
+select element {'fbu-ID':user.nested.id,'fbm-auth-ID':message.nested."author-id",'uname':user.nested.name,'message':message.nested.message}
+from FacebookUsers as user,
+ FacebookMessages as message
+where ((user.nested.id /*+ indexnl */ = message.nested."author-id-copy") and (user.nested.id >= 11000) and (user.nested.id <= 12000))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.sqlpp
new file mode 100644
index 0000000..b2f3fa3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the additional predicates to be put into a select above the
+ * primary index search.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index on DBLP (nested.title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.nested.title /*+ indexnl */ = b.nested.title) and (a.nested.authors < b.nested.authors) and (a.nested.misc > b.nested.misc))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.sqlpp
new file mode 100644
index 0000000..5ca59ca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index on DBLP (nested.title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.nested.title /*+ indexnl */ = b.nested.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.sqlpp
new file mode 100644
index 0000000..e6b59f1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Equi joins two datasets, closed DBLP and open CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index on CSX (nested.title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.nested.title /*+ indexnl */ = b.nested.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.sqlpp
new file mode 100644
index 0000000..4ebdfc7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Equi joins two open datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index_DBLP on DBLP (nested.title:string) type btree enforced;
+
+create index title_index_CSX on CSX (nested.title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.nested.title /*+ indexnl */ = b.nested.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.sqlpp
new file mode 100644
index 0000000..6877a7f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.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 : Self-joins dataset DBLP, based on it's title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * 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
+{
+ nested : DBLPTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create index title_index on DBLP (nested.title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_04.adm"
+select element {'arec':a,'arec2':a2}
+from DBLP as a,
+ DBLP as a2
+where (a.nested.title /*+ indexnl */ = a2.nested.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.sqlpp
new file mode 100644
index 0000000..1dc52af
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Equi joins two open datasets, open DBLP and closed CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we *do not* expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index title_index on DBLP (nested.title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_05.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.nested.title /*+ indexnl */ = b.nested.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-33.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-33.sqlpp
new file mode 100644
index 0000000..66a680f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-33.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-primary-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 > 'Roger')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-34.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-34.sqlpp
new file mode 100644
index 0000000..2e8b979
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-34.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-32.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 >= 'Susan')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-35.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-35.sqlpp
new file mode 100644
index 0000000..6a637cf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-35.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 (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
+}
+
+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 < 'Isa')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-36.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-36.sqlpp
new file mode 100644
index 0000000..6843fc8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/btree-index/btree-secondary-36.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-34.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 <= 'Vanpatten')
+;
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..2ca1b99f
--- /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')
+;
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')
+;
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')
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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'))
+;
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')
+;
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')
+;
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')
+;
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')
+;
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'))
+;
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'))
+;
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')
+;
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'))
+;
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'))
+;
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'))
+;
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
+;
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
+;
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]
+;
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]
+;
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)
+;
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)
+;
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')
+;
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))
+;
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]
+;
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)
+;
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
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..ef5da6c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.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 a keyword is applied to optimize a selection query with ~= using Jaccard on word tokens.
+ * 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 keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element o
+from DBLP as o
+where (test."word-tokens"(o.nested.title) ~= test."word-tokens"('Transactions for Cooperative Environments'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.sqlpp
new file mode 100644
index 0000000..dcba84e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-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 a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens.
+ * 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 keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard-check.adm"
+select element o
+from DBLP as o
+where test."similarity-jaccard-check"(test."word-tokens"(o.nested.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.sqlpp
new file mode 100644
index 0000000..e6bb7d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.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 a keyword index is applied to optimize a selection query using the similarity-jaccard function on word tokens.
+ * 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 keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard.adm"
+select element o
+from DBLP as o
+where (test."similarity-jaccard"(test."word-tokens"(o.nested.title),test."word-tokens"('Transactions for Cooperative Environments')) >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp
new file mode 100644
index 0000000..7845d93
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.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 using
+ * two edit-distance-check function of which only the first can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with eda as test."edit-distance-check"(o.nested.authors,'Amihay Motro',3),
+ edb as test."edit-distance-check"(o.nested.authors,'Amihay Motro',5)
+where (eda[0] and edb[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp
new file mode 100644
index 0000000..dc939c1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.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 using
+ * two edit-distance-check function of which only the second can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with edb as test."edit-distance-check"(o.nested.authors,'Amihay Motro',5),
+ eda as test."edit-distance-check"(o.nested.authors,'Amihay Motro',3)
+where (edb[0] and eda[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp
new file mode 100644
index 0000000..9668866
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-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 edit-distance-check function on strings.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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-complex_ngram-edit-distance-check-let-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]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.sqlpp
new file mode 100644
index 0000000..732c11d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.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 edit-distance-check function on strings.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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-complex_ngram-edit-distance-check-let.adm"
+select element o
+from DBLP as o
+with ed as test."edit-distance-check"(o.nested.authors,'Amihay Motro',1)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp
new file mode 100644
index 0000000..d96fbdf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.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 index is applied to optimize a selection query using the similarity-edit-distance-check function on the substring of the field.
+ * Tests that the optimizer rule correctly drills through the substring function.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPNestedType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPNestedType
+}
+
+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-complex_ngram-edit-distance-check-substring.adm"
+select element {'id':paper.nested.id,'title':paper.nested.title}
+from DBLP as paper
+where test."edit-distance-check"(test.substring(paper.nested.title,0,8),'datbase',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp
new file mode 100644
index 0000000..12fb658
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.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 index is applied to optimize a selection query using the similarity-edit-distance-check function on individual word tokens.
+ * Tests that the optimizer rule correctly drills through the word-tokens function and existential query.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPNestedType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPNestedType
+}
+
+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-complex_ngram-edit-distance-check-word-tokens.adm"
+select element {'id':paper.nested.id,'title':paper.nested.title}
+from DBLP as paper,
+ test."word-tokens"(paper.nested.title) as word
+where test."edit-distance-check"(word,'Multmedia',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..b6bb119
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.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 using the similarity-jaccard-check function on 3-gram tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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-complex_ngram-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."gram-tokens"(o.nested.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..fd2a1bb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.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 using the similarity-jaccard-check function on 3-gram tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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-complex_ngram-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."gram-tokens"(paper.nested.title,3,false),
+ query_tokens as test."gram-tokens"('Transactions for Cooperative Environments',3,false),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..0c4929b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.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 a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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 keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."word-tokens"(o.nested.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..8164077
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.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 a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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 keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."word-tokens"(paper.nested.title),
+ query_tokens as test."word-tokens"('Transactions for Cooperative Environments'),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.800000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
new file mode 100644
index 0000000..fccb8d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index msgNgramIx on TweetMessages (nested."message-text":string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm"
+select element {'tweet':{'id':t1.nested.tweetid,'topics':t1.nested."message-text"},'similar-tweets':(
+ select element {'id':t2.nested.tweetid,'topics':t2.nested."message-text"}
+ from TweetMessages as t2
+ with sim as test."edit-distance-check"(t1.nested."message-text",t2.nested."message-text",7)
+ where (sim[0] and (t2.nested.tweetid != t1.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+where (t1.nested.tweetid > test.int64('240'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.sqlpp
new file mode 100644
index 0000000..34dd9fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 join 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-01.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ CSX as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.sqlpp
new file mode 100644
index 0000000..f6447c8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 join 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-02.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from CSX as o1,
+ DBLP as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.sqlpp
new file mode 100644
index 0000000..58ca48a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 join 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-03.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ DBLP as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.sqlpp
new file mode 100644
index 0000000..b1a581f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 join 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-04.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ CSX as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..98a552e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.sqlpp
new file mode 100644
index 0000000..6d908cf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where (test."edit-distance-check"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.sqlpp
new file mode 100644
index 0000000..a6b1cd2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.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 : Self joins dataset DBLP, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."edit-distance-check"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.sqlpp
new file mode 100644
index 0000000..2550577
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index_DBLP on DBLP (nested.authors:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.sqlpp
new file mode 100644
index 0000000..1688938
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram index on authors, and we *do not* expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.sqlpp
new file mode 100644
index 0000000..163f151
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-contains function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-contains"(a.nested.authors,b.nested.authors,3)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.sqlpp
new file mode 100644
index 0000000..356d816
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * 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-join-noeqjoin_ngram-edit-distance-inline.adm"
+select element {'aauthors':a.nested.authors,'bauthors':b.nested.authors,'ed':ed}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance"(a.nested.authors,b.nested.authors)
+where ((ed < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.sqlpp
new file mode 100644
index 0000000..429958a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.nested.authors,b.nested.authors) < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.sqlpp
new file mode 100644
index 0000000..b9e2bb9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where ((test."edit-distance"(a.nested.authors,b.nested.authors) < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.sqlpp
new file mode 100644
index 0000000..dc53ff4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.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 : Self joins dataset DBLP, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."edit-distance"(a.nested.authors,b.nested.authors) < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.sqlpp
new file mode 100644
index 0000000..ac087b7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index_DBLP on DBLP (nested.authors:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.nested.authors,b.nested.authors) < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.sqlpp
new file mode 100644
index 0000000..28b0bfa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram index on authors, and we *do not* expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.nested.authors,b.nested.authors) < 3) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
new file mode 100644
index 0000000..4c6646c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.nested.authors ~= b.nested.authors) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp
new file mode 100644
index 0000000..4f391e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where ((a.nested.authors ~= b.nested.authors) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
new file mode 100644
index 0000000..d34082f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 : Self joins dataset DBLP, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((a.nested.authors ~= b.nested.authors) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.sqlpp
new file mode 100644
index 0000000..216aeb2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index_DBLP on DBLP (nested.authors:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.nested.authors ~= b.nested.authors) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.sqlpp
new file mode 100644
index 0000000..dcb2c4f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram index on authors, and we *do not* expect the join to be transformed into an indexed nested-loop join.
+ * 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.nested.authors ~= b.nested.authors) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..ef02155
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.nested.title,3,false) ~= test."gram-tokens"(b.nested.title,3,false)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..bae8d44
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where ((test."gram-tokens"(a.nested.title,3,false) ~= test."gram-tokens"(b.nested.title,3,false)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..6f918a5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Self joins dataset DBLP, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."gram-tokens"(a.nested.title,3,false) ~= test."gram-tokens"(b.nested.title,3,false)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.sqlpp
new file mode 100644
index 0000000..42ffaeb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.sqlpp
@@ -0,0 +1,76 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index_DBLP on DBLP (nested.title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.nested.title,3,false) ~= test."gram-tokens"(b.nested.title,3,false)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..7c2d5d8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..37ff0e0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..877d872
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 : Self joins dataset DBLP, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..ff308a7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index_DBLP on DBLP (nested.title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.sqlpp
new file mode 100644
index 0000000..198110f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * 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-join-noeqjoin_ngram-jaccard-inline.adm"
+select element {'atitle':a.nested.title,'btitle':b.nested.title,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false))
+where ((jacc >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.sqlpp
new file mode 100644
index 0000000..13e2a0e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on DBLP (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.sqlpp
new file mode 100644
index 0000000..90d0380
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPTypetmp as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index on CSX (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.sqlpp
new file mode 100644
index 0000000..21ce12f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 : Self joins dataset DBLP, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.sqlpp
new file mode 100644
index 0000000..d503ef7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index ngram_index_DBLP on DBLP (nested.title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (nested.title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.nested.title,3,false),test."gram-tokens"(b.nested.title,3,false)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..f590056
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.nested.title) ~= test."word-tokens"(b.nested.title)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..b8b1606
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on CSX (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where ((test."word-tokens"(a.nested.title) ~= test."word-tokens"(b.nested.title)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..70393dd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 : Self joins dataset DBLP, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."word-tokens"(a.nested.title) ~= test."word-tokens"(b.nested.title)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.sqlpp
new file mode 100644
index 0000000..004ebb1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index_DBLP on DBLP (nested.title:string) type keyword enforced;
+
+create index keyword_index_CSX on CSX (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.nested.title) ~= test."word-tokens"(b.nested.title)) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
new file mode 100644
index 0000000..d1861c2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 : Fuzzy self joins a dataset, TweetMessages, based on the similarity-jaccard-check function of its text-messages' word tokens.
+ * TweetMessages has a keyword index on text-message and btree index on the primary key tweetid, and we expect the join to be
+ * transformed into btree and inverted indexed nested-loop joins. We test whether the join condition can be transformed into
+ * multiple indexed nested loop joins of various type of indexes.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index twmSndLocIx on TweetMessages (nested."sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (nested.countA) type btree;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+create index msgTextIx on TweetMessages (nested."message-text":string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm"
+select element {'t1':t1.nested.tweetid,'t2':t2.nested.tweetid,'sim':sim[1]}
+from TweetMessages as t1,
+ TweetMessages as t2
+with sim as test."similarity-jaccard-check"(test."word-tokens"(t1.nested."message-text"),test."word-tokens"(t2.nested."message-text"),0.600000f)
+where (sim[0] and (t1.nested.tweetid < test.int64('20')) and (t2.nested.tweetid != t1.nested.tweetid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..8315087
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..2f1a193
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on CSX (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..574fa08
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.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 : Selg joins dataset DBLP, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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_DBLP on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..c39897a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+create index keyword_index on CSX (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title),0.500000f)[0] and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.sqlpp
new file mode 100644
index 0000000..2cea216
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
+ * 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-join-noeqjoin_word-jaccard-inline.adm"
+select element {'atitle':a.nested.title,'btitle':b.nested.title,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title))
+where ((jacc >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.sqlpp
new file mode 100644
index 0000000..8db124f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.sqlpp
new file mode 100644
index 0000000..f9bda14
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on CSX (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from CSX as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.sqlpp
new file mode 100644
index 0000000..5bf70fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.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 : Self joins dataset DBLP, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.sqlpp
new file mode 100644
index 0000000..3a8fb16
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has a keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop 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.CSXTypetmp as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.DBLPType as
+ closed {
+ nested : DBLPTypetmp
+}
+
+create type test.CSXType as
+ closed {
+ nested : CSXTypetmp
+}
+
+create table DBLP(DBLPType) primary key nested.id;
+
+create table CSX(CSXType) primary key nested.id;
+
+create index keyword_index on DBLP (nested.title:string) type keyword enforced;
+
+create index keyword_index on CSX (nested.title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.nested.title),test."word-tokens"(b.nested.title)) >= 0.500000f) and (a.nested.id < b.nested.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
new file mode 100644
index 0000000..4068562
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
@@ -0,0 +1,79 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index twmSndLocIx on TweetMessages (nested."sender-location":point) type rtree enforced;
+
+create index msgCountAIx on TweetMessages (nested.countA) type btree;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+create index msgTextIx on TweetMessages (nested."message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm"
+select element {'tweetid1':t1.nested.tweetid,'loc1':t1.nested."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.nested.tweetid,'loc2':t2.nested."sender-location"}
+ from TweetMessages as t2
+ where test."spatial-intersect"(t2.nested."sender-location",n)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1.nested."sender-location",0.5)
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
new file mode 100644
index 0000000..00f174b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
@@ -0,0 +1,79 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageNestedType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create type test.TweetMessageType as
+{
+ nested : TweetMessageNestedType
+}
+
+create table TweetMessages(TweetMessageType) primary key nested.tweetid;
+
+create index twmSndLocIx on TweetMessages (nested."sender-location":point) type rtree enforced;
+
+create index msgCountAIx on TweetMessages (nested.countA) type btree;
+
+create index msgCountBIx on TweetMessages (nested.countB) type btree;
+
+create index msgTextIx on TweetMessages (nested."message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm"
+select element {'tweetid1':t1.nested.tweetid,'loc1':t1.nested."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.nested.tweetid,'loc2':t2.nested."sender-location"}
+ from TweetMessages as t2
+ where (test."spatial-intersect"(t2.nested."sender-location",n) and (t1.nested.tweetid != t2.nested.tweetid))
+ order by t2.nested.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1.nested."sender-location",0.5)
+where (t1.nested.tweetid < test.int64('10'))
+order by t1.nested.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.sqlpp
new file mode 100644
index 0000000..0458c9f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData1' has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordNested as
+ closed {
+ nested : MyRecord
+}
+
+create table MyData1(MyRecordNested) primary key nested.id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData1 (nested.point) type rtree;
+
+write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.nested.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.sqlpp
new file mode 100644
index 0000000..7893c9b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData2' has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordNested as
+ closed {
+ nested : MyRecord
+}
+
+create table MyData1(MyRecordNested) primary key nested.id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData2 (point) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.nested.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.sqlpp
new file mode 100644
index 0000000..35c6196
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.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 : Self-joins a dataset on the intersection of its point attribute.
+ * The dataset has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordNested as
+ closed {
+ nested : MyRecord
+}
+
+create table MyData(MyRecordNested) primary key nested.id;
+
+create index rtree_index on MyData (nested.point) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_03.adm"
+select element {'a':a,'b':b}
+from MyData as a,
+ MyData as b
+where test."spatial-intersect"(a.nested.point,b.nested.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.sqlpp
new file mode 100644
index 0000000..fcd5ac4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * Both datasets 'MyData' and 'MyData2' have an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecordNestedOpen as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordOpen as
+ closed {
+ nested : MyRecordNestedOpen
+}
+
+create table MyData1(MyRecordOpen) primary key nested.id;
+
+create table MyData2(MyRecordOpen) primary key nested.id;
+
+create index rtree_index on MyData1 (nested.point:point) type rtree enforced;
+
+create index rtree_index2 on MyData2 (nested.point:point) type rtree enforced;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.nested.point,b.nested.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.sqlpp
new file mode 100644
index 0000000..39a7c66
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * Only dataset 'MyData1' has an enforced open RTree index, hence we
+ * *do not* expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecordNestedOpen as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordOpen as
+ closed {
+ nested : MyRecordNestedOpen
+}
+
+create table MyData1(MyRecordOpen) primary key nested.id;
+
+create table MyData2(MyRecordOpen) primary key nested.id;
+
+create index rtree_index on MyData1 (nested.point:point) type rtree enforced;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.nested.point,b.nested.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested_loj2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested_loj2.sqlpp
new file mode 100644
index 0000000..1abe40e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested_loj2.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems(LineItemType) primary key l_orderkey,l_linenumber on group1;
+
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+write output to nc1:"/tmp/nested_loj.adm"
+select element {'cust':c,'orders':orders}
+from Customers as c
+with orders as (
+ select element {'order':o,'items':items}
+ from Orders as o
+ with items as (
+ select element l
+ from LineItems as l
+ where (l.l_orderkey = o.o_orderkey)
+ )
+ where (o.o_custkey = c.c_custkey)
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested_loj3.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested_loj3.sqlpp
new file mode 100644
index 0000000..93c153d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nested_loj3.sqlpp
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems(LineItemType) primary key l_orderkey,l_linenumber on group1;
+
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+create table PartSupp(PartSuppType) primary key ps_partkey,ps_suppkey on group1;
+
+write output to nc1:"/tmp/nested_loj.adm"
+select element {'cust':c,'orders':orders}
+from Customers as c
+with orders as (
+ select element {'order':o,'items':items}
+ from Orders as o
+ with items as (
+ select element {'item':l,'part_supplier':partsupp}
+ from LineItems as l
+ with partsupp as (
+ select element ps
+ from PartSupp as ps
+ where ((ps.ps_partkey = l.l_partkey) and (ps.ps_suppkey = l.l_suppkey))
+ )
+ where (l.l_orderkey = o.o_orderkey)
+ )
+ where (o.o_custkey = c.c_custkey)
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.sqlpp
new file mode 100644
index 0000000..3e78b25
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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 : Disjunctive predicate should be transformed into collection scan.
+ * Secondary index should be used to probe the values retrieved from collection.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TestType as
+{
+ id : string,
+ "no-idx" : string
+}
+
+create table TestSet(TestType) primary key id;
+
+create index TestSetIndex on TestSet (idx:string) type btree enforced;
+
+select element x
+from TestSet as x
+where ((x.idx = 'one') or (x.idx = 'two'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.sqlpp
new file mode 100644
index 0000000..f3b1479
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index msgCountBIx on TweetMessages (countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm"
+select element {'tweetid1':t1.tweetid,'count1':t1.countA,'t2info':(
+ select element {'tweetid2':t2.tweetid,'count2':t2.countB}
+ from TweetMessages as t2
+ where (t1.countA /*+ indexnl */ = t2.countB)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.sqlpp
new file mode 100644
index 0000000..60e721e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index msgCountAIx on TweetMessages (countA:int32) type btree enforced;
+
+create index msgCountBIx on TweetMessages (countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm"
+select element {'tweetid1':t1.tweetid,'count1':t1.countA,'t2info':(
+ select element {'tweetid2':t2.tweetid,'count2':t2.countB}
+ from TweetMessages as t2
+ where (t1.countA /*+ indexnl */ = t2.countB)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.sqlpp
new file mode 100644
index 0000000..148a4f4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.sqlpp
@@ -0,0 +1,67 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index msgCountBIx on TweetMessages (countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm"
+select element {'tweetid1':t1.tweetid,'count1':t1.countA,'t2info':(
+ select element {'tweetid2':t2.tweetid,'count2':t2.countB}
+ from TweetMessages as t2
+ where ((t1.countA /*+ indexnl */ = t2.countB) and (t1.tweetid != t2.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.sqlpp
new file mode 100644
index 0000000..ab89fab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary btree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index msgCountAIx on TweetMessages (countA:int32) type btree enforced;
+
+create index msgCountBIx on TweetMessages (countB:int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm"
+select element {'tweetid1':t1.tweetid,'count1':t1.countA,'t2info':(
+ select element {'tweetid2':t2.tweetid,'count2':t2.countB}
+ from TweetMessages as t2
+ where ((t1.countA /*+ indexnl */ = t2.countB) and (t1.tweetid != t2.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.sqlpp
new file mode 100644
index 0000000..5533e0a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ > emp2.fname) and (emp1.lname /*+ indexnl */ > emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.sqlpp
new file mode 100644
index 0000000..0381eb5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ < emp2.fname) and (emp1.lname /*+ indexnl */ < emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.sqlpp
new file mode 100644
index 0000000..ea10df7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ = emp2.fname) and (emp1.lname /*+ indexnl */ = emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.sqlpp
new file mode 100644
index 0000000..06c22a3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_01.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ < emp2.fname) and (emp1.lname /*+ indexnl */ > emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.sqlpp
new file mode 100644
index 0000000..7e113f4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_02.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ > emp2.fname) and (emp1.lname /*+ indexnl */ < emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.sqlpp
new file mode 100644
index 0000000..cc1809f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_03.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ > emp2.fname) and (emp1.lname /*+ indexnl */ = emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.sqlpp
new file mode 100644
index 0000000..8513c6b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_04.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ < emp2.fname) and (emp1.lname /*+ indexnl */ = emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.sqlpp
new file mode 100644
index 0000000..c3aaad7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_05.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ = emp2.fname) and (emp1.lname /*+ indexnl */ > emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.sqlpp
new file mode 100644
index 0000000..0c6b8a3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to use an indexed nested-loops join plan in both predicates.
+ * : We expect a plan to have a self-join, which probes dataset Names’s with a prefix of its secondary index.
+ * Expected Res : Success
+ * Date : 11th November 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.Name as
+{
+ id : int32
+}
+
+create table Names(Name) primary key id;
+
+create index Name_idx on Names (fname:string,lname:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_06.adm"
+select element {'emp1':emp1,'emp2':emp2}
+from Names as emp1,
+ Names as emp2
+where ((emp1.fname /*+ indexnl */ = emp2.fname) and (emp1.lname /*+ indexnl */ < emp2.lname))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.sqlpp
new file mode 100644
index 0000000..97117f6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Equi joins two datasets, FacebookUsers and FacebookMessages, based on their user's id.
+ * We first expect FacebookUsers' primary index to be used
+ * to satisfy the range condition on it's primary key.
+ * FacebookMessages has a secondary btree open index on author-id-copy, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.EmploymentType as
+ closed {
+ "organization-name" : string,
+ "start-date" : date,
+ "end-date" : date?
+}
+
+create type test.FacebookUserType as
+ closed {
+ id : int32,
+ "id-copy" : int32,
+ alias : string,
+ name : string,
+ "user-since" : datetime,
+ "user-since-copy" : datetime,
+ "friend-ids" : {{int32}},
+ employment : [EmploymentType]
+}
+
+create type test.FacebookMessageType as
+{
+ "message-id" : int32,
+ "message-id-copy" : int32,
+ "author-id" : int32,
+ "in-response-to" : int32?,
+ "sender-location" : point?,
+ message : string
+}
+
+create table FacebookUsers(FacebookUserType) primary key id;
+
+create table FacebookMessages(FacebookMessageType) primary key "message-id";
+
+create index fbmIdxAutId if not exists on FacebookMessages ("author-id-copy":int32) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multiindex.adm"
+select element {'fbu-ID':user.id,'fbm-auth-ID':message."author-id",'uname':user.name,'message':message.message}
+from FacebookUsers as user,
+ FacebookMessages as message
+where ((user.id /*+ indexnl */ = message."author-id-copy") and (user.id >= 11000) and (user.id <= 12000))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.sqlpp
new file mode 100644
index 0000000..a24c904
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * We expect the additional predicates to be put into a select above the
+ * primary index search.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on DBLP (title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.title /*+ indexnl */ = b.title) and (a.authors < b.authors) and (a.misc > b.misc))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.sqlpp
new file mode 100644
index 0000000..370dfb4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree open index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on DBLP (title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.sqlpp
new file mode 100644
index 0000000..091c7ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * CSX has a secondary btree open index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on CSX (title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.sqlpp
new file mode 100644
index 0000000..dd0e8a2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Equi self-joins a dataset, DBLP, based on its title.
+ * DBLP has a secondary btree open index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index title_index on DBLP (title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.sqlpp
new file mode 100644
index 0000000..25ad745
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * Both DBLP and CSX have secondary btree open index on title, and given the 'indexnl' hint
+ * we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index_DBLP on DBLP (title:string) type btree enforced;
+
+create index title_index on CSX (title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.sqlpp
new file mode 100644
index 0000000..d4e7952
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Equi joins two datasets, DBLP and CSX, based on their title.
+ * DBLP has a secondary btree open index on title, and given the 'indexnl' hint
+ * we *do not* expect the join to be transformed into an indexed nested-loop join,
+ * because CSX does not declare an enforced open index on field title.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index title_index on DBLP (title:string) type btree enforced;
+
+write output to nc1:"rttest/btree-index-join_title-secondary-equi-join_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (a.title /*+ indexnl */ = b.title)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-33.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-33.sqlpp
new file mode 100644
index 0000000..7db87d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-33.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 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.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname > 'Roger')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-34.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-34.sqlpp
new file mode 100644
index 0000000..9241ab4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-34.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-32.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname >= 'Susan')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-35.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-35.sqlpp
new file mode 100644
index 0000000..d957ed4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-35.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-33.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname < 'Isa')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-36.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-36.sqlpp
new file mode 100644
index 0000000..62f8eed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-36.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-34.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname <= 'Vanpatten')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-37.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-37.sqlpp
new file mode 100644
index 0000000..12ab41f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-37.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-35.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname != 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-38.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-38.sqlpp
new file mode 100644
index 0000000..4b04e48
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-38.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-36.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname = 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-39.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-39.sqlpp
new file mode 100644
index 0000000..de76f42
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-39.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-37.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.lname = 'Kim')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-40.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-40.sqlpp
new file mode 100644
index 0000000..93a7d0a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-40.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-38.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Young Seok') and (emp.lname = 'Kim'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-41.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-41.sqlpp
new file mode 100644
index 0000000..4fabbcc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-41.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-39.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') or (emp.lname = 'Malaika'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-42.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-42.sqlpp
new file mode 100644
index 0000000..57133c9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-42.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-40.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Alex') and (emp.lname < 'Zach'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-43.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-43.sqlpp
new file mode 100644
index 0000000..ea39a03
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-43.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-41.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Allan') and (emp.lname < 'Zubi'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-44.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-44.sqlpp
new file mode 100644
index 0000000..6845569
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-44.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-42.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Allan') and (emp.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-45.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-45.sqlpp
new file mode 100644
index 0000000..a574bf3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-45.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-43.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') and (emp.lname < 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-46.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-46.sqlpp
new file mode 100644
index 0000000..706afd7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-46.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-44.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Michael') and (emp.lname <= 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-47.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-47.sqlpp
new file mode 100644
index 0000000..878e264
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-47.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-45.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-48.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-48.sqlpp
new file mode 100644
index 0000000..11562fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-48.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-46.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname >= 'Kevin') and (emp.fname <= 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-49.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-49.sqlpp
new file mode 100644
index 0000000..ea4f4fe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-49.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-47.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname <= 'Craig') and (emp.lname > 'Kevin'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-50.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-50.sqlpp
new file mode 100644
index 0000000..1a1c090
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-50.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-48.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname != 'Michael') and (emp.lname != 'Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-51.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-51.sqlpp
new file mode 100644
index 0000000..a1f1135
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-51.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-49.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname <= 'Mary') and (emp.lname <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-52.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-52.sqlpp
new file mode 100644
index 0000000..fa3f16e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-52.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-50.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname >= 'Kevin') and (emp.fname < 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-53.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-53.sqlpp
new file mode 100644
index 0000000..1c5656b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-53.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-51.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Craig') and (emp.lname <= 'Kevin') and (emp.fname <= 'Mary') and (emp.lname >= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-54.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-54.sqlpp
new file mode 100644
index 0000000..4c764fe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-54.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-52.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname > 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-55.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-55.sqlpp
new file mode 100644
index 0000000..5d2bd3f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-55.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-53.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname >= 'Sofia')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-56.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-56.sqlpp
new file mode 100644
index 0000000..b4d8ca6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-56.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-54.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname < 'Chen')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-57.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-57.sqlpp
new file mode 100644
index 0000000..d247975
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-57.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-55.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname <= 'Julio')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-58.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-58.sqlpp
new file mode 100644
index 0000000..062cd2d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-58.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-56.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Neil') and (emp.fname < 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-59.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-59.sqlpp
new file mode 100644
index 0000000..c6cfbdd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-59.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-57.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname >= 'Max') and (emp.fname <= 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-60.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-60.sqlpp
new file mode 100644
index 0000000..cf717f8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-60.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-58.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where (emp.fname = 'Max')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-61.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-61.sqlpp
new file mode 100644
index 0000000..05fedeb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-61.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : 26th Mar 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-49.adm"
+create type test.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname > 'Craig') and (emp.lname > 'Kevin') and (emp.fname <= 'Mary') and (emp.lname < 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-62.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-62.sqlpp
new file mode 100644
index 0000000..8b1ca74
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-62.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname = 'Julio') and (emp.lname > 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-63.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-63.sqlpp
new file mode 100644
index 0000000..582f8a7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/btree-index/btree-secondary-63.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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.TestType as
+{
+ id : int32
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname:string,lname:string) type btree enforced;
+
+select element emp
+from testdst as emp
+where ((emp.fname < 'Julio') and (emp.lname = 'Xu'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.sqlpp
new file mode 100644
index 0000000..7245e87
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.title,'Mu')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.sqlpp
new file mode 100644
index 0000000..ba79dc4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.title,'Multimedia')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
new file mode 100644
index 0000000..275b63d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.authors,'Amihay Motro',5)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.sqlpp
new file mode 100644
index 0000000..0802881
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.authors,'Amihay Motro',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.sqlpp
new file mode 100644
index 0000000..93ef239
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.authors,'Amihay Motro') <= 5)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.sqlpp
new file mode 100644
index 0000000..0bdf6d1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.authors,'Amihay Motro') <= 1)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.sqlpp
new file mode 100644
index 0000000..be662b1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.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 : 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.authors ~= 'Amihay Motro')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..59a4489
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.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 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.title,3,false) ~= test."gram-tokens"('Transactions for Cooperative Environments',3,false))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.sqlpp
new file mode 100644
index 0000000..78c7f4b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.sqlpp
new file mode 100644
index 0000000..db169b2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (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.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false)) >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-contains.sqlpp
new file mode 100644
index 0000000..d1da134
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-contains.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (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.title,'Multimedia')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.sqlpp
new file mode 100644
index 0000000..210f38f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.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 : Tests whether a keyword is applied to optimize a selection query with ~= using Jaccard on word tokens.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element o
+from DBLP as o
+where (test."word-tokens"(o.title) ~= test."word-tokens"('Transactions for Cooperative Environments'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.sqlpp
new file mode 100644
index 0000000..bc3b644
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 similarity-jaccard-check function on word tokens.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard-check.adm"
+select element o
+from DBLP as o
+where test."similarity-jaccard-check"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.sqlpp
new file mode 100644
index 0000000..93c9882
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 similarity-jaccard function on word tokens.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard.adm"
+select element o
+from DBLP as o
+where (test."similarity-jaccard"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments')) >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.sqlpp
new file mode 100644
index 0000000..b0a7e95
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.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 : Tests whether an ngram_index is applied to optimize a selection query using
+ * two edit-distance-check function of which only the first can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with eda as test."edit-distance-check"(o.authors,'Amihay Motro',3),
+ edb as test."edit-distance-check"(o.authors,'Amihay Motro',5)
+where (eda[0] and edb[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.sqlpp
new file mode 100644
index 0000000..63752f1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.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 : Tests whether an ngram_index is applied to optimize a selection query using
+ * two edit-distance-check function of which only the second can be optimized with an index.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm"
+select element o
+from DBLP as o
+with edb as test."edit-distance-check"(o.authors,'Amihay Motro',5),
+ eda as test."edit-distance-check"(o.authors,'Amihay Motro',3)
+where (edb[0] and eda[0])
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp
new file mode 100644
index 0000000..3a4f02e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should *not* be applied (see below).
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm"
+select element o
+from DBLP as o
+with ed as test."edit-distance-check"(o.authors,'Amihay Motro',5)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.sqlpp
new file mode 100644
index 0000000..f76aa93
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let.adm"
+select element o
+from DBLP as o
+with ed as test."edit-distance-check"(o.authors,'Amihay Motro',1)
+where ed[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp
new file mode 100644
index 0000000..cdbcbc5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 index is applied to optimize a selection query using the similarity-edit-distance-check function on the substring of the field.
+ * Tests that the optimizer rule correctly drills through the substring function.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm"
+select element {'id':paper.id,'title':paper.title}
+from DBLP as paper
+where test."edit-distance-check"(test.substring(paper.title,0,8),'datbase',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp
new file mode 100644
index 0000000..d1f8bf0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 index is applied to optimize a selection query using the similarity-edit-distance-check function on individual word tokens.
+ * Tests that the optimizer rule correctly drills through the word-tokens function and existential query.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-word-tokens.adm"
+select element {'id':paper.id,'title':paper.title}
+from DBLP as paper,
+ test."word-tokens"(paper.title) as word
+where test."edit-distance-check"(word,'Multmedia',1)[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..2faf06a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.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 : Tests whether an ngram_index is applied to optimize a selection query using the similarity-jaccard-check function on 3-gram tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."gram-tokens"(o.title,3,false),test."gram-tokens"('Transactions for Cooperative Environments',3,false),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..9a7ea07
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.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 similarity-jaccard-check function on 3-gram tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."gram-tokens"(paper.title,3,false),
+ query_tokens as test."gram-tokens"('Transactions for Cooperative Environments',3,false),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.sqlpp
new file mode 100644
index 0000000..05b253e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-let.adm"
+select element o
+from DBLP as o
+with jacc as test."similarity-jaccard-check"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments'),0.500000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.sqlpp
new file mode 100644
index 0000000..0796a6a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.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 : Tests whether a keyword index is applied to optimize a selection query using the similarity-jaccard-check function on word tokens.
+ * Tests that the optimizer rule correctly drills through the let clauses.
+ * The index should be applied.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-complex_word-jaccard-check-multi-let.adm"
+select element {'Paper':paper_tokens,'Query':query_tokens}
+from DBLP as paper
+with paper_tokens as test."word-tokens"(paper.title),
+ query_tokens as test."word-tokens"('Transactions for Cooperative Environments'),
+ jacc as test."similarity-jaccard-check"(paper_tokens,query_tokens,0.800000f)
+where jacc[0]
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
new file mode 100644
index 0000000..549959d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index msgNgramIx on TweetMessages ("message-text":string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm"
+select element {'tweet':{'id':t1.tweetid,'topics':t1."message-text"},'similar-tweets':(
+ select element {'id':t2.tweetid,'topics':t2."message-text"}
+ from TweetMessages as t2
+ with sim as test."edit-distance-check"(t1."message-text",t2."message-text",7)
+ where (sim[0] and (t2.tweetid != t1.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+where (t1.tweetid > test.int64('240'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.sqlpp
new file mode 100644
index 0000000..34dd9fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 join 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-01.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ CSX as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.sqlpp
new file mode 100644
index 0000000..bbccf5e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 join 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.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-02.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ CSX as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.sqlpp
new file mode 100644
index 0000000..58ca48a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 join 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-03.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ DBLP as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.sqlpp
new file mode 100644
index 0000000..b1a581f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 join 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.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-contains-04.adm"
+select element {'title1':o1.title,'title2':o2.title}
+from DBLP as o1,
+ CSX as o2
+where (test.contains(o1.title,o2.title) and (o1.id < o2.id))
+order by o1.id,o2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..aad6109
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.sqlpp
new file mode 100644
index 0000000..cdce39b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * CSX has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.sqlpp
new file mode 100644
index 0000000..2f9643b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance-check function of its authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.sqlpp
new file mode 100644
index 0000000..8d9cc00
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP and CSX both have a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (authors:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.sqlpp
new file mode 100644
index 0000000..2ebf73a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-check function of their authors.
+ * DBLP has a 3-gram enforced open index on authors, and we *do not* expect the join to be transformed
+ * into an indexed nested-loop join, because CSX does not declare an enforced open index on field authors.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-check"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.sqlpp
new file mode 100644
index 0000000..27e9de2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance-check function of its authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-check_04.adm"
+select element {'arec':a,'brec':b,'ed':ed[1]}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance-check"(a.authors,b.authors,3)
+where (ed[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.sqlpp
new file mode 100644
index 0000000..ce38c41
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-contains function of their authors.
+ * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."edit-distance-contains"(a.authors,b.authors,3)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.sqlpp
new file mode 100644
index 0000000..d488fae
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.sqlpp
new file mode 100644
index 0000000..0078883
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * CSX has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.sqlpp
new file mode 100644
index 0000000..d1bd58b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.sqlpp
new file mode 100644
index 0000000..8f4f23e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP and CSX both have a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (authors:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.sqlpp
new file mode 100644
index 0000000..c992c27
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
+ * DBLP has a 3-gram enforced open index on authors, and we *do not* expect the join to be transformed
+ * into an indexed nested-loop join, because CSX does not declare an enforced open index on field authors.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."edit-distance"(a.authors,b.authors) < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.sqlpp
new file mode 100644
index 0000000..8a1d662
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.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 : Fuzzy self joins a dataset, DBLP, based on the edit-distance function of its authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-edit-distance_03.adm"
+select element {'arec':a,'brec':b,'ed':ed}
+from DBLP as a,
+ DBLP as b
+with ed as test."edit-distance"(a.authors,b.authors)
+where ((ed < 3) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
new file mode 100644
index 0000000..780cdd0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp
new file mode 100644
index 0000000..e456889
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * CSX has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.sqlpp
new file mode 100644
index 0000000..3151d92
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.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 : Fuzzy self joins a dataset, DBLP, based on ~= using edit distance of its authors.
+ * DBLP has a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_03.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.sqlpp
new file mode 100644
index 0000000..eb3a137
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP and CSX both have a 3-gram enforced open index on authors, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (authors:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.sqlpp
new file mode 100644
index 0000000..002c5d5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors.
+ * DBLP has a 3-gram enforced open index on authors, and we *do not* expect the join to be transformed
+ * into an indexed nested-loop join, because CSX does not declare an enforced open index on field authors.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (authors:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "3";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((a.authors ~= b.authors) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..79012f3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy joins two datasets, open DBLP and closed CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..dadeb9d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Fuzzy joins two datasets, closed DBLP and open CSX, based on ~= using Jaccard their titles' 3-gram tokens.
+ * CSX has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_02.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..a3d8a69
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.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 : Fuzzy self joins a dataset, DBLP, based on ~= using Jaccard of its titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_03.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.sqlpp
new file mode 100644
index 0000000..441e382
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' 3-gram tokens.
+ * DBLP and CSX both have a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."gram-tokens"(a.title,3,false) ~= test."gram-tokens"(b.title,3,false)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..67e43d5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy joins two datasets, open DBLP and closed CSX, based on the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..dfd8194
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy joins two datasets, closed DBLP and open CSX, based the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * CSX has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..526fb3a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.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 : Fuzzy self joins an open dataset DBLP, based on the similarity-jaccard-check function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..2b06b29
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based the similarity-jaccard-check function of their titles' 3-gram tokens.
+ * DBLP and CSX both have a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.sqlpp
new file mode 100644
index 0000000..a085a61
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard-check_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc[1]}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard-check"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false),0.500000f)
+where (jacc[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.sqlpp
new file mode 100644
index 0000000..1c681ec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.sqlpp
new file mode 100644
index 0000000..e4db9e6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based the similarity-jaccard function of their titles' 3-gram tokens.
+ * CSX has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.sqlpp
new file mode 100644
index 0000000..d57a38b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.sqlpp
new file mode 100644
index 0000000..59f521e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based the similarity-jaccard function of their titles' 3-gram tokens.
+ * DBLP and CSX both have a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index ngram_index_DBLP on DBLP (title:string) type ngram (3) enforced;
+
+create index ngram_index_CSX on CSX (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.sqlpp
new file mode 100644
index 0000000..7cc9969
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' 3-gram tokens.
+ * DBLP has a 3-gram enforced open index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+set "import-private-functions" "true";
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title:string) type ngram (3) enforced;
+
+write output to nc1:"rttest/inverted-index-join_ngram-jaccard_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."gram-tokens"(a.title,3,false),test."gram-tokens"(b.title,3,false))
+where ((jacc >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
new file mode 100644
index 0000000..4e35c80
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp
new file mode 100644
index 0000000..a33e9d0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * CSX has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on CSX (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_02.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.sqlpp
new file mode 100644
index 0000000..9f09553
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.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 : Fuzzy self joins a dataset, DBLP, based on ~= using Jaccard of its titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_03.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.sqlpp
new file mode 100644
index 0000000..6816885
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard of their titles' word tokens.
+ * DBLP and CSX both have an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index_DBLP on DBLP (title:string) type keyword enforced;
+
+create index keyword_index_CSX on CSX (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.5f";
+
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."word-tokens"(a.title) ~= test."word-tokens"(b.title)) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
new file mode 100644
index 0000000..5620d1a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 : Fuzzy self joins a dataset, TweetMessages, based on the similarity-jaccard-check function of its text-messages' word tokens.
+ * TweetMessages has a keyword index on text-message and btree index on the primary key tweetid, and we expect the join to be
+ * transformed into btree and inverted indexed nested-loop joins. We test whether the join condition can be transformed into
+ * multiple indexed nested loop joins of various type of indexes.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text":string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm"
+select element {'t1':t1.tweetid,'t2':t2.tweetid,'sim':sim[1]}
+from TweetMessages as t1,
+ TweetMessages as t2
+with sim as test."similarity-jaccard-check"(test."word-tokens"(t1."message-text"),test."word-tokens"(t2."message-text"),0.600000f)
+where (sim[0] and (t1.tweetid < test.int64('20')) and (t2.tweetid != t1.tweetid))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..b4df5ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..54576d9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * CSX has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on CSX (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..e6b89bf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..c911894
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard-check function of their titles' word tokens.
+ * DBLP and CSX both have an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index_DBLP on DBLP (title:string) type keyword enforced;
+
+create index keyword_index_CSX on CSX (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where (test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.sqlpp
new file mode 100644
index 0000000..ad51a9d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard-check function of its titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard-check_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc[1]}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard-check"(test."word-tokens"(a.title),test."word-tokens"(b.title),0.500000f)
+where (jacc[0] and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.sqlpp
new file mode 100644
index 0000000..c59290b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+ closed {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.sqlpp
new file mode 100644
index 0000000..21a1b75
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * CSX has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index on CSX (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_02.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.sqlpp
new file mode 100644
index 0000000..597d60c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_03.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ DBLP as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.sqlpp
new file mode 100644
index 0000000..8bfbcc1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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 : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' word tokens.
+ * DBLP and CSX both have an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create type test.CSXType as
+{
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create table CSX(CSXType) primary key id;
+
+create index keyword_index_DBLP on DBLP (title:string) type keyword enforced;
+
+create index keyword_index_CSX on CSX (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_01.adm"
+select element {'arec':a,'brec':b}
+from DBLP as a,
+ CSX as b
+where ((test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title)) >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.sqlpp
new file mode 100644
index 0000000..c1cd43d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.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 : Fuzzy self joins a dataset, DBLP, based on the similarity-jaccard function of its titles' word tokens.
+ * DBLP has an enforced open keyword index on title, and we expect the join to be transformed into an indexed nested-loop join.
+ * We test the inlining of variables that enable the select to be pushed into the join for subsequent optimization with an index.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title:string) type keyword enforced;
+
+write output to nc1:"rttest/inverted-index-join_word-jaccard_04.adm"
+select element {'arec':a,'brec':b,'jacc':jacc}
+from DBLP as a,
+ DBLP as b
+with jacc as test."similarity-jaccard"(test."word-tokens"(a.title),test."word-tokens"(b.title))
+where ((jacc >= 0.500000f) and (a.id < b.id))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
new file mode 100644
index 0000000..0df4508
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location":point) type rtree enforced;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm"
+select element {'tweetid1':t1.tweetid,'loc1':t1."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.tweetid,'loc2':t2."sender-location"}
+ from TweetMessages as t2
+ where test."spatial-intersect"(t2."sender-location",n)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1."sender-location",0.5)
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
new file mode 100644
index 0000000..09a8e9d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
@@ -0,0 +1,74 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location":point) type rtree enforced;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm"
+select element {'tweetid1':t1.tweetid,'loc1':t1."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.tweetid,'loc2':t2."sender-location"}
+ from TweetMessages as t2
+ where (test."spatial-intersect"(t2."sender-location",n) and (t1.tweetid != t2.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1."sender-location",0.5)
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.sqlpp
new file mode 100644
index 0000000..853cbcc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData1' has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordOpen as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData1(MyRecordOpen) primary key id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData1 (point:point) type rtree enforced;
+
+write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.sqlpp
new file mode 100644
index 0000000..d6aaacb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData2' has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create type test.MyRecordOpen as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData1(MyRecord) primary key id;
+
+create table MyData2(MyRecordOpen) primary key id;
+
+create index rtree_index on MyData2 (point:point) type rtree enforced;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.sqlpp
new file mode 100644
index 0000000..7a0ff8a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.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 : Self-joins a dataset on the intersection of its point attribute.
+ * The dataset has an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData(MyRecord) primary key id;
+
+create index rtree_index on MyData (point:point) type rtree enforced;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_03.adm"
+select element {'a':a,'b':b}
+from MyData as a,
+ MyData as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.sqlpp
new file mode 100644
index 0000000..051e695
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.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 : Joins two datasets on the intersection of their point attributes.
+ * Both datasets 'MyData' and 'MyData2' have an enforced open RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData1(MyRecord) primary key id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData1 (point:point) type rtree enforced;
+
+create index rtree_index2 on MyData2 (point:point) type rtree enforced;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.sqlpp
new file mode 100644
index 0000000..01015ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.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 : Joins two datasets on the intersection of their point attributes.
+ * Only dataset 'MyData1' has an enforced open RTree index, hence we
+ * *do not* expect the join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+{
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData1(MyRecord) primary key id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData1 (point:point) type rtree enforced;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orderby-desc-using-gby.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orderby-desc-using-gby.sqlpp
new file mode 100644
index 0000000..34a82ef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orderby-desc-using-gby.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+drop database "gby-using-orderby-desc" if exists;
+create database "gby-using-orderby-desc";
+
+use "gby-using-orderby-desc";
+
+
+create type "gby-using-orderby-desc".AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type "gby-using-orderby-desc".CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Customers(CustomerType) primary key cid on group1;
+
+write output to nc1:"rttest/gby-using-orderby-desc.adm"
+select element {'name':name,'age':age}
+from Customers as c
+group by c.name as name
+order by name desc,age
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.sqlpp
new file mode 100644
index 0000000..4835a59
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.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.
+ */
+
+drop database "orders-aggreg" if exists;
+create database "orders-aggreg";
+
+use "orders-aggreg";
+
+
+create type "orders-aggreg".OrderType as
+ closed {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key oid on group1;
+
+write output to nc1:"/tmp/orders-aggreg.adm"
+select element {'cid':cid,'ordpercust':"orders-aggreg".count(o),'totalcust':"orders-aggreg".sum((
+ select element i.total
+ from o as i
+ )),'avgcust':"orders-aggreg".avg((
+ select element i.total
+ from o as i
+ ))}
+from Orders as o
+group by o.cid as cid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-composite-index-search.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-composite-index-search.sqlpp
new file mode 100644
index 0000000..c8efddd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-composite-index-search.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+drop database index_search if exists;
+create database index_search;
+
+use index_search;
+
+
+create type index_search.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create table Orders(OrderType) primary key o_orderkey;
+
+create index idx_Custkey_Orderstatus on Orders (o_custkey,o_orderstatus) type btree;
+
+write output to nc1:"/tmp/index_search.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey,'o_orderstatus':o.o_orderstatus}
+from Orders as o
+where ((o.o_custkey = 40) and (o.o_orderstatus = 'P'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive-open_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive-open_01.sqlpp
new file mode 100644
index 0000000..faba2ef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive-open_01.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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+{
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+load table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+create index idx_Orders_Custkey on Orders (o_custkey) type btree;
+
+write output to nc1:"/tmp/index_search-conjunctive.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey}
+from Orders as o
+where ((o.o_custkey = 40) and (o.o_totalprice > 150000.0))
+order by o.o_orderkey
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive-open_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive-open_02.sqlpp
new file mode 100644
index 0000000..90c5a52
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive-open_02.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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+{
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+load table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+create index idx_Orders_Custkey on Orders (o_custkey) type btree;
+
+write output to nc1:"/tmp/index_search-conjunctive.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey,'o_totalprice':o.o_totalprice}
+from Orders as o
+where ((o.o_custkey = 40) and (o.o_totalprice > 150000.0))
+order by o.o_orderkey
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive_01.sqlpp
new file mode 100644
index 0000000..0b06385
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive_01.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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+load table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+create index idx_Orders_Custkey on Orders (o_custkey) type btree;
+
+write output to nc1:"/tmp/index_search-conjunctive.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey}
+from Orders as o
+where ((o.o_custkey = 40) and (o.o_totalprice > 150000.0))
+order by o.o_orderkey
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive_02.sqlpp
new file mode 100644
index 0000000..62c3577
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-conjunctive_02.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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+load table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+create index idx_Orders_Custkey on Orders (o_custkey) type btree;
+
+write output to nc1:"/tmp/index_search-conjunctive.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey,'o_totalprice':o.o_totalprice}
+from Orders as o
+where ((o.o_custkey = 40) and (o.o_totalprice > 150000.0))
+order by o.o_orderkey
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-open.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-open.sqlpp
new file mode 100644
index 0000000..eae957f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search-open.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.
+ */
+
+drop database index_search if exists;
+create database index_search;
+
+use index_search;
+
+
+create type index_search.OrderType as
+{
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create index idx_Orders_Custkey on Orders (o_custkey) type btree;
+
+write output to nc1:"/tmp/index_search.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey}
+from Orders as o
+where (o.o_custkey = 40)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search.sqlpp
new file mode 100644
index 0000000..a70f0ba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-index-search.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.
+ */
+
+drop database index_search if exists;
+create database index_search;
+
+use index_search;
+
+
+create type index_search.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create index idx_Orders_Custkey on Orders (o_custkey) type btree;
+
+write output to nc1:"/tmp/index_search.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey}
+from Orders as o
+where (o.o_custkey = 40)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/prim-idx-search-open.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/prim-idx-search-open.sqlpp
new file mode 100644
index 0000000..8653b01
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/prim-idx-search-open.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+drop database prim_index_search if exists;
+create database prim_index_search;
+
+use prim_index_search;
+
+
+create type prim_index_search.OrderType as
+{
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+write output to nc1:"/tmp/prim_index_search.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey}
+from Orders as o
+where (o.o_orderkey = 34)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/prim-idx-search.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/prim-idx-search.sqlpp
new file mode 100644
index 0000000..1bf0d81
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/prim-idx-search.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+drop database prim_index_search if exists;
+create database prim_index_search;
+
+use prim_index_search;
+
+
+create type prim_index_search.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+write output to nc1:"/tmp/prim_index_search.adm"
+select element {'o_orderkey':o.o_orderkey,'o_custkey':o.o_custkey}
+from Orders as o
+where (o.o_orderkey = 34)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/pull_select_above_eq_join.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/pull_select_above_eq_join.sqlpp
new file mode 100644
index 0000000..2820784
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/pull_select_above_eq_join.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+drop database "pull-select-above-eq-join" if exists;
+create database "pull-select-above-eq-join";
+
+use "pull-select-above-eq-join";
+
+
+create type "pull-select-above-eq-join".UserType as
+{
+ uid : int32,
+ name : string,
+ city : string,
+ lottery_numbers : {{int32}}
+}
+
+create type "pull-select-above-eq-join".VisitorType as
+{
+ vid : int32,
+ name : string,
+ city : string,
+ lottery_numbers : {{int32}}
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Users(UserType) primary key uid on group1;
+
+create table Visitors(VisitorType) primary key vid on group1;
+
+write output to nc1:"/tmp/pull-select-above-eq-join.adm"
+select element {'uid':user.uid,'vid':visitor.vid}
+from Users as user,
+ Visitors as visitor
+where ((user.name = visitor.name) and (user.city != visitor.city))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/push-project-through-group.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/push-project-through-group.sqlpp
new file mode 100644
index 0000000..7516412
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/push-project-through-group.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+drop database fuzzyjoin_080 if exists;
+create database fuzzyjoin_080;
+
+use fuzzyjoin_080;
+
+
+create type fuzzyjoin_080.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table DBLP(DBLPType) primary key id on group1;
+
+write output to nc1:"rttest/fuzzyjoin_080.adm"
+select element {'id':paperDBLP.id,'matches':matches}
+from DBLP as paperDBLP
+with matches as (
+ select element paper.title
+ from DBLP as paper
+ where (paper.authors = paperDBLP.authors)
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/push_limit.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/push_limit.sqlpp
new file mode 100644
index 0000000..72b382f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/push_limit.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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+write output to nc1:"/tmp/push_limit.adm"
+select element {'price':o.o_totalprice,'date':o.o_orderdate}
+from Orders as o
+where (o.o_totalprice > 100)
+order by o.o_orderkey
+limit 10 offset 5
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp
new file mode 100644
index 0000000..d31815a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+load table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+write output to nc1:"rttest/tpch_q1_pricing_summary_report_nt.adm"
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'sum_qty':tpch.sum((
+ select element i.l_quantity
+ from l as i
+ )),'sum_base_price':tpch.sum((
+ select element i.l_extendedprice
+ from l as i
+ )),'sum_disc_price':tpch.sum((
+ select element (i.l_extendedprice * (1 - i.l_discount))
+ from l as i
+ )),'sum_charge':tpch.sum((
+ select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
+ from l as i
+ )),'ave_qty':tpch.avg((
+ select element i.l_quantity
+ from l as i
+ )),'ave_price':tpch.avg((
+ select element i.l_extendedprice
+ from l as i
+ )),'ave_disc':tpch.avg((
+ select element i.l_discount
+ from l as i
+ )),'count_order':tpch.count(l)}
+from LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp
new file mode 100644
index 0000000..6cc87f8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+drop database q3_shipping_priority if exists;
+create database q3_shipping_priority;
+
+use q3_shipping_priority;
+
+
+create type q3_shipping_priority.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type q3_shipping_priority.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type q3_shipping_priority.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems(LineItemType) primary key l_orderkey,l_linenumber on group1;
+
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+write output to nc1:"/tmp/q3_shipping_priority.adm"
+select element {'l_orderkey':l_orderkey,'revenue':revenue,'o_orderdate':o_orderdate,'o_shippriority':o_shippriority}
+from Customers as c,
+ Orders as o,
+ LineItems as l
+where (((c.c_mktsegment = 'BUILDING') and (c.c_custkey = o.o_custkey)) and ((l.l_orderkey = o.o_orderkey) and (o.o_orderdate < '1995-03-15') and (l.l_shipdate > '1995-03-15')))
+/* +hash */
+group by l.l_orderkey as l_orderkey,o.o_orderdate as o_orderdate,o.o_shippriority as o_shippriority
+with revenue as q3_shipping_priority.sum((
+ select element (i.l_extendedprice * (1 - i.l_discount))
+ from l as i
+ ))
+order by revenue desc,o_orderdate
+limit 10
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp
new file mode 100644
index 0000000..a18e7a9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+drop database q5_local_supplier if exists;
+create database q5_local_supplier;
+
+use q5_local_supplier;
+
+
+create type q5_local_supplier.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type q5_local_supplier.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type q5_local_supplier.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create type q5_local_supplier.SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type q5_local_supplier.NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type q5_local_supplier.RegionType as
+ closed {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems(LineItemType) primary key l_orderkey,l_linenumber on group1;
+
+create table Orders(OrderType) primary key o_orderkey on group1;
+
+create table Customers(CustomerType) primary key c_custkey on group1;
+
+create table Suppliers(SupplierType) primary key s_suppkey on group1;
+
+create table Nations(NationType) primary key n_nationkey on group1;
+
+create table Regions(RegionType) primary key r_regionkey on group1;
+
+write output to nc1:"/tmp/q5_local_supplier.adm"
+select element {'n_name':n_name,'revenue':revenue}
+from Customers as c,
+ (
+ select element {'n_name':l1.n_name,'l_extendedprice':l1.l_extendedprice,'l_discount':l1.l_discount,'s_nationkey':l1.s_nationkey,'o_custkey':o.o_custkey}
+ from Orders as o,
+ (
+ select element {'n_name':s1.n_name,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount,'l_orderkey':l.l_orderkey,'s_nationkey':s1.s_nationkey}
+ from LineItems as l,
+ (
+ select element {'n_name':n1.n_name,'s_suppkey':s.s_suppkey,'s_nationkey':s.s_nationkey}
+ from Suppliers as s,
+ (
+ select element {'n_name':n.n_name,'n_nationkey':n.n_nationkey}
+ from Nations as n,
+ Regions as r
+ where ((n.n_regionkey = r.r_regionkey) and (r.r_name = 'ASIA'))
+ ) as n1
+ where (s.s_nationkey = n1.n_nationkey)
+ ) as s1
+ where (l.l_suppkey = s1.s_suppkey)
+ ) as l1
+ where ((l1.l_orderkey = o.o_orderkey) and (o.o_orderdate >= '1994-01-01') and (o.o_orderdate < '1995-01-01'))
+) as o1
+where ((c.c_nationkey = o1.s_nationkey) and (c.c_custkey = o1.o_custkey))
+/* +hash */
+group by o1.n_name as n_name
+with revenue as q5_local_supplier.sum((
+ select element (i.l_extendedprice * (1 - i.l_discount))
+ from o1 as i
+ ))
+order by revenue desc
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q08_group_by.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q08_group_by.sqlpp
new file mode 100644
index 0000000..0c59c3c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q08_group_by.sqlpp
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+drop database q08_group_by if exists;
+create database q08_group_by;
+
+use q08_group_by;
+
+
+create type q08_group_by.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type q08_group_by.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type q08_group_by.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create type q08_group_by.SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type q08_group_by.NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type q08_group_by.RegionType as
+ closed {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+}
+
+create type q08_group_by.PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create table Orders(OrderType) primary key o_orderkey;
+
+create table Customer(CustomerType) primary key c_custkey;
+
+create table Supplier(SupplierType) primary key s_suppkey;
+
+create table Nation(NationType) primary key n_nationkey;
+
+create table Region(RegionType) primary key r_regionkey;
+
+create table Part(PartType) primary key p_partkey;
+
+select element {'o_orderdate':lnrcop.o_orderdate,'l_discount':lnrcop.l_discount,'l_extendedprice':lnrcop.l_extendedprice,'l_suppkey':lnrcop.l_suppkey,'s_nationkey':s.s_nationkey}
+from Supplier as s,
+ (
+ select element {'o_orderdate':lnrco.o_orderdate,'l_discount':lnrco.l_discount,'l_extendedprice':lnrco.l_extendedprice,'l_suppkey':lnrco.l_suppkey}
+ from (
+ select element {'o_orderdate':nrco.o_orderdate,'l_partkey':l.l_partkey,'l_discount':l.l_discount,'l_extendedprice':l.l_extendedprice,'l_suppkey':l.l_suppkey}
+ from LineItem as l,
+ (
+ select element {'o_orderdate':o.o_orderdate,'o_orderkey':o.o_orderkey}
+ from Orders as o,
+ (
+ select element {'c_custkey':c.c_custkey}
+ from Customer as c,
+ (
+ select element {'n_nationkey':n1.n_nationkey}
+ from Nation as n1,
+ Region as r1
+ where ((n1.n_regionkey = r1.r_regionkey) and (r1.r_name = 'AMERICA'))
+ ) as nr
+ where (c.c_nationkey = nr.n_nationkey)
+ ) as nrc
+ where (nrc.c_custkey = o.o_custkey)
+ ) as nrco
+ where ((l.l_orderkey = nrco.o_orderkey) and (nrco.o_orderdate >= '1995-01-01') and (nrco.o_orderdate <= '1996-12-31'))
+ ) as lnrco,
+ Part as p
+ where ((p.p_partkey = lnrco.l_partkey) and (p.p_type = 'ECONOMY ANODIZED STEEL'))
+) as lnrcop
+where (s.s_suppkey = lnrcop.l_suppkey)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q09_group_by.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q09_group_by.sqlpp
new file mode 100644
index 0000000..e0d1ac2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q09_group_by.sqlpp
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+drop database q09_group_by if exists;
+create database q09_group_by;
+
+use q09_group_by;
+
+
+create type q09_group_by.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : int32,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type q09_group_by.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type q09_group_by.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create type q09_group_by.SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type q09_group_by.NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type q09_group_by.RegionType as
+ closed {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+}
+
+create type q09_group_by.PartType as
+ closed {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+}
+
+create type q09_group_by.PartSuppType as
+ closed {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create table Orders(OrderType) primary key o_orderkey;
+
+create table Supplier(SupplierType) primary key s_suppkey;
+
+create table Region(RegionType) primary key r_regionkey;
+
+create table Nation(NationType) primary key n_nationkey;
+
+create table Part(PartType) primary key p_partkey;
+
+create table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create table Customer(CustomerType) primary key c_custkey;
+
+select element {'l_extendedprice':l2.l_extendedprice,'l_discount':l2.l_discount,'l_quantity':l2.l_quantity,'l_orderkey':l2.l_orderkey,'n_name':l2.n_name,'ps_supplycost':l2.ps_supplycost}
+from Part as p,
+ (
+ select element {'l_extendedprice':l1.l_extendedprice,'l_discount':l1.l_discount,'l_quantity':l1.l_quantity,'l_partkey':l1.l_partkey,'l_orderkey':l1.l_orderkey,'n_name':l1.n_name,'ps_supplycost':ps.ps_supplycost}
+ from Partsupp as ps,
+ (
+ select element {'l_suppkey':l.l_suppkey,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount,'l_quantity':l.l_quantity,'l_partkey':l.l_partkey,'l_orderkey':l.l_orderkey,'n_name':s1.n_name}
+ from (
+ select element {'s_suppkey':s.s_suppkey,'n_name':n.n_name}
+ from Supplier as s,
+ Nation as n
+ where (n.n_nationkey = s.s_nationkey)
+ ) as s1,
+ LineItem as l
+ where (s1.s_suppkey = l.l_suppkey)
+ ) as l1
+ where ((ps.ps_suppkey = l1.l_suppkey) and (ps.ps_partkey = l1.l_partkey))
+) as l2
+where (q09_group_by.contains(p.p_name,'green') and (p.p_partkey = l2.l_partkey))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q1.sqlpp
new file mode 100644
index 0000000..cb0f2d9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q1.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.
+ */
+
+drop database events if exists;
+create database events;
+
+use events;
+
+
+create type events.AddressType as
+ closed {
+ street : string,
+ city : string,
+ zip : string,
+ latlong : point
+}
+
+create type events.UserType as
+{
+ name : string,
+ email : string,
+ interests : {{string}},
+ address : AddressType,
+ member_of : {{{
+ sig_name : string,
+ chapter_name : string,
+ member_since : date
+ }
+}}
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table User(UserType) primary key name on group1;
+
+write output to nc1:"/tmp/q1.adm"
+select element {'name':user.name}
+from User as user
+where some i in user.interests satisfies (i = 'movies')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp
new file mode 100644
index 0000000..162dd74
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+drop database events if exists;
+create database events;
+
+use events;
+
+
+create type events.AddressType as
+ closed {
+ street : string,
+ city : string,
+ zip : string
+}
+
+create type events.EventType as
+ closed {
+ name : string,
+ location : AddressType?,
+ organizers : {{{
+ name : string,
+ role : string
+ }
+}},
+ sponsoring_sigs : [{
+ sig_name : string,
+ chapter_name : string
+ }
+],
+ interest_keywords : {{string}},
+ price : double?,
+ start_time : datetime,
+ end_time : datetime
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Event(EventType) primary key name on group1;
+
+write output to nc1:"/tmp/q2.adm"
+select element {'sig_name':sig_name,'total_count':sig_sponsorship_count,'chapter_breakdown':by_chapter}
+from Event as event,
+ event.sponsoring_sigs as sponsor
+with es as {'event':event,'sponsor':sponsor}
+group by sponsor.sig_name as sig_name
+with sig_sponsorship_count as events.count(es),
+ by_chapter as (
+ select element {'chapter_name':chapter_name,'escount':events.count(e)}
+ from es as e
+ group by e.sponsor.chapter_name as chapter_name
+ )
+order by sig_sponsorship_count desc
+limit 5
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue550.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue550.sqlpp
new file mode 100644
index 0000000..33c7947
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue550.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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 case is to verify the fix for issue550
+ * https://code.google.com/p/asterixdb/issues/detail?id=550
+ * Expected Result : Success
+ * Date : 25th October 2014
+ */
+
+with sample as {{{'r':1,'uid':'1a2b','t':datetime('2000-01-01T01:00:00'),'event':'e1'},{'r':2,'uid':'1a2b','t':datetime('2000-01-01T01:01:00'),'event':'e2'},{'r':3,'uid':'3c4d','t':datetime('2000-01-01T01:02:00'),'event':'e1'},{'r':4,'uid':'3c4d','t':datetime('2000-01-01T01:03:00'),'event':'e3'},{'r':5,'uid':'1a2b','t':datetime('2000-01-01T01:04:00'),'event':'e1'},{'r':6,'uid':'1a2b','t':datetime('2000-01-01T01:05:00'),'event':'e4'}}}
+select element {'u':u,'recs':(
+ select element srec
+ from s as srec
+ )}
+from sample as s
+group by s.uid as u
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp
new file mode 100644
index 0000000..5fb9440
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp
@@ -0,0 +1,107 @@
+/*
+ * 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 case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date : 15th Jan. 2015
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : int32,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create table Orders(OrderType) primary key o_orderkey;
+
+create table Customer(CustomerType) primary key c_custkey;
+
+declare function q22_customer_tmp() {
+(
+ select element {'c_acctbal':c.c_acctbal,'c_custkey':c.c_custkey,'cntrycode':phone_substr}
+ from Customer as c
+ with phone_substr as tpch.substring(c.c_phone,1,2)
+ where ((phone_substr = '13') or (phone_substr = '31') or (phone_substr = '23') or (phone_substr = '29') or (phone_substr = '30') or (phone_substr = '18') or (phone_substr = '17'))
+)
+};
+with avg as tpch.avg((
+ select element c.c_acctbal
+ from Customer as c
+ with phone_substr as tpch.substring(c.c_phone,1,2)
+ where ((c.c_acctbal > 0.0) and ((phone_substr = '13') or (phone_substr = '31') or (phone_substr = '23') or (phone_substr = '29') or (phone_substr = '30') or (phone_substr = '18') or (phone_substr = '17')))
+ ))
+select element {'cntrycode':cntrycode,'numcust':tpch.count(ct),'totacctbal':tpch.sum((
+ select element i.c_acctbal
+ from ct as i
+ ))}
+from tpch.q22_customer_tmp() as ct
+where (tpch.count((
+ select element o
+ from Orders as o
+ where (ct.c_custkey = o.o_custkey)
+)) = 0)
+group by ct.cntrycode as cntrycode
+order by cntrycode
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp
new file mode 100644
index 0000000..5f60eb0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date : 10th Oct 2014
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+select element {'l_linenumber':l_linenumber,'count_order':tpch.count(l)}
+from LineItem as l
+group by l.l_linenumber as l_linenumber
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp
new file mode 100644
index 0000000..5d23126
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 case is to verify the fix for issue697
+ * https://code.google.com/p/asterixdb/issues/detail?id=697
+ * Expected Result : Success
+ * Date : 16th Nov. 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TestType as
+ closed {
+ key1 : int32,
+ "value" : int32
+}
+
+create table test(TestType) primary key key1;
+
+select element {'gid':aid,'avg':test.avg((
+ select element j."value"
+ from i as j
+ where test.not(test."is-null"(j."value"))
+ ))}
+from test as i
+group by i.key1 as aid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp
new file mode 100644
index 0000000..aecafb4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp
@@ -0,0 +1,121 @@
+/*
+ * 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 case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date : 2nd Oct. 2014
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+}
+
+create table Orders(OrderType) primary key o_orderkey;
+
+create table Supplier(SupplierType) primary key s_suppkey;
+
+create table Region(RegionType) primary key r_regionkey;
+
+create table Nation(NationType) primary key n_nationkey;
+
+create table Customer(CustomerType) primary key c_custkey;
+
+create table SelectedNation(NationType) primary key n_nationkey;
+
+with t as (
+ select element {'n_nationkey':nation.n_nationkey,'n_name':nation.n_name}
+ from Nation as nation,
+ SelectedNation as sn
+ where (nation.n_nationkey = sn.n_nationkey)
+ ),
+ X as (
+ select element {'nation_key':nation_key,'order_date':orderdate,'sum_price':sum}
+ from t as n,
+ Customer as customer,
+ Orders as orders
+ where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = n.n_nationkey))
+ group by orders.o_orderdate as orderdate,n.n_nationkey as nation_key
+ with sum as tpch.sum((
+ select element o.o_totalprice
+ from orders as o
+ ))
+ )
+select element {'nation_key':nation_key,'sum_price':(
+ select element {'orderdate':y.order_date,'sum_price':y.sum_price}
+ from x as y
+ order by y.sum_price desc
+ limit 3
+ )}
+from X as x
+group by x.nation_key as nation_key
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp
new file mode 100644
index 0000000..b2e4121
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp
@@ -0,0 +1,78 @@
+/*
+ * 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 case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date : 24th Nov. 2014
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheaps),'avg_expensive_discounts':tpch.avg(expensives),'sum_disc_prices':tpch.sum(disc_prices),'total_charges':tpch.sum(charges)}
+from LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+with expensives as (
+ select element i.l_discount
+ from l as i
+ where (i.l_discount <= 0.05)
+ ),
+ cheaps as (
+ select element i
+ from l as i
+ where (i.l_discount > 0.05)
+ ),
+ charges as (
+ select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
+ from l as i
+ ),
+ disc_prices as (
+ select element (i.l_extendedprice * (1 - i.l_discount))
+ from l as i
+ )
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp
new file mode 100644
index 0000000..da41e12
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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 case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Result : Success
+ * Date : 16th Nov. 2014
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheap),'count_expensives':tpch.count(expensive)}
+from LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+with cheap as (
+ select element m
+ from l as m
+ where (m.l_discount > 0.05)
+ ),
+ expensive as (
+ select element a
+ from l as a
+ where (a.l_discount <= 0.05)
+ )
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp
new file mode 100644
index 0000000..c5ad063
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp
@@ -0,0 +1,80 @@
+/*
+ * 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 case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date : 3rd Dec. 2014
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+{'sum_qty_partial':tpch.sum((
+ select element i.l_quantity
+ from LineItem as i
+ where (i.l_shipdate <= '1998-09-02')
+)),'sum_base_price':tpch.sum((
+ select element i.l_extendedprice
+ from LineItem as i
+)),'sum_disc_price':tpch.sum((
+ select element (i.l_extendedprice * (1 - i.l_discount))
+ from LineItem as i
+)),'sum_charge':tpch.sum((
+ select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
+ from LineItem as i
+)),'ave_qty':tpch.avg((
+ select element i.l_quantity
+ from LineItem as i
+ where (i.l_shipdate <= '1998-09-02')
+)),'ave_price':tpch.avg((
+ select element i.l_extendedprice
+ from LineItem as i
+)),'ave_disc':tpch.avg((
+ select element i.l_discount
+ from LineItem as i
+)),'count_order':tpch.count((
+ select element l
+ from LineItem as l
+))};
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query_issue849-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query_issue849-2.sqlpp
new file mode 100644
index 0000000..1d0fda5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query_issue849-2.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 : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=849
+ * Expected Res : SUCCESS
+ * Date : 2nd Feb. 2015
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.sType as
+ closed {
+ b : int32
+}
+
+create table s(sType) primary key b;
+
+insert into s
+select element {'b':1};
+insert into s
+select element {'b':3};
+select element {'x':x,'y':y}
+from s as x,
+ (
+ select element z.c
+ from {{{'a':1,'c':1},{'a':2,'c':2},{'a':1,'c':null}}} as z
+ where (x.b = z.a)
+) as y
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query_issue849.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query_issue849.sqlpp
new file mode 100644
index 0000000..a843dad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query_issue849.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 : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=849
+ * Expected Res : SUCCESS
+ * Date : 2nd Feb. 2015
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.sType as
+ closed {
+ b : int32
+}
+
+create table s(sType) primary key b;
+
+insert into s
+select element {'b':1};
+insert into s
+select element {'b':3};
+select element {'x':x,'y':y}
+from {{{'a':1},{'a':2}}} as x,
+ (
+ select element z.b
+ from s as z
+ where (x.a = z.b)
+) as y
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.sqlpp
new file mode 100644
index 0000000..8cdc933
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 : The hint is to use the range connector
+ * : This test is intended to verify that the range connector is used instead of single node merge.
+ * Expected Result : Success
+ * Date : 1th May 2015
+ */
+
+drop database TinySocial if exists;
+create database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+ "screen-name" : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+}
+
+create table TwitterUsers(TwitterUserType) primary key "screen-name";
+
+select element user
+from TwitterUsers as user
+order by user.friends_count desc
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-numeric.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-numeric.sqlpp
new file mode 100644
index 0000000..682d26b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-numeric.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 : The hint is to use the range connector
+ * : This test is intended to verify that the range connector is used instead of single node merge.
+ * Expected Result : Success
+ * Date : 1th May 2015
+ */
+
+drop database TinySocial if exists;
+create database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+ "screen-name" : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+}
+
+create table TwitterUsers(TwitterUserType) primary key "screen-name";
+
+select element user
+from TwitterUsers as user
+order by user.friends_count
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-string-desc.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-string-desc.sqlpp
new file mode 100644
index 0000000..cd1c196
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-string-desc.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 : The hint is to use the range connector
+ * : This test is intended to verify that the range connector is used instead of single node merge.
+ * Expected Result : Success
+ * Date : 1th May 2015
+ */
+
+drop database TinySocial if exists;
+create database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+ "screen-name" : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+}
+
+create table TwitterUsers(TwitterUserType) primary key "screen-name";
+
+select element user
+from TwitterUsers as user
+order by user."screen-name" desc
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-string.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-string.sqlpp
new file mode 100644
index 0000000..a400bd3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/range-connector/sort-hint-on-closed-string.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 : The hint is to use the range connector
+ * : This test is intended to verify that the range connector is used instead of single node merge.
+ * Expected Result : Success
+ * Date : 1th May 2015
+ */
+
+drop database TinySocial if exists;
+create database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+ "screen-name" : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+}
+
+create table TwitterUsers(TwitterUserType) primary key "screen-name";
+
+select element user
+from TwitterUsers as user
+order by user."screen-name"
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/record_access.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/record_access.sqlpp
new file mode 100644
index 0000000..84602a2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/record_access.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"/tmp/rec_access.adm"
+{'a':2}.a;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/issue730.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/issue730.sqlpp
new file mode 100644
index 0000000..a9a137d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/issue730.sqlpp
@@ -0,0 +1,65 @@
+/*
+ * 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 : Test that left-outer-join may use an available rtree index in index subtree.
+ * Issue : 730
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+{
+ screen_name : string,
+ lang : string,
+ friends_count : int32,
+ statuses_count : int32,
+ name : string,
+ followers_count : int32
+}
+
+create type test.TweetMessageType as
+{
+ tweetid : int64,
+ user : TwitterUserType,
+ sender_location : point?,
+ send_time : datetime,
+ referred_topics : {{string}},
+ message_text : string
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages (sender_location) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_issue730.adm"
+select element {'message':t1.tweetid,'nearby-message':(
+ select element t2.tweetid
+ from TweetMessages as t2
+ where test."spatial-intersect"(t2.sender_location,n)
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1.sender_location,5.0)
+where ((t1.send_time >= test.datetime('2011-06-18T14:10:17')) and (t1.send_time < test.datetime('2011-06-18T15:10:17')))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
new file mode 100644
index 0000000..f936fea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm"
+select element {'tweetid1':t1.tweetid,'loc1':t1."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.tweetid,'loc2':t2."sender-location"}
+ from TweetMessages as t2
+ where test."spatial-intersect"(t2."sender-location",n)
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1."sender-location",0.5)
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
new file mode 100644
index 0000000..160816f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and another for secondary rtree index in index subtree.
+ * Issue : 730, 741
+ * Expected Res : Success
+ * Date : 8th May 2014
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.TwitterUserType as
+ closed {
+ "screen-name" : string,
+ lang : string,
+ "friends-count" : int32,
+ "statuses-count" : int32,
+ name : string,
+ "followers-count" : int32
+}
+
+create type test.TweetMessageType as
+ closed {
+ tweetid : int64,
+ user : TwitterUserType,
+ "sender-location" : point,
+ "send-time" : datetime,
+ "referred-topics" : {{string}},
+ "message-text" : string,
+ countA : int32,
+ countB : int32
+}
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index twmSndLocIx on TweetMessages ("sender-location") type rtree;
+
+create index msgCountAIx on TweetMessages (countA) type btree;
+
+create index msgCountBIx on TweetMessages (countB) type btree;
+
+create index msgTextIx on TweetMessages ("message-text") type keyword;
+
+write output to nc1:"rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm"
+select element {'tweetid1':t1.tweetid,'loc1':t1."sender-location",'nearby-message':(
+ select element {'tweetid2':t2.tweetid,'loc2':t2."sender-location"}
+ from TweetMessages as t2
+ where (test."spatial-intersect"(t2."sender-location",n) and (t1.tweetid != t2.tweetid))
+ order by t2.tweetid
+ )}
+from TweetMessages as t1
+with n as test."create-circle"(t1."sender-location",0.5)
+where (t1.tweetid < test.int64('10'))
+order by t1.tweetid
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/query-issue838.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/query-issue838.sqlpp
new file mode 100644
index 0000000..3a2364d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/query-issue838.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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 case is to verify the fix for issue838
+ * https://code.google.com/p/asterixdb/issues/detail?id=838
+ * Expected Res : SUCCESS
+ * Date : 18 Dec. 2014
+ */
+
+drop database twitter if exists;
+create database twitter;
+
+use twitter;
+
+
+create type twitter.TweetMessageType as
+ closed {
+ tweetid : int64,
+ "sender-location" : point,
+ text : string
+}
+
+create type twitter.TweetHistorySubscription as
+{
+ "subscription-id" : int32,
+ location : point
+}
+
+create table TweetHistorySubscriptions(TweetHistorySubscription) primary key "subscription-id";
+
+create index testa on TweetHistorySubscriptions (location) type rtree;
+
+create table TweetMessages(TweetMessageType) primary key tweetid;
+
+create index locationIdx on TweetMessages ("sender-location") type rtree;
+
+write output to nc1:"rttest/query-issue838.adm"
+select element {'subscription-id':sub."subscription-id",'changeSet':1,'execution-time':twitter."current-datetime"(),'message-text':text}
+from TweetHistorySubscriptions as sub,
+ (
+ select element tweet
+ from TweetMessages as tweet
+ with circle as twitter."create-circle"(location,30.0)
+ where twitter."spatial-intersect"(tweet."sender-location",circle)
+) as text
+with location as sub.location
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_01.sqlpp
new file mode 100644
index 0000000..9319186
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_01.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData1' has an RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData1(MyRecord) primary key id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData1 (point) type rtree;
+
+write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_02.sqlpp
new file mode 100644
index 0000000..94d47b6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_02.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 : Joins two datasets on the intersection of their point attributes.
+ * The dataset 'MyData2' has an RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData1(MyRecord) primary key id;
+
+create table MyData2(MyRecord) primary key id;
+
+create index rtree_index on MyData2 (point) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"
+select element {'a':a,'b':b}
+from MyData1 as a,
+ MyData2 as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_03.sqlpp
new file mode 100644
index 0000000..b57ad65
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-index-join/spatial-intersect-point_03.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 : Self-joins a dataset on the intersection of its point attribute.
+ * The dataset has an RTree index, and we expect the
+ * join to be transformed into an indexed nested-loop join.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+}
+
+create table MyData(MyRecord) primary key id;
+
+create index rtree_index on MyData (point) type rtree;
+
+write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_03.adm"
+select element {'a':a,'b':b}
+from MyData as a,
+ MyData as b
+where test."spatial-intersect"(a.point,b.point)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-secondary-index-open.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-secondary-index-open.sqlpp
new file mode 100644
index 0000000..c7b5d36
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-secondary-index-open.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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+{
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table MyData(MyRecord) primary key id on group1;
+
+load table MyData using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point on MyData (point) type rtree;
+
+write output to nc1:"rttest/index_rtree-secondary-index-open.adm"
+select element {'id':o.id}
+from MyData as o
+where test."spatial-intersect"(o.point,test."create-polygon"([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-secondary-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-secondary-index.sqlpp
new file mode 100644
index 0000000..0fae89e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/rtree-secondary-index.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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table MyData(MyRecord) primary key id on group1;
+
+load table MyData using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point on MyData (point) type rtree;
+
+write output to nc1:"rttest/index_rtree-secondary-index.adm"
+select element {'id':o.id}
+from MyData as o
+where test."spatial-intersect"(o.point,test."create-polygon"([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete-all.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete-all.sqlpp
new file mode 100644
index 0000000..1a277ce
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete-all.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.LineIDType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems_q1(LineItemType) primary key l_orderkey on group1;
+
+create table LineID(LineIDType) primary key l_orderkey on group1;
+
+delete l from LineItems_q1
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete-rtree-secondary-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete-rtree-secondary-index.sqlpp
new file mode 100644
index 0000000..6266272
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete-rtree-secondary-index.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.
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table MyData(MyRecord) primary key id on group1;
+
+load table MyData using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point on MyData (point) type rtree;
+
+delete m from MyData
+ where (m.id > 5);
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete.sqlpp
new file mode 100644
index 0000000..0185c84
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-delete.sqlpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.LineIDType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems_q1(LineItemType) primary key l_orderkey on group1;
+
+create table LineID(LineIDType) primary key l_orderkey on group1;
+
+delete l from LineItems_q1
+ where (l.l_shipdate <= '1998-09-02');
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-insert-secondary-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-insert-secondary-index.sqlpp
new file mode 100644
index 0000000..020baf7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-insert-secondary-index.sqlpp
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.LineIDType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems_q1(LineItemType) primary key l_orderkey on group1;
+
+create table LineID(LineIDType) primary key l_orderkey on group1;
+
+create index idx_LineID_partkey on LineID (l_partkey) type btree;
+
+create index idx_LineID_suppkey on LineID (l_suppkey) type btree;
+
+insert into LineID
+select element {'l_orderkey':l.l_orderkey,'l_partkey':l.l_partkey,'l_suppkey':l.l_partkey}
+from LineItems_q1 as l
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-insert.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-insert.sqlpp
new file mode 100644
index 0000000..2de1b31
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/scan-insert.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+drop database tpch if exists;
+create database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+}
+
+create type tpch.LineIDType as
+ closed {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table LineItems_q1(LineItemType) primary key l_orderkey on group1;
+
+create table LineID(LineIDType) primary key l_orderkey on group1;
+
+insert into LineID
+select element {'l_orderkey':l.l_orderkey,'l_partkey':l.l_partkey,'l_suppkey':l.l_partkey}
+from LineItems_q1 as l
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..3e7ef15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a "<=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_01.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (ed <= 2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.sqlpp
new file mode 100644
index 0000000..98506e9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a reverse "<=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_02.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (2 >= ed)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.sqlpp
new file mode 100644
index 0000000..c5a255a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a "<" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_03.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (ed < 3)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.sqlpp
new file mode 100644
index 0000000..3ad6b13
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a reverse "<" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_04.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (3 > ed)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.sqlpp
new file mode 100644
index 0000000..ba5ed31
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a ">=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_05.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (ed >= 2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.sqlpp
new file mode 100644
index 0000000..2bc08b3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a reverse ">=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_06.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (2 <= ed)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.sqlpp
new file mode 100644
index 0000000..7aac82d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a ">" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_07.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (ed > 2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.sqlpp
new file mode 100644
index 0000000..2758920
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a reverse ">" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-let-to-edit-distance-check_08.adm"
+select element ed
+from DBLP as o
+with ed as test."edit-distance"(o.authors,'Michael J. Carey')
+where (2 < ed)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_01.sqlpp
new file mode 100644
index 0000000..12eb414
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_01.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should happen because of a "<=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_01.adm"
+select element o
+from DBLP as o
+where (test."edit-distance"(o.authors,'Michael J. Carey') <= 2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_02.sqlpp
new file mode 100644
index 0000000..41893bb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_02.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should happen because of a reverse "<=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_02.adm"
+select element o
+from DBLP as o
+where (2 >= test."edit-distance"(o.authors,'Michael J. Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_03.sqlpp
new file mode 100644
index 0000000..10a0ef3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_03.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should happen because of a "<" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_03.adm"
+select element o
+from DBLP as o
+where (test."edit-distance"(o.authors,'Michael J. Carey') < 3)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_04.sqlpp
new file mode 100644
index 0000000..d9230b2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_04.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should happen because of a reverse "<" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_04.adm"
+select element o
+from DBLP as o
+where (3 > test."edit-distance"(o.authors,'Michael J. Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_05.sqlpp
new file mode 100644
index 0000000..90b3655
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_05.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should *not* happen because of a ">=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_05.adm"
+select element o
+from DBLP as o
+where (test."edit-distance"(o.authors,'Michael J. Carey') >= 2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_06.sqlpp
new file mode 100644
index 0000000..2340250
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_06.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should *not* happen because of a reverse ">=" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_06.adm"
+select element o
+from DBLP as o
+where (2 <= test."edit-distance"(o.authors,'Michael J. Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_07.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_07.sqlpp
new file mode 100644
index 0000000..8b9f5c6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_07.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should *not* happen because of a ">" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_07.adm"
+select element o
+from DBLP as o
+where (test."edit-distance"(o.authors,'Michael J. Carey') > 2)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_08.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_08.sqlpp
new file mode 100644
index 0000000..713c2b7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/edit-distance-to-edit-distance-check_08.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the edit-distance function with a threshold
+ * into edit-distance-check if possible.
+ * Replacement should *not* happen because of a reverse ">" condition on the edit distance.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_edit-distance-to-edit-distance-check_08.adm"
+select element o
+from DBLP as o
+where (2 < test."edit-distance"(o.authors,'Michael J. Carey'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/fuzzyeq-to-edit-distance-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/fuzzyeq-to-edit-distance-check.sqlpp
new file mode 100644
index 0000000..6d350d2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/fuzzyeq-to-edit-distance-check.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 : Tests that the FuzzyEqRule rewrites ~= using edit distance
+ * into edit-distance-check.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_fuzzyeq-to-edit-distance-check.adm"
+set "simfunction" "edit-distance";
+
+set "simthreshold" "1";
+
+select element o
+from DBLP as o
+where (o.authors ~= 'Michael J. Carey')
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/fuzzyeq-to-jaccard-check.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/fuzzyeq-to-jaccard-check.sqlpp
new file mode 100644
index 0000000..266c2fd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/fuzzyeq-to-jaccard-check.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 : Tests that the FuzzyEqRule rewrites ~= using Jaccard
+ * into edit-distance-check.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_fuzzyeq-to-jaccard-check.adm"
+set "simfunction" "jaccard";
+
+set "simthreshold" "0.8f";
+
+select element paper
+from DBLP as paper
+where (test."word-tokens"(paper.title) ~= test."word-tokens"('Transactions for Cooperative Environments'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..3ea9c76
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_01.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a ">=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (jacc >= 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..380d68d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_02.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a reverse ">=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (0.800000f <= jacc)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..93827db
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a ">" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (jacc > 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..0c63957
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_04.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should happen because of a reverse ">" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (0.800000f < jacc)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_05.sqlpp
new file mode 100644
index 0000000..8cec9c9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_05.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a "<=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (jacc <= 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_06.sqlpp
new file mode 100644
index 0000000..85f9d4a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_06.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a reverse "<=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (0.800000f >= jacc)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_07.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_07.sqlpp
new file mode 100644
index 0000000..c95130d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_07.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a "<" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (jacc < 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_08.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_08.sqlpp
new file mode 100644
index 0000000..67d1f31
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-let-to-jaccard-check_08.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Tests that the optimizer drills through the let clause.
+ * Replacement should *not* happen because of a reverse "<" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-let-to-jaccard-check_01.adm"
+select element jacc
+from DBLP as paper
+with jacc as test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (0.800000f > jacc)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_01.sqlpp
new file mode 100644
index 0000000..65e63ba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_01.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should happen because of a ">=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_01.adm"
+select element paper
+from DBLP as paper
+where (test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')) >= 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_02.sqlpp
new file mode 100644
index 0000000..f40628fe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_02.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should happen because of a reverse ">=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_02.adm"
+select element paper
+from DBLP as paper
+where (0.800000f <= test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_03.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_03.sqlpp
new file mode 100644
index 0000000..c9f9bcf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_03.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should happen because of a ">" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_02.adm"
+select element paper
+from DBLP as paper
+where (test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')) > 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_04.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_04.sqlpp
new file mode 100644
index 0000000..e5e283b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_04.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should happen because of a reverse ">" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_03.adm"
+select element paper
+from DBLP as paper
+where (0.800000f < test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_05.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_05.sqlpp
new file mode 100644
index 0000000..36d67d8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_05.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should *not* happen because of a "<=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_05.adm"
+select element paper
+from DBLP as paper
+where (test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')) <= 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_06.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_06.sqlpp
new file mode 100644
index 0000000..19418f0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_06.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should *not* happen because of a reverse "<=" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_06.adm"
+select element paper
+from DBLP as paper
+where (0.800000f >= test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_07.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_07.sqlpp
new file mode 100644
index 0000000..0be0017
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_07.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should *not* happen because of a "<" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_07.adm"
+select element paper
+from DBLP as paper
+where (test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')) < 0.800000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_08.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_08.sqlpp
new file mode 100644
index 0000000..63eb76d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/similarity/jaccard-to-jaccard-check_08.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 that the SimilarityCheckRule rewrites the similarity-jaccard function with a threshold
+ * into similarity-jaccard-check-check if possible.
+ * Replacement should *not* happen because of a reverse "<" condition on the similarity.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+write output to nc1:"rttest/similarity_jaccard-to-jaccard-check_08.adm"
+select element paper
+from DBLP as paper
+where (0.800000f > test."similarity-jaccard"(test."word-tokens"(paper.title),test."word-tokens"('Transactions for Cooperative Environments')))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/dont-skip-primary-index-search-in-delete.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/dont-skip-primary-index-search-in-delete.sqlpp
new file mode 100644
index 0000000..b7f8751
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/dont-skip-primary-index-search-in-delete.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 : The hint to skip secondary indexes don't apply to the primary index
+ * : This test is intended to verify that the primary index is still used instead of a scan
+ * Expected Result : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+delete c from Customers
+ where (c.cid /*+ skip-index */ < 10);
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/dont-skip-primary-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/dont-skip-primary-index.sqlpp
new file mode 100644
index 0000000..5917ad8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/dont-skip-primary-index.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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 : The hint to skip secondary indexes don't apply to the primary index
+ * : This test is intended to verify that the primary index is still used instead of a scan
+ * Expected Result : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-primary-16.adm"
+create type test.TestType as
+{
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key fname,lname;
+
+select element emp
+from testdst as emp
+where ((emp.fname /*+ skip-index */ >= 'Craig') and (emp.lname /*+ skip-index */ >= 'Kevin') and (emp.fname /*+ skip-index */ <= 'Mary') and (emp.lname /*+ skip-index */ <= 'Tomes'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-ngram-index-search-in-delete.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-ngram-index-search-in-delete.sqlpp
new file mode 100644
index 0000000..9111891
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-ngram-index-search-in-delete.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+delete o from DBLP
+ where /*+ skip-index */ test.contains(o.title,'Multimedia');
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-ngram-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-ngram-index.sqlpp
new file mode 100644
index 0000000..a79796d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-ngram-index.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index ngram_index on DBLP (title) type ngram (3);
+
+write output to nc1:"rttest/inverted-index-basic_ngram-contains.adm"
+select element o
+from DBLP as o
+where /*+ skip-index */ test.contains(o.title,'Multimedia')
+order by o.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-rtree-index-search-in-delete.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-rtree-index-search-in-delete.sqlpp
new file mode 100644
index 0000000..a91f5b8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-rtree-index-search-in-delete.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+}
+
+create table MyData(MyRecord) primary key id;
+
+create index rtree_index_point on MyData (point) type rtree;
+
+delete m from MyData
+ where /*+ skip-index */ test."spatial-intersect"(m.point,test."create-polygon"([0.0,1.0,0.0,4.0,12.0,4.0,12.0,1.0]));
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-rtree-secondary-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-rtree-secondary-index.sqlpp
new file mode 100644
index 0000000..da48031
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-rtree-secondary-index.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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.MyRecord as
+ closed {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table MyData(MyRecord) primary key id on group1;
+
+load table MyData using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point on MyData (point) type rtree;
+
+write output to nc1:"rttest/index_rtree-secondary-index.adm"
+select element {'id':o.id}
+from MyData as o
+where /*+ skip-index */ test."spatial-intersect"(o.point,test."create-polygon"([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index-2.sqlpp
new file mode 100644
index 0000000..0c0170b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index-2.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-57.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname /*+ skip-index */ >= 'Max') and (emp.fname <= 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index-search-in-delete.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index-search-in-delete.sqlpp
new file mode 100644
index 0000000..b54fc9c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index-search-in-delete.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type test.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32,
+ address : AddressType?,
+ interests : {{string}},
+ children : [{
+ name : string,
+ age : int32?
+ }
+]
+}
+
+create table Customers(CustomerType) primary key cid;
+
+create index age_index on Customers (age) type btree;
+
+delete c from Customers
+ where (c.age /*+ skip-index */ < 20);
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index.sqlpp
new file mode 100644
index 0000000..c7c6505
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-secondary-btree-index.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/btree-index_btree-secondary-57.adm"
+create type test.TestType as
+{
+ id : int32,
+ fname : string,
+ lname : string
+}
+
+create table testdst(TestType) primary key id;
+
+create index sec_Idx on testdst (fname) type btree;
+
+select element emp
+from testdst as emp
+where ((emp.fname /*+ skip-index */ >= 'Max') and (emp.fname /*+ skip-index */ <= 'Roger'))
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-word-index-search-in-delete.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-word-index-search-in-delete.sqlpp
new file mode 100644
index 0000000..36a9716
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-word-index-search-in-delete.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+delete o from DBLP
+ where ( /*+ skip-index */ test."similarity-jaccard"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments')) >= 0.500000f);
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-word-index.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-word-index.sqlpp
new file mode 100644
index 0000000..8b957ed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/skip-index/skip-word-index.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 : Notice the query hint to avoid using any secondary index to evaluate the predicate in the where clause
+ * Expected Res : Success
+ * Date : 21th December 2013
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+create type test.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+create index keyword_index on DBLP (title) type keyword;
+
+write output to nc1:"rttest/inverted-index-basic_word-jaccard.adm"
+select element o
+from DBLP as o
+with jacc as /*+ skip-index */ test."similarity-jaccard"(test."word-tokens"(o.title),test."word-tokens"('Transactions for Cooperative Environments'))
+where (jacc >= 0.500000f)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/sort-cust.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/sort-cust.sqlpp
new file mode 100644
index 0000000..cad7ac5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/sort-cust.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+drop database custlimit if exists;
+create database custlimit;
+
+use custlimit;
+
+
+create type custlimit.AddressType as
+ closed {
+ number : int32,
+ street : string,
+ city : string
+}
+
+create type custlimit.CustomerType as
+ closed {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : {
+ oid : int32,
+ total : float
+ }
+
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table Customers(CustomerType) primary key cid on group1;
+
+write output to nc1:"/tmp/custlimit.adm"
+select element {'custname':c.name,'custage':c.age}
+from Customers as c
+order by c.age
+limit 10
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp
new file mode 100644
index 0000000..07ccedc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+drop database fuzzyjoin if exists;
+create database fuzzyjoin;
+
+use fuzzyjoin;
+
+
+create type fuzzyjoin.DBLPType as
+{
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create table DBLP(DBLPType) primary key id;
+
+set "import-private-functions" "true";
+
+select element {'left':paperLeft,'right':paperRight,'sim':ridpair.sim}
+from DBLP as paperLeft,
+ DBLP as paperRight,
+ (
+ select element {'idLeft':idLeft,'idRight':idRight,'sim':sim[0]}
+ from DBLP as paperLeft,
+ fuzzyjoin."subset-collection"(tokensLeft,0,fuzzyjoin."prefix-len-jaccard"(lenLeft,0.500000f)) as prefixTokenLeft,
+ DBLP as paperRight,
+ fuzzyjoin."subset-collection"(tokensRight,0,fuzzyjoin."prefix-len-jaccard"(lenRight,0.500000f)) as prefixTokenRight
+ with lenLeft as fuzzyjoin.len(fuzzyjoin."counthashed-word-tokens"(paperLeft.title)),
+ tokensLeft as (
+ select element i
+ from fuzzyjoin."counthashed-word-tokens"(paperLeft.title) as tokenUnranked,
+ (
+ select element tokenGroupped
+ from DBLP as paper,
+ fuzzyjoin."counthashed-word-tokens"(paper.title) as token
+ group by token as tokenGroupped
+ order by fuzzyjoin.count(paper),tokenGroupped
+ ) as tokenRanked at i
+ where (tokenUnranked = tokenRanked)
+ order by i
+ ),
+ lenRight as fuzzyjoin.len(fuzzyjoin."counthashed-word-tokens"(paperRight.title)),
+ tokensRight as (
+ select element i
+ from fuzzyjoin."counthashed-word-tokens"(paperRight.title) as tokenUnranked,
+ (
+ select element tokenGroupped
+ from DBLP as paper,
+ fuzzyjoin."counthashed-word-tokens"(paper.title) as token
+ group by token as tokenGroupped
+ order by fuzzyjoin.count(paper),tokenGroupped
+ ) as tokenRanked at i
+ where (tokenUnranked = tokenRanked)
+ order by i
+ ),
+ sim as fuzzyjoin."similarity-jaccard-prefix"(lenLeft,tokensLeft,lenRight,tokensRight,prefixTokenLeft,0.500000f)
+ where ((prefixTokenLeft = prefixTokenRight) and ((sim >= 0.500000f) and (paperLeft.id < paperRight.id)))
+ group by paperLeft.id as idLeft,paperRight.id as idRight
+) as ridpair
+where ((ridpair.idLeft = paperLeft.id) and (ridpair.idRight = paperRight.id))
+order by paperLeft.id,paperRight.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp
new file mode 100644
index 0000000..9f9d609
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+drop database TinySocial if exists;
+create database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.EmploymentType as
+{
+ "organization-name" : string,
+ "start-date" : date,
+ "end-date" : date?
+}
+
+create type TinySocial.FacebookUserType as
+ closed {
+ id : int32,
+ alias : string,
+ name : string,
+ "user-since" : datetime,
+ "friend-ids" : {{int32}},
+ employment : [EmploymentType]
+}
+
+create table FacebookUsers(FacebookUserType) primary key id;
+
+with lonelyusers as (
+ select element d
+ from FacebookUsers as d
+ where (TinySocial.count(d."friend-ids") < 2)
+ ),
+ lonelyusers2 as (
+ select element d
+ from FacebookUsers as d
+ where (TinySocial.count(d."friend-ids") < 2)
+ )
+select element {'user1':{'id':l1.id,'name':l1.name},'user2':{'id':l2.id,'name':l2.name}}
+from lonelyusers as l1,
+ lonelyusers2 as l2
+where (l1.id < l2.id)
+order by l1.id,l2.id
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest-to-join_01.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest-to-join_01.sqlpp
new file mode 100644
index 0000000..8f3b759
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest-to-join_01.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * 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 that non-datascan unnests are rewritten into joins.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/unnest-to-join_01.adm"
+select element y
+from [1,2,3,4,5,6] as x,
+ [4,5,6,7,8,9] as y
+where (x = y)
+;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest-to-join_02.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest-to-join_02.sqlpp
new file mode 100644
index 0000000..5b025be
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest-to-join_02.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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 that non-datascan unnests in a subplan are rewritten into joins.
+ * Success : Yes
+ */
+
+drop database test if exists;
+create database test;
+
+use test;
+
+
+write output to nc1:"rttest/unnest-to-join_02.adm"
+select element some x in [1,2,3,4,5,6],
+y in [4,5,6,7,8,9] satisfies (x = y);
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest_list_in_subplan.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest_list_in_subplan.sqlpp
new file mode 100644
index 0000000..fa22c8f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/unnest_list_in_subplan.sqlpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+drop database fuzzyjoin if exists;
+create database fuzzyjoin;
+
+use fuzzyjoin;
+
+
+create type fuzzyjoin.DBLPType as
+ closed {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+}
+
+create type fuzzyjoin.TOKENSRANKEDADMType as
+ closed {
+ token : int32,
+ rank : int32
+}
+
+create nodegroup group1 if not exists on
+ nc1,
+ nc2
+;
+create table DBLP(DBLPType) primary key id on group1;
+
+create table TOKENSRANKEDADM(TOKENSRANKEDADMType) primary key rank on group1;
+
+write output to nc1:"rttest/unnest_list_in_subplan.adm"
+select element {'id':idDBLP,'tokens':tokensDBLP}
+from DBLP as paperDBLP
+with idDBLP as paperDBLP.id,
+ tokensUnrankedDBLP as fuzzyjoin."counthashed-word-tokens"(paperDBLP.title),
+ tokensDBLP as (
+ select element tokenRanked.rank
+ from tokensUnrankedDBLP as tokenUnranked,
+ TOKENSRANKEDADM as tokenRanked
+ where (tokenUnranked = tokenRanked.token)
+ order by tokenRanked.rank
+ )
+;
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
new file mode 100644
index 0000000..d6c8138
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
@@ -0,0 +1,122 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
new file mode 100644
index 0000000..5026149
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
@@ -0,0 +1,136 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast
new file mode 100644
index 0000000..8c2366b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast
new file mode 100644
index 0000000..b1c3124
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast
new file mode 100644
index 0000000..eedb46d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast
new file mode 100644
index 0000000..be04f55
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast
new file mode 100644
index 0000000..b648a3d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast
new file mode 100644
index 0000000..09c0cf9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast
new file mode 100644
index 0000000..fe0e3ef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast
new file mode 100644
index 0000000..5b1bc19
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast
new file mode 100644
index 0000000..55abe5a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl Names(Name) partitioned by [[fname], [lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_06.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast
new file mode 100644
index 0000000..95df3cf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Orders(OrderType) partitioned by [[oid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join-multipred.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer]
+ :
+ Variable [ Name=c ]
+ )
+ (
+ LiteralExpr [STRING] [order]
+ :
+ Variable [ Name=o ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=cid
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=name
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=orderstatus
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=age
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast
new file mode 100644
index 0000000..3043316
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join-neg_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key1
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast
new file mode 100644
index 0000000..85ef8e3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join-neg_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key2
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast
new file mode 100644
index 0000000..b44716f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key1
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast
new file mode 100644
index 0000000..97549ca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key2
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast
new file mode 100644
index 0000000..b82bf03
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Orders(OrderType) partitioned by [[oid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer]
+ :
+ Variable [ Name=c ]
+ )
+ (
+ LiteralExpr [STRING] [order]
+ :
+ Variable [ Name=o ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=cid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast
new file mode 100644
index 0000000..99e226d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Orders(OrderType) partitioned by [[oid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer]
+ :
+ Variable [ Name=c ]
+ )
+ (
+ LiteralExpr [STRING] [order]
+ :
+ Variable [ Name=o ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast
new file mode 100644
index 0000000..92e52c27
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_06.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer1]
+ :
+ Variable [ Name=c1 ]
+ )
+ (
+ LiteralExpr [STRING] [customer2]
+ :
+ Variable [ Name=c2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c2 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c1 ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=c2 ]
+ Field=cid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast
new file mode 100644
index 0000000..a266c98
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-ge-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key1
+ ]
+ >=
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast
new file mode 100644
index 0000000..a09412a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-ge-join_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key2
+ ]
+ <=
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast
new file mode 100644
index 0000000..e9e3044
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-gt-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key1
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast
new file mode 100644
index 0000000..ab0f98d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-gt-join_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key2
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast
new file mode 100644
index 0000000..1db7da8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-le-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key1
+ ]
+ <=
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast
new file mode 100644
index 0000000..a185ca0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-le-join_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key2
+ ]
+ >=
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast
new file mode 100644
index 0000000..4b6d4e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-lt-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key1
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast
new file mode 100644
index 0000000..58c261f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast
@@ -0,0 +1,39 @@
+TypeDecl TestType [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-lt-join_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=key2
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast
new file mode 100644
index 0000000..0b8f887
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast
@@ -0,0 +1,117 @@
+DataverseUse test
+TypeDecl EmploymentType [
+ closed RecordType {
+ organization-name : string,
+ start-date : date,
+ end-date : date?
+ }
+]
+TypeDecl FacebookUserType [
+ closed RecordType {
+ id : int32,
+ id-copy : int32,
+ alias : string,
+ name : string,
+ user-since : datetime,
+ user-since-copy : datetime,
+ friend-ids : UnorderedList <int32>
+,
+ employment : OrderedList [EmploymentType]
+
+ }
+]
+TypeDecl FacebookMessageType [
+ closed RecordType {
+ message-id : int32,
+ message-id-copy : int32,
+ author-id : int32,
+ author-id-copy : int32,
+ in-response-to : int32?,
+ sender-location : point?,
+ message : string
+ }
+]
+DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[id]]
+DatasetDecl FacebookMessages(FacebookMessageType) partitioned by [[message-id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multiindex.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [fbu-ID]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [fbm-auth-ID]
+ :
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=author-id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [uname]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [message]
+ :
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=message
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookMessages]
+ ]
+ AS
+ Variable [ Name=message ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=author-id-copy
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ >=
+ LiteralExpr [LONG] [11000]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ <=
+ LiteralExpr [LONG] [12000]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast
new file mode 100644
index 0000000..76e06aa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multipred.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=misc
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=misc
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast
new file mode 100644
index 0000000..61b4973
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast
new file mode 100644
index 0000000..6193ed6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast
new file mode 100644
index 0000000..060dec8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast
new file mode 100644
index 0000000..129cf33
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast
@@ -0,0 +1,50 @@
+DataverseUse emergencyTest
+TypeDecl CHPReport [
+ open RecordType {
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+ }
+]
+DatasetDecl CHPReports(CHPReport) partitioned by [[timestamp]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emergency ]
+ Field=message
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CHPReports]
+ ]
+ AS
+ Variable [ Name=emergency ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emergency ]
+ Field=timestamp
+ ]
+ >=
+ OperatorExpr [
+ FunctionCall emergencyTest.current-datetime@0[
+ ]
+ -
+ FunctionCall emergencyTest.day-time-duration@1[
+ LiteralExpr [STRING] [PT10H]
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emergency ]
+ Field=title
+ ]
+ =
+ LiteralExpr [STRING] [ghost]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast
new file mode 100644
index 0000000..3197add
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast
@@ -0,0 +1,39 @@
+DataverseUse emergencyTest
+TypeDecl CHPReport [
+ open RecordType {
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+ }
+]
+DatasetDecl CHPReports(CHPReport) partitioned by [[timestamp]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emergency ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CHPReports]
+ ]
+ AS
+ Variable [ Name=emergency ]
+]
+LetVariable [ Name=time ]
+ :=
+ OperatorExpr [
+ FunctionCall emergencyTest.current-datetime@0[
+ ]
+ -
+ FunctionCall emergencyTest.day-time-duration@1[
+ LiteralExpr [STRING] [PT10H]
+ ]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emergency ]
+ Field=timestamp
+ ]
+ >=
+ Variable [ Name=time ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast
new file mode 100644
index 0000000..7b7241a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast
@@ -0,0 +1,30 @@
+DataverseUse emergencyTest
+TypeDecl CHPReport [
+ open RecordType {
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+ }
+]
+DatasetDecl CHPReports(CHPReport) partitioned by [[timestamp]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emergency ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CHPReports]
+ ]
+ AS
+ Variable [ Name=emergency ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emergency ]
+ Field=timestamp
+ ]
+ >=
+ FunctionCall emergencyTest.current-datetime@0[
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast
new file mode 100644
index 0000000..4abc056
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast
@@ -0,0 +1,30 @@
+DataverseUse emergencyTest
+TypeDecl CHPReport [
+ open RecordType {
+ id : int64,
+ timestamp : datetime,
+ title : string,
+ message : string
+ }
+]
+DatasetDecl CHPReports(CHPReport) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emergency ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CHPReports]
+ ]
+ AS
+ Variable [ Name=emergency ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emergency ]
+ Field=timestamp
+ ]
+ >=
+ FunctionCall emergencyTest.current-datetime@0[
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast
new file mode 100644
index 0000000..21fa932
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-01.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast
new file mode 100644
index 0000000..ca7d005
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-02.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Susan]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast
new file mode 100644
index 0000000..64b2ed0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-03.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Isa]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast
new file mode 100644
index 0000000..8994a2b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-04.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Vanpatten]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast
new file mode 100644
index 0000000..47d7a34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-05.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast
new file mode 100644
index 0000000..81b7977
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-06.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast
new file mode 100644
index 0000000..3b77aec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-07.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast
new file mode 100644
index 0000000..4422ab2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-08.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Young Seok]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast
new file mode 100644
index 0000000..42348bf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-09.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Malaika]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast
new file mode 100644
index 0000000..6633379
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-10.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Alex]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zach]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast
new file mode 100644
index 0000000..e1eee3f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-11.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zubi]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast
new file mode 100644
index 0000000..dc69e6a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-12.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast
new file mode 100644
index 0000000..4be9a71
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-13.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast
new file mode 100644
index 0000000..5db0d34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-14.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast
new file mode 100644
index 0000000..ff4ac5a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-15.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast
new file mode 100644
index 0000000..256f105
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-16.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast
new file mode 100644
index 0000000..f91833e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-17.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast
new file mode 100644
index 0000000..5bf9d6c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-18.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ !=
+ LiteralExpr [STRING] [Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast
new file mode 100644
index 0000000..811a232
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-19.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast
new file mode 100644
index 0000000..90be7db
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-20.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast
new file mode 100644
index 0000000..abe26d6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-21.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast
new file mode 100644
index 0000000..97b8952
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-22.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Sofia]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast
new file mode 100644
index 0000000..7b62e30
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-23.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Chen]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast
new file mode 100644
index 0000000..51ec059
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast
@@ -0,0 +1,28 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-24.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast
new file mode 100644
index 0000000..46f4398
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-25.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Neil]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast
new file mode 100644
index 0000000..05d74fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-26.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast
new file mode 100644
index 0000000..b175895
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-27.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast
new file mode 100644
index 0000000..15c06d0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-28.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast
new file mode 100644
index 0000000..687536e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-29.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast
new file mode 100644
index 0000000..e572543
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-30.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast
new file mode 100644
index 0000000..c5771bd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-31.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast
new file mode 100644
index 0000000..f2bf632
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-32.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast
new file mode 100644
index 0000000..c75bd69
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-33.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast
new file mode 100644
index 0000000..b30daaa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-34.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Susan]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast
new file mode 100644
index 0000000..07ebdf7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-35.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Isa]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast
new file mode 100644
index 0000000..ec5a443
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-36.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Vanpatten]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast
new file mode 100644
index 0000000..6065247
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-37.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast
new file mode 100644
index 0000000..1a0fdff
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-38.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast
new file mode 100644
index 0000000..bfd613a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-39.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast
new file mode 100644
index 0000000..aa9bf67
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-40.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Young Seok]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast
new file mode 100644
index 0000000..603c195
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-41.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Malaika]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast
new file mode 100644
index 0000000..6254e7e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-42.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Alex]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zach]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast
new file mode 100644
index 0000000..45b3d8c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-43.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zubi]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast
new file mode 100644
index 0000000..9b88340
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-44.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast
new file mode 100644
index 0000000..77d5eb1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-45.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast
new file mode 100644
index 0000000..75cdaab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-46.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast
new file mode 100644
index 0000000..9bace09
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-47.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast
new file mode 100644
index 0000000..58e8c0d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-48.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast
new file mode 100644
index 0000000..42aa6f3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-49.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast
new file mode 100644
index 0000000..96b2c09
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-50.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ !=
+ LiteralExpr [STRING] [Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast
new file mode 100644
index 0000000..ee61d0b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-51.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast
new file mode 100644
index 0000000..61475c9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-52.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast
new file mode 100644
index 0000000..05278a5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-53.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast
new file mode 100644
index 0000000..5fbf88d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-54.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast
new file mode 100644
index 0000000..bd2ddb1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-55.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Sofia]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast
new file mode 100644
index 0000000..a36f447
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-56.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Chen]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast
new file mode 100644
index 0000000..3c6bd5c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-57.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast
new file mode 100644
index 0000000..5765a06
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-58.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Neil]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast
new file mode 100644
index 0000000..7f64667
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-59.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast
new file mode 100644
index 0000000..fd76fa1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast
@@ -0,0 +1,29 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-60.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast
new file mode 100644
index 0000000..21bce85
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-61.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast
new file mode 100644
index 0000000..1536c49
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-62.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast
new file mode 100644
index 0000000..ad1b845
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-63.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast
new file mode 100644
index 0000000..fd9a57d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast
@@ -0,0 +1,65 @@
+DataverseUse colocated
+TypeDecl UserType [
+ open RecordType {
+ uid : int32,
+ name : string,
+ lottery_numbers : UnorderedList <int32>
+
+ }
+]
+TypeDecl VisitorType [
+ open RecordType {
+ vid : int32,
+ name : string,
+ lottery_numbers : UnorderedList <int32>
+
+ }
+]
+DatasetDecl Users(UserType) partitioned by [[uid]]
+DatasetDecl Visitors(VisitorType) partitioned by [[vid]]
+WriteOutputTo nc1:/tmp/fuzzy1.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [user_name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [visitor_name]
+ :
+ FieldAccessor [
+ Variable [ Name=visitor ]
+ Field=name
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Users]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Visitors]
+ ]
+ AS
+ Variable [ Name=visitor ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=uid
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=visitor ]
+ Field=vid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast
new file mode 100644
index 0000000..787d03f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/consolidate-complex-selects.aql
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+LetVariable [ Name=jacca ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.8]
+ ]
+LetVariable [ Name=jaccb ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+LetVariable [ Name=jaccc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacca ]
+ Index: Variable [ Name=jacca ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=jaccb ]
+ Index: Variable [ Name=jaccb ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=authors
+ ]
+ =
+ LiteralExpr [STRING] [testauth]
+ ]
+ and
+ Variable [ Name=jaccc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast
new file mode 100644
index 0000000..da1791a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast
@@ -0,0 +1,63 @@
+DataverseUse test
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+WriteOutputTo nc1:rttest/consolidate-selects-simple.aql
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_name
+ ]
+ =
+ LiteralExpr [STRING] [testname]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_address
+ ]
+ =
+ LiteralExpr [STRING] [testaddr]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_nationkey
+ ]
+ =
+ LiteralExpr [LONG] [1]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_phone
+ ]
+ =
+ LiteralExpr [STRING] [123456789]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/const-folding.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/const-folding.ast
new file mode 100644
index 0000000..7b38d56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/const-folding.ast
@@ -0,0 +1,31 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/divide.adm
+Query:
+FieldAccessor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ LiteralExpr [LONG] [2]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ IndexAccessor [
+ OrderedListConstructor [
+ LiteralExpr [STRING] [foo]
+ LiteralExpr [STRING] [bar]
+ ]
+ Index: OrderedListConstructor [
+ LiteralExpr [STRING] [foo]
+ LiteralExpr [STRING] [bar]
+ ]
+ ]
+ )
+ ]
+ Field=b
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
new file mode 100644
index 0000000..202abef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
@@ -0,0 +1,58 @@
+DataverseUse twitter
+TypeDecl Tweet [
+ open RecordType {
+ id : int32,
+ tweetid : int64,
+ loc : point,
+ time : datetime,
+ text : string
+ }
+]
+DatasetDecl TwitterData(Tweet)is an external dataset
+WriteOutputTo nc1:/tmp/count-tweets.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [word]
+ :
+ Variable [ Name=tok ]
+ )
+ (
+ LiteralExpr [STRING] [count]
+ :
+ FunctionCall twitter.count@1[
+ Variable [ Name=token ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TwitterData]
+ ]
+ AS
+ Variable [ Name=t ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tokens]
+ ]
+ AS
+ Variable [ Name=token ]
+]
+LetVariable [ Name=tokens ]
+ :=
+ FunctionCall twitter.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=text
+ ]
+ ]
+Groupby
+ Variable [ Name=tok ]
+ :=
+ Variable [ Name=token ]
+ With
+ Variable [ Name=tokens ]
+ Variable [ Name=t ]
+ Variable [ Name=token ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast
new file mode 100644
index 0000000..c64af19
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast
@@ -0,0 +1,35 @@
+DataverseUse group_no_agg
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+WriteOutputTo nc1:/tmp/.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=name ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Groupby
+ Variable [ Name=name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_name
+ ]
+ With
+ Variable [ Name=c ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
new file mode 100644
index 0000000..cf92da8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
@@ -0,0 +1,98 @@
+DataverseUse custorder
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Orders(OrderType) partitioned by [[oid]]
+WriteOutputTo nc1:/tmp/custorder.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [cid]
+ :
+ Variable [ Name=cid ]
+ )
+ (
+ LiteralExpr [STRING] [cust]
+ :
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [cust]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [cnt-orders]
+ :
+ FunctionCall custorder.count@1[
+ Variable [ Name=o ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [orders]
+ :
+ Variable [ Name=o ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=cid
+ ]
+ ]
+Groupby
+ Variable [ Name=cid ]
+ :=
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ With
+ Variable [ Name=c ]
+ Variable [ Name=o ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-1.ast
new file mode 100644
index 0000000..72cf10d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-1.ast
@@ -0,0 +1,9 @@
+DataverseUse test
+TypeDecl TestType [
+ open RecordType {
+ id : string,
+ idx : string,
+ no-idx : string
+ }
+]
+DatasetDecl TestSet(TestType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-2.ast
new file mode 100644
index 0000000..72cf10d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-2.ast
@@ -0,0 +1,9 @@
+DataverseUse test
+TypeDecl TestType [
+ open RecordType {
+ id : string,
+ idx : string,
+ no-idx : string
+ }
+]
+DatasetDecl TestSet(TestType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-3.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-3.ast
new file mode 100644
index 0000000..72cf10d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/disjunction-to-join-delete-3.ast
@@ -0,0 +1,9 @@
+DataverseUse test
+TypeDecl TestType [
+ open RecordType {
+ id : string,
+ idx : string,
+ no-idx : string
+ }
+]
+DatasetDecl TestSet(TestType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
new file mode 100644
index 0000000..44d9754
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
@@ -0,0 +1,128 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+WriteOutputTo nc1:rttest/tpch_q1_pricing_summary_report_nt.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_returnflag]
+ :
+ Variable [ Name=l_returnflag ]
+ )
+ (
+ LiteralExpr [STRING] [l_linestatus]
+ :
+ Variable [ Name=l_linestatus ]
+ )
+ (
+ LiteralExpr [STRING] [count_suppkey]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=g ]
+ ]
+ )
+]
+]
+FROM [ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_returnflag]
+ :
+ Variable [ Name=l_returnflag ]
+ )
+ (
+ LiteralExpr [STRING] [l_linestatus]
+ :
+ Variable [ Name=l_linestatus ]
+ )
+ (
+ LiteralExpr [STRING] [l_suppkey]
+ :
+ Variable [ Name=l_suppkey ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems_q1]
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_shipdate
+ ]
+ <=
+ LiteralExpr [STRING] [1998-09-02]
+ ]
+ Groupby
+ Variable [ Name=l_returnflag ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_returnflag
+ ]
+ Variable [ Name=l_linestatus ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_linestatus
+ ]
+ Variable [ Name=l_suppkey ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_suppkey
+ ]
+ With
+ Variable [ Name=l ]
+
+ )
+ AS
+ Variable [ Name=g ]
+]
+Groupby
+ Variable [ Name=l_returnflag ]
+ :=
+ FieldAccessor [
+ Variable [ Name=g ]
+ Field=l_returnflag
+ ]
+ Variable [ Name=l_linestatus ]
+ :=
+ FieldAccessor [
+ Variable [ Name=g ]
+ Field=l_linestatus
+ ]
+ With
+ Variable [ Name=g ]
+
+Orderby
+ Variable [ Name=l_returnflag ]
+ ASC
+ Variable [ Name=l_linestatus ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast
new file mode 100644
index 0000000..dddcd69
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/filter-nested.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
new file mode 100644
index 0000000..fe0b69c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
@@ -0,0 +1,200 @@
+DataverseUse fj-dblp-csx
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/fj-dblp-csx.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [idDBLP]
+ :
+ Variable [ Name=idDBLP ]
+ )
+ (
+ LiteralExpr [STRING] [idCSX]
+ :
+ Variable [ Name=idCSX ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperDBLP ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tokensDBLP]
+ ]
+ AS
+ Variable [ Name=prefixTokenDBLP ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=paperCSX ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tokensCSX]
+ ]
+ AS
+ Variable [ Name=prefixTokenCSX ]
+]
+LetVariable [ Name=idDBLP ]
+ :=
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=id
+ ]
+LetVariable [ Name=unrankedTokensDBLP ]
+ :=
+ FunctionCall fj-dblp-csx.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=tokensDBLP ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ Variable [ Name=unrankedTokensDBLP ]
+ AS
+ Variable [ Name=token ]
+,
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+ ]
+ )
+ AS
+ Variable [ Name=tokenRanked ]
+ AT
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=token ]
+ =
+ Variable [ Name=tokenRanked ]
+ ]
+ Orderby
+ Variable [ Name=i ]
+ ASC
+
+ )
+LetVariable [ Name=idCSX ]
+ :=
+ FieldAccessor [
+ Variable [ Name=paperCSX ]
+ Field=id
+ ]
+LetVariable [ Name=unrankedTokensCSX ]
+ :=
+ FunctionCall fj-dblp-csx.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperCSX ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=tokensCSX ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ Variable [ Name=unrankedTokensCSX ]
+ AS
+ Variable [ Name=token ]
+,
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+ ]
+ )
+ AS
+ Variable [ Name=tokenRanked ]
+ AT
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=token ]
+ =
+ Variable [ Name=tokenRanked ]
+ ]
+ Orderby
+ Variable [ Name=i ]
+ ASC
+
+ )
+Where
+ OperatorExpr [
+ Variable [ Name=prefixTokenDBLP ]
+ =
+ Variable [ Name=prefixTokenCSX ]
+ ]
+Groupby
+ Variable [ Name=idDBLP ]
+ :=
+ Variable [ Name=idDBLP ]
+ Variable [ Name=idCSX ]
+ :=
+ Variable [ Name=idCSX ]
+ With
+ Variable [ Name=tokensCSX ]
+ Variable [ Name=unrankedTokensCSX ]
+ Variable [ Name=idCSX ]
+ Variable [ Name=tokensDBLP ]
+ Variable [ Name=unrankedTokensDBLP ]
+ Variable [ Name=idDBLP ]
+ Variable [ Name=paperDBLP ]
+ Variable [ Name=prefixTokenDBLP ]
+ Variable [ Name=prefixTokenCSX ]
+ Variable [ Name=paperCSX ]
+
+Orderby
+ Variable [ Name=idDBLP ]
+ ASC
+ Variable [ Name=idCSX ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
new file mode 100644
index 0000000..dc23607
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
@@ -0,0 +1,111 @@
+DataverseUse rares03
+TypeDecl UserType [
+ open RecordType {
+ uid : int32,
+ name : string,
+ lottery_numbers : UnorderedList <int32>
+
+ }
+]
+TypeDecl VisitorType [
+ open RecordType {
+ vid : int32,
+ name : string,
+ lottery_numbers : UnorderedList <int32>
+
+ }
+]
+DatasetDecl Users(UserType) partitioned by [[uid]]
+DatasetDecl Visitors(VisitorType) partitioned by [[vid]]
+WriteOutputTo nc1:/tmp/rares03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=uid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [tokens]
+ :
+ Variable [ Name=tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Users]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+LetVariable [ Name=tokens ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ FieldAccessor [
+ Variable [ Name=user ]
+ Field=lottery_numbers
+ ]
+ AS
+ Variable [ Name=lottery_number ]
+,
+ (
+ SELECT ELEMENT [
+ Variable [ Name=item ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Users]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=lottery_numbers
+ ]
+ AS
+ Variable [ Name=lottery_number ]
+ ]
+ Groupby
+ Variable [ Name=item ]
+ :=
+ Variable [ Name=lottery_number ]
+ With
+ Variable [ Name=lottery_number ]
+ Variable [ Name=user ]
+ Variable [ Name=lottery_number ]
+ Variable [ Name=tokens ]
+ Variable [ Name=user ]
+
+ LetVariable [ Name=count ]
+ :=
+ FunctionCall rares03.count@1[
+ Variable [ Name=user ]
+ ]
+ Orderby
+ Variable [ Name=count ]
+ DESC
+
+ )
+ AS
+ Variable [ Name=token ]
+ AT
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=lottery_number ]
+ =
+ Variable [ Name=token ]
+ ]
+ Orderby
+ Variable [ Name=token ]
+ ASC
+
+ )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
new file mode 100644
index 0000000..48fcb34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
@@ -0,0 +1,117 @@
+DataverseUse fuzzyjoin_078
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP_fuzzyjoin_078(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/fuzzyjoin_078.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [tokens]
+ :
+ Variable [ Name=tokensDBLP ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP_fuzzyjoin_078]
+ ]
+ AS
+ Variable [ Name=paperDBLP ]
+]
+LetVariable [ Name=unrankedTokensDBLP ]
+ :=
+ FunctionCall fuzzyjoin_078.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=tokensDBLP ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ Variable [ Name=unrankedTokensDBLP ]
+ AS
+ Variable [ Name=token ]
+,
+ (
+ SELECT ELEMENT [
+ Variable [ Name=tokenGroupped ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP_fuzzyjoin_078]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall fuzzyjoin_078.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=token ]
+ ]
+ Groupby
+ Variable [ Name=tokenGroupped ]
+ :=
+ Variable [ Name=token ]
+ With
+ Variable [ Name=paper ]
+ Variable [ Name=token ]
+ Variable [ Name=token ]
+ Variable [ Name=tokensDBLP ]
+ Variable [ Name=unrankedTokensDBLP ]
+ Variable [ Name=paperDBLP ]
+
+ Orderby
+ FunctionCall fuzzyjoin_078.count@1[
+ Variable [ Name=paper ]
+ ]
+ ASC
+ Variable [ Name=tokenGroupped ]
+ ASC
+
+ )
+ AS
+ Variable [ Name=tokenRanked ]
+ AT
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=token ]
+ =
+ Variable [ Name=tokenRanked ]
+ ]
+ Orderby
+ Variable [ Name=i ]
+ ASC
+
+ )
+Orderby
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast
new file mode 100644
index 0000000..3432a40
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ name : string
+ }
+]
+DatasetDecl t1(TestType) partitioned by [[id]]
+DatasetDecl t2(TestType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/hahsjoin-with-unnest.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [t1]
+ :
+ Variable [ Name=m ]
+ )
+ (
+ LiteralExpr [STRING] [t2]
+ :
+ Variable [ Name=n ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [t1]
+ ]
+ AS
+ Variable [ Name=m ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [t2]
+ ]
+ AS
+ Variable [ Name=n ]
+,
+ FieldAccessor [
+ Variable [ Name=m ]
+ Field=hobbies
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=hobbies
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ Variable [ Name=a ]
+ =
+ Variable [ Name=b ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inline-funs.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inline-funs.ast
new file mode 100644
index 0000000..30ebc0b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inline-funs.ast
@@ -0,0 +1,46 @@
+DataverseUse test
+WriteOutputTo nc1:/tmp/inline_funs.adm
+FunctionDecl f1([]) {
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ FunctionCall test.f2@0[
+ ]
+ ]
+}
+
+FunctionDecl f2([]) {
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ +
+ FunctionCall test.f3@0[
+ ]
+ +
+ FunctionCall test.f3@0[
+ ]
+ +
+ FunctionCall test.f3@0[
+ ]
+ +
+ FunctionCall test.f4@0[
+ ]
+ ]
+}
+
+FunctionDecl f3([]) {
+ OperatorExpr [
+ LiteralExpr [LONG] [0]
+ -
+ LiteralExpr [LONG] [1]
+ ]
+}
+
+FunctionDecl f4([]) {
+ LiteralExpr [LONG] [1001]
+}
+
+Query:
+SELECT ELEMENT [
+FunctionCall test.f1@0[
+]
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
new file mode 100644
index 0000000..ee6cc44
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
@@ -0,0 +1,260 @@
+DataverseUse inlined_q18_large_volume_customer
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+DatasetDecl LineItems(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+WriteOutputTo nc1:/tmp/inlined_q18_large_volume_customer.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [c_name]
+ :
+ Variable [ Name=c_name ]
+ )
+ (
+ LiteralExpr [STRING] [c_custkey]
+ :
+ Variable [ Name=c_custkey ]
+ )
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ Variable [ Name=o_orderkey ]
+ )
+ (
+ LiteralExpr [STRING] [o_orderdate]
+ :
+ Variable [ Name=o_orderdate ]
+ )
+ (
+ LiteralExpr [STRING] [o_totalprice]
+ :
+ Variable [ Name=o_totalprice ]
+ )
+ (
+ LiteralExpr [STRING] [sum_quantity]
+ :
+ FunctionCall inlined_q18_large_volume_customer.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=j ]
+ Field=l_quantity
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=j ]
+ ]
+ )
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_orderkey]
+ :
+ Variable [ Name=l_orderkey ]
+ )
+ (
+ LiteralExpr [STRING] [t_sum_quantity]
+ :
+ FunctionCall inlined_q18_large_volume_customer.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_quantity
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+ Groupby
+ Variable [ Name=l_orderkey ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ With
+ Variable [ Name=l ]
+ Variable [ Name=c ]
+ Variable [ Name=o ]
+
+ )
+ AS
+ Variable [ Name=t ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=l ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=l_orderkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=t_sum_quantity
+ ]
+ >
+ LiteralExpr [LONG] [300]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ]
+ ]
+Groupby
+ Variable [ Name=c_name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_name
+ ]
+ Variable [ Name=c_custkey ]
+ :=
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ Variable [ Name=o_orderkey ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ Variable [ Name=o_orderdate ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ Variable [ Name=o_totalprice ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ With
+ Variable [ Name=c ]
+ Variable [ Name=t ]
+ Variable [ Name=l ]
+ Variable [ Name=o ]
+
+Orderby
+ Variable [ Name=o_totalprice ]
+ DESC
+ Variable [ Name=o_orderdate ]
+ ASC
+
+Limit
+ LiteralExpr [LONG] [100]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-dataset-with-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-dataset-with-index.ast
new file mode 100644
index 0000000..0a65fca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-dataset-with-index.ast
@@ -0,0 +1,10 @@
+TypeDecl Emp [
+ closed RecordType {
+ id : int32,
+ fname : string,
+ lname : string,
+ age : int32,
+ dept : string
+ }
+]
+DatasetDecl employee(Emp) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-dataset.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-dataset.ast
new file mode 100644
index 0000000..705ff4e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-dataset.ast
@@ -0,0 +1,7 @@
+DataverseUse test
+TypeDecl myDataType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl myData(myDataType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-joined-datasets.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-joined-datasets.ast
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/insert-and-scan-joined-datasets.ast
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast
new file mode 100644
index 0000000..de52bd2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast
@@ -0,0 +1,62 @@
+DataverseUse fuzzyjoin
+TypeDecl TOKENSRANKEDADMType [
+ closed RecordType {
+ token : int32,
+ rank : int32
+ }
+]
+DatasetDecl TOKENSRANKEDADM(TOKENSRANKEDADMType) partitioned by [[rank]]
+WriteOutputTo nc1:rttest/introhashpartitionmerge.adm
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=token2 ]
+ Field=rank
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TOKENSRANKEDADM]
+ ]
+ AS
+ Variable [ Name=token1 ]
+,
+ (
+ SELECT ELEMENT [
+ Variable [ Name=tokenRanked ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TOKENSRANKEDADM]
+ ]
+ AS
+ Variable [ Name=tokenRanked ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=tokenRanked ]
+ Field=rank
+ ]
+ ASC
+
+ )
+ AS
+ Variable [ Name=token2 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=token1 ]
+ Field=token
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=token2 ]
+ Field=token
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=token2 ]
+ Field=rank
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast
new file mode 100644
index 0000000..5e06222
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Mu]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast
new file mode 100644
index 0000000..ee9ee67
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast
new file mode 100644
index 0000000..80ed456
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast
new file mode 100644
index 0000000..8ba659b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast
new file mode 100644
index 0000000..5b32107
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast
new file mode 100644
index 0000000..d01be8c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [1]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..a5ec0cd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -0,0 +1,33 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ ~=
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..e3be774
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast
new file mode 100644
index 0000000..3a2e43d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast
new file mode 100644
index 0000000..dfc2b78
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast
@@ -0,0 +1,43 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast
new file mode 100644
index 0000000..6137ce8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast
@@ -0,0 +1,70 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance-check-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast
new file mode 100644
index 0000000..e893033
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast
@@ -0,0 +1,70 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast
new file mode 100644
index 0000000..8d4d941
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast
@@ -0,0 +1,59 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [3]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast
new file mode 100644
index 0000000..211767c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast
@@ -0,0 +1,59 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [1]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..5939747
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ ~=
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..8911b28
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ ~=
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast
new file mode 100644
index 0000000..6df827e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast
@@ -0,0 +1,63 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast
new file mode 100644
index 0000000..520eaa3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast
@@ -0,0 +1,52 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..f9a8f63
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ulist-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ ~=
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [databases]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast
new file mode 100644
index 0000000..352c27b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast
@@ -0,0 +1,63 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ulist-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [databases]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [databases]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast
new file mode 100644
index 0000000..437e2d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast
@@ -0,0 +1,52 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ulist-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [wine]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast
new file mode 100644
index 0000000..ff2ec88
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..b2b87af
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast
new file mode 100644
index 0000000..721ba2f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast
new file mode 100644
index 0000000..d79a75b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
new file mode 100644
index 0000000..7fd4d5e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
new file mode 100644
index 0000000..ed8919f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
new file mode 100644
index 0000000..0c3a146
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast
new file mode 100644
index 0000000..e33ade2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast
new file mode 100644
index 0000000..c02435c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -0,0 +1,66 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
new file mode 100644
index 0000000..8b24f37
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-word-tokens.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=word ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast
new file mode 100644
index 0000000..fe5751b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -0,0 +1,46 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..a2ce996
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -0,0 +1,63 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast
new file mode 100644
index 0000000..d37e489
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_olist-edit-distance-check-let-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast
new file mode 100644
index 0000000..21b8dbb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_olist-edit-distance-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [1]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast
new file mode 100644
index 0000000..3bd622b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast
@@ -0,0 +1,55 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_olist-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast
new file mode 100644
index 0000000..f0bf820
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast
@@ -0,0 +1,55 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ulist-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast
new file mode 100644
index 0000000..6e32d34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..22ccaf9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -0,0 +1,58 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.8]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast
new file mode 100644
index 0000000..8084f98
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-edit-distance-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [aauthors]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [bauthors]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast
new file mode 100644
index 0000000..622f47d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast
@@ -0,0 +1,84 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-edit-distance.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [aauthors]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [bauthors]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..6e84dfe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [aauthors]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [bauthors]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..8de8a42
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast
new file mode 100644
index 0000000..c2b429a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast
@@ -0,0 +1,91 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast
new file mode 100644
index 0000000..dd52bc7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-jaccard.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast
new file mode 100644
index 0000000..df3ec56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast
@@ -0,0 +1,96 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-edit-distance-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast
new file mode 100644
index 0000000..109ff0e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast
@@ -0,0 +1,89 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-edit-distance.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..e7b7618
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..72546e5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast
new file mode 100644
index 0000000..0979b76
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast
@@ -0,0 +1,96 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast
new file mode 100644
index 0000000..df0821c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast
@@ -0,0 +1,89 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-jaccard.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..9030aa4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ulist-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast
new file mode 100644
index 0000000..3a54439
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast
@@ -0,0 +1,96 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ulist-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast
new file mode 100644
index 0000000..b5cd01b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast
@@ -0,0 +1,89 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ulist-jaccard.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..2bbfbba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_word-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast
new file mode 100644
index 0000000..15c16da
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_word-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast
new file mode 100644
index 0000000..5c5083b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_word-jaccard.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast
new file mode 100644
index 0000000..25459dc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast
@@ -0,0 +1,117 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ open RecordType {
+ screen_name : string,
+ lang : string,
+ friends_count : int32,
+ statuses_count : int32,
+ name : string,
+ followers_count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender_location : point?,
+ send_time : datetime,
+ referred_topics : UnorderedList <string>
+,
+ message_text : string
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_issue741.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=referred_topics
+ ]
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=referred_topics
+ ]
+ LiteralExpr [FLOAT] [0.6]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=send_time
+ ]
+ >=
+ FunctionCall test.datetime@1[
+ LiteralExpr [STRING] [2011-06-18T14:10:17]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=send_time
+ ]
+ <
+ FunctionCall test.datetime@1[
+ LiteralExpr [STRING] [2011-06-18T15:10:17]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
new file mode 100644
index 0000000..a3b4ee5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -0,0 +1,148 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=message-text
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=message-text
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=message-text
+ ]
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=message-text
+ ]
+ LiteralExpr [LONG] [7]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ >
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [240]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
new file mode 100644
index 0000000..d280beb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
@@ -0,0 +1,148 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-jaccard-check_idx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=referred-topics
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=referred-topics
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=referred-topics
+ ]
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=referred-topics
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ >
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [240]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast
new file mode 100644
index 0000000..a704add
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast
new file mode 100644
index 0000000..fe0a5ae
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast
new file mode 100644
index 0000000..226ef2da
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast
new file mode 100644
index 0000000..22a1b5c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast
new file mode 100644
index 0000000..5dd91f7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast
new file mode 100644
index 0000000..2f33777
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-contains.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast
new file mode 100644
index 0000000..0bb1cc1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast
new file mode 100644
index 0000000..c558c56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast
new file mode 100644
index 0000000..cbe7ead
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast
@@ -0,0 +1,68 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast
new file mode 100644
index 0000000..1b28c62
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
new file mode 100644
index 0000000..d9572ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
new file mode 100644
index 0000000..d9572ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
new file mode 100644
index 0000000..c8abd1e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
@@ -0,0 +1,67 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_03.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..6acee19
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..23cc11f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_02.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..ba8bc3a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_03.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast
new file mode 100644
index 0000000..d0217af
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast
@@ -0,0 +1,105 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast
new file mode 100644
index 0000000..0fd14a4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast
@@ -0,0 +1,105 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast
new file mode 100644
index 0000000..b816313
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast
@@ -0,0 +1,95 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast
new file mode 100644
index 0000000..4695a2c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast
new file mode 100644
index 0000000..c20a176
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast
new file mode 100644
index 0000000..e15dd73
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast
new file mode 100644
index 0000000..508f374
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast
new file mode 100644
index 0000000..2683356
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast
new file mode 100644
index 0000000..50e0cac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast
new file mode 100644
index 0000000..a0714e9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast
new file mode 100644
index 0000000..c76a987
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast
new file mode 100644
index 0000000..da43e50
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast
new file mode 100644
index 0000000..ea73b1d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast
new file mode 100644
index 0000000..cd6030b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast
new file mode 100644
index 0000000..47bb197
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast
new file mode 100644
index 0000000..497a7bc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
new file mode 100644
index 0000000..5c2bb68
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast
new file mode 100644
index 0000000..e5041c2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_02.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast
new file mode 100644
index 0000000..50a6766
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_03.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..6867b1f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..f73f475
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_02.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..a460848
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_03.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast
new file mode 100644
index 0000000..6047077
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast
new file mode 100644
index 0000000..201c5b1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast
new file mode 100644
index 0000000..2b79710
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast
new file mode 100644
index 0000000..e54b565
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast
new file mode 100644
index 0000000..c4c53e9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast
new file mode 100644
index 0000000..e9bc194
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast
new file mode 100644
index 0000000..49df027
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast
new file mode 100644
index 0000000..ad23eb3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..26d202c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..d4a74e6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-fuzzyeq-jaccard_02.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..6e2bc46
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-fuzzyeq-jaccard_03.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast
new file mode 100644
index 0000000..5522ff1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast
new file mode 100644
index 0000000..ad4806a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast
new file mode 100644
index 0000000..fe395ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast
new file mode 100644
index 0000000..20a87d3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast
new file mode 100644
index 0000000..19e7e50
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast
new file mode 100644
index 0000000..fe480c0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast
new file mode 100644
index 0000000..0d86200
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast
new file mode 100644
index 0000000..fa078f8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..471fc0d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..6754b52
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_02.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..880a2c6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,71 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_03.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast
new file mode 100644
index 0000000..5b4c193
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -0,0 +1,114 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [t1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sim]
+ :
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+]
+LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=message-text
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=message-text
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.6]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [20]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast
new file mode 100644
index 0000000..6586148
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast
@@ -0,0 +1,96 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast
new file mode 100644
index 0000000..0b50ff8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast
@@ -0,0 +1,96 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast
new file mode 100644
index 0000000..3c74848
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast
new file mode 100644
index 0000000..711c89a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast
new file mode 100644
index 0000000..9c3199f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast
new file mode 100644
index 0000000..e8f2e5b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast
new file mode 100644
index 0000000..58e6be6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast
@@ -0,0 +1,72 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast
new file mode 100644
index 0000000..f1fc7c8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast
@@ -0,0 +1,80 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast
new file mode 100644
index 0000000..ac3d0bc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast
@@ -0,0 +1,128 @@
+DataverseUse join-super-key_1
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+WriteOutputTo nc1:/tmp/join-super-key_01.adm
+DatasetDecl LineItems(LineItemType) partitioned by [[l_partkey], [l_linenumber]]
+DatasetDecl PartSupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_partkey]
+ :
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_partkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=li ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [PartSupp]
+ ]
+ AS
+ Variable [ Name=ps ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_partkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_suppkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_extendedprice
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_supplycost
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast
new file mode 100644
index 0000000..e2ed7f3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast
@@ -0,0 +1,128 @@
+DataverseUse join-super-key_01
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+WriteOutputTo nc1:/tmp/join-super-key_01.adm
+DatasetDecl LineItems(LineItemType) partitioned by [[l_partkey], [l_linenumber]]
+DatasetDecl PartSupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_partkey]
+ :
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_partkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [PartSupp]
+ ]
+ AS
+ Variable [ Name=ps ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=li ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_partkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_suppkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_extendedprice
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_supplycost
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast
new file mode 100644
index 0000000..183c8a7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast
@@ -0,0 +1,137 @@
+DataverseUse loj-super-key_01
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+WriteOutputTo nc1:/tmp/loj-super-key_01.adm
+DatasetDecl LineItems(LineItemType) partitioned by [[l_partkey], [l_linenumber]]
+DatasetDecl PartSupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [li]
+ :
+ Variable [ Name=li ]
+ )
+ (
+ LiteralExpr [STRING] [partsupp]
+ :
+ Variable [ Name=partsupp ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=li ]
+]
+LetVariable [ Name=partsupp ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=ps ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [PartSupp]
+ ]
+ AS
+ Variable [ Name=ps ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_partkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_suppkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_extendedprice
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_supplycost
+ ]
+ ]
+ ]
+ )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast
new file mode 100644
index 0000000..f78a47f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast
@@ -0,0 +1,137 @@
+DataverseUse loj-super-key_02
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+WriteOutputTo nc1:/tmp/loj-super-key_01.adm
+DatasetDecl LineItems(LineItemType) partitioned by [[l_partkey], [l_linenumber]]
+DatasetDecl PartSupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [partsupp]
+ :
+ Variable [ Name=ps ]
+ )
+ (
+ LiteralExpr [STRING] [li]
+ :
+ Variable [ Name=items ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [PartSupp]
+ ]
+ AS
+ Variable [ Name=ps ]
+]
+LetVariable [ Name=items ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=li ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=li ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_partkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_suppkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=li ]
+ Field=l_extendedprice
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_supplycost
+ ]
+ ]
+ ]
+ )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
new file mode 100644
index 0000000..1556199
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
@@ -0,0 +1,220 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl RegionType [
+ closed RecordType {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Supplier(SupplierType) partitioned by [[s_suppkey]]
+DatasetDecl Region(RegionType) partitioned by [[r_regionkey]]
+DatasetDecl Nation(NationType) partitioned by [[n_nationkey]]
+DatasetDecl Part(PartType) partitioned by [[p_partkey]]
+DatasetDecl Partsupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+DatasetDecl SelectedNation(NationType) partitioned by [[n_nationkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [nation_key]
+ :
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_nationkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [aggregates]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [order_date]
+ :
+ Variable [ Name=orderdate ]
+ )
+ (
+ LiteralExpr [STRING] [sum_price]
+ :
+ Variable [ Name=sum ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=orders ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customer]
+ ]
+ AS
+ Variable [ Name=customer ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=orders ]
+ Field=o_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=customer ]
+ Field=c_custkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=customer ]
+ Field=c_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_nationkey
+ ]
+ ]
+ ]
+ Groupby
+ Variable [ Name=orderdate ]
+ :=
+ FieldAccessor [
+ Variable [ Name=orders ]
+ Field=o_orderdate
+ ]
+ With
+ Variable [ Name=orders ]
+ Variable [ Name=customer ]
+ Variable [ Name=nation ]
+ Variable [ Name=sn ]
+
+ LetVariable [ Name=sum ]
+ :=
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ ]
+ FROM [ Variable [ Name=orders ]
+ AS
+ Variable [ Name=o ]
+ ]
+ )
+ ]
+ Orderby
+ Variable [ Name=sum ]
+ ASC
+
+ Limit
+ LiteralExpr [LONG] [3]
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Nation]
+ ]
+ AS
+ Variable [ Name=nation ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [SelectedNation]
+ ]
+ AS
+ Variable [ Name=sn ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=sn ]
+ Field=n_nationkey
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast
new file mode 100644
index 0000000..ed8e12c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+TypeDecl NestedTestType [
+ open RecordType {
+ idx : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ id : string,
+ no-idx : string,
+ nested : NestedTestType
+ }
+]
+DatasetDecl TestSet(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TestSet]
+ ]
+ AS
+ Variable [ Name=x ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=idx
+ ]
+ =
+ LiteralExpr [STRING] [one]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=idx
+ ]
+ =
+ LiteralExpr [STRING] [two]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
new file mode 100644
index 0000000..a80969f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
@@ -0,0 +1,154 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
new file mode 100644
index 0000000..9cd8ca9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
@@ -0,0 +1,174 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast
new file mode 100644
index 0000000..2ef7739
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast
new file mode 100644
index 0000000..ca30680
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast
new file mode 100644
index 0000000..2532b97
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast
new file mode 100644
index 0000000..69c2080
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast
new file mode 100644
index 0000000..ad60381
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast
new file mode 100644
index 0000000..eb2a8ea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast
new file mode 100644
index 0000000..5954689
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast
new file mode 100644
index 0000000..60d0d3f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast
new file mode 100644
index 0000000..7bb68ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl Name [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(Name) partitioned by [[nested, fname], [nested, lname]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-composite-key-prefix-prefix-join_06.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast
new file mode 100644
index 0000000..c18bfa1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast
@@ -0,0 +1,133 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderTypetmp [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ nested : OrderTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Orders(OrderType) partitioned by [[nested, oid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join-multipred.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ )
+ (
+ LiteralExpr [STRING] [order]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=name
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=orderstatus
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=age
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast
new file mode 100644
index 0000000..18e2cca
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join-neg_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast
new file mode 100644
index 0000000..0b0dee7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast
new file mode 100644
index 0000000..dda0c74
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast
new file mode 100644
index 0000000..f7fe80e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast
@@ -0,0 +1,95 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderTypetmp [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ nested : OrderTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Orders(OrderType) partitioned by [[nested, oid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ )
+ (
+ LiteralExpr [STRING] [order]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast
new file mode 100644
index 0000000..73cd664
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast
@@ -0,0 +1,95 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl OrderTypetmp [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ nested : OrderTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Orders(OrderType) partitioned by [[nested, oid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ )
+ (
+ LiteralExpr [STRING] [order]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast
new file mode 100644
index 0000000..6938c8c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-equi-join_06.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [customer1]
+ :
+ FieldAccessor [
+ Variable [ Name=c1 ]
+ Field=nested
+ ]
+ )
+ (
+ LiteralExpr [STRING] [customer2]
+ :
+ FieldAccessor [
+ Variable [ Name=c2 ]
+ Field=nested
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c2 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c1 ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c2 ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast
new file mode 100644
index 0000000..abfb347
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-ge-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ >=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast
new file mode 100644
index 0000000..bc91d4c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-gt-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast
new file mode 100644
index 0000000..454e159
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-le-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ <=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast
new file mode 100644
index 0000000..4aa9cc3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast
@@ -0,0 +1,50 @@
+TypeDecl TestTypetmp [
+ open RecordType {
+ key1 : int32,
+ key2 : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl DsOne(TestType) partitioned by [[nested, key1]]
+DatasetDecl DsTwo(TestType) partitioned by [[nested, key1]]
+WriteOutputTo nc1:rttest/btree-index-join_primary-lt-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsOne]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test1.DsTwo]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=key1
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=nested
+ ]
+ Field=key2
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast
new file mode 100644
index 0000000..570a02a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast
@@ -0,0 +1,151 @@
+DataverseUse test
+TypeDecl EmploymentType [
+ closed RecordType {
+ organization-name : string,
+ start-date : date,
+ end-date : date?
+ }
+]
+TypeDecl FacebookUserTypetmp [
+ closed RecordType {
+ id : int32,
+ id-copy : int32,
+ alias : string,
+ name : string,
+ user-since : datetime,
+ user-since-copy : datetime,
+ friend-ids : UnorderedList <int32>
+,
+ employment : OrderedList [EmploymentType]
+
+ }
+]
+TypeDecl FacebookMessageTypetmp [
+ closed RecordType {
+ message-id : int32,
+ message-id-copy : int32,
+ author-id : int32,
+ author-id-copy : int32,
+ in-response-to : int32?,
+ sender-location : point?,
+ message : string
+ }
+]
+TypeDecl FacebookUserType [
+ closed RecordType {
+ nested : FacebookUserTypetmp
+ }
+]
+TypeDecl FacebookMessageType [
+ closed RecordType {
+ nested : FacebookMessageTypetmp
+ }
+]
+DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[nested, id]]
+DatasetDecl FacebookMessages(FacebookMessageType) partitioned by [[nested, message-id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multiindex.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [fbu-ID]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [fbm-auth-ID]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=nested
+ ]
+ Field=author-id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [uname]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [message]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=nested
+ ]
+ Field=message
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookMessages]
+ ]
+ AS
+ Variable [ Name=message ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=nested
+ ]
+ Field=author-id-copy
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ >=
+ LiteralExpr [LONG] [11000]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <=
+ LiteralExpr [LONG] [12000]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast
new file mode 100644
index 0000000..6819318
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast
@@ -0,0 +1,115 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multipred.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=misc
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=misc
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast
new file mode 100644
index 0000000..9ce15ed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast
new file mode 100644
index 0000000..42ce16e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-01.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast
new file mode 100644
index 0000000..f360b93
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-02.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Susan]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast
new file mode 100644
index 0000000..0b84e43
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-03.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Isa]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast
new file mode 100644
index 0000000..00b3e5f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-04.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Vanpatten]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast
new file mode 100644
index 0000000..13c7a0c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-05.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast
new file mode 100644
index 0000000..22b4a09
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-06.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast
new file mode 100644
index 0000000..d7ce1aa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast
@@ -0,0 +1,39 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-07.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast
new file mode 100644
index 0000000..f3b2650
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-08.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Young Seok]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast
new file mode 100644
index 0000000..fdb6714
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-09.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Malaika]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast
new file mode 100644
index 0000000..b5d84d9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-10.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Alex]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zach]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast
new file mode 100644
index 0000000..af3babb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-11.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zubi]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast
new file mode 100644
index 0000000..2f631d6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-12.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast
new file mode 100644
index 0000000..216fed4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-13.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast
new file mode 100644
index 0000000..ee2ff97
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-14.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast
new file mode 100644
index 0000000..717f5ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-15.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast
new file mode 100644
index 0000000..5dffd6f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-16.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast
new file mode 100644
index 0000000..e4ed6d6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-17.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast
new file mode 100644
index 0000000..6d3e3ea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-18.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ !=
+ LiteralExpr [STRING] [Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast
new file mode 100644
index 0000000..ed5c69e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-19.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast
new file mode 100644
index 0000000..a9077eb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-20.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast
new file mode 100644
index 0000000..5d9f8650
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-21.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast
new file mode 100644
index 0000000..27f522c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-22.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Sofia]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast
new file mode 100644
index 0000000..2991c8f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-23.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Chen]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast
new file mode 100644
index 0000000..7ddd5a3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-24.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast
new file mode 100644
index 0000000..5d7aa47
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-25.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Neil]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast
new file mode 100644
index 0000000..ce501f9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-26.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast
new file mode 100644
index 0000000..8d1be46
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-27.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast
new file mode 100644
index 0000000..e5ced5a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-28.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast
new file mode 100644
index 0000000..c587956
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-29.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast
new file mode 100644
index 0000000..232c6e4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-30.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast
new file mode 100644
index 0000000..1809232
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-31.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast
new file mode 100644
index 0000000..e7ad65c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-32.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast
new file mode 100644
index 0000000..7889023
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-31.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast
new file mode 100644
index 0000000..990799e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-32.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Susan]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast
new file mode 100644
index 0000000..b05f885
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-33.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Isa]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast
new file mode 100644
index 0000000..5f9d594
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-34.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Vanpatten]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast
new file mode 100644
index 0000000..a0696dd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-35.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast
new file mode 100644
index 0000000..a5433da
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-36.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast
new file mode 100644
index 0000000..594198a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-37.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast
new file mode 100644
index 0000000..565be07
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-38.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Young Seok]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast
new file mode 100644
index 0000000..18c3e40
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-39.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Malaika]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast
new file mode 100644
index 0000000..1a85c82
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-40.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Alex]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zach]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast
new file mode 100644
index 0000000..a5f5d1b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-41.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zubi]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast
new file mode 100644
index 0000000..ac2f9db
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-42.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast
new file mode 100644
index 0000000..599c307
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-43.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast
new file mode 100644
index 0000000..fc37fd3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-44.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast
new file mode 100644
index 0000000..e46e858
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-45.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast
new file mode 100644
index 0000000..c3e6c2c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-46.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast
new file mode 100644
index 0000000..bea229d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-47.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast
new file mode 100644
index 0000000..13c5526
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-48.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ !=
+ LiteralExpr [STRING] [Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast
new file mode 100644
index 0000000..3dcb983
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-49.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast
new file mode 100644
index 0000000..d7c1d4b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-50.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast
new file mode 100644
index 0000000..5af903b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-51.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast
new file mode 100644
index 0000000..fa7becf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-52.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast
new file mode 100644
index 0000000..d537f37
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-53.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Sofia]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast
new file mode 100644
index 0000000..aa88dcf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-54.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Chen]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast
new file mode 100644
index 0000000..cf3bf3e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-55.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast
new file mode 100644
index 0000000..86754e6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-56.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Neil]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast
new file mode 100644
index 0000000..692abda
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-57.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast
new file mode 100644
index 0000000..113897d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-58.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast
new file mode 100644
index 0000000..d2b1557
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-61.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast
new file mode 100644
index 0000000..e7c31f1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-62.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast
new file mode 100644
index 0000000..c5c5f2a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-63.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast
new file mode 100644
index 0000000..3ec89da
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast
@@ -0,0 +1,48 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Mu]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast
new file mode 100644
index 0000000..1f56127
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast
@@ -0,0 +1,48 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
new file mode 100644
index 0000000..fb96e6c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -0,0 +1,45 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast
new file mode 100644
index 0000000..cab1fc3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast
@@ -0,0 +1,52 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast
new file mode 100644
index 0000000..ac106b9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast
new file mode 100644
index 0000000..03a8300
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [1]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..3008416
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..012956a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast
new file mode 100644
index 0000000..a62993b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast
@@ -0,0 +1,69 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast
new file mode 100644
index 0000000..d4b8bdc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast
new file mode 100644
index 0000000..c4b3feb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance-check-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast
new file mode 100644
index 0000000..49cb6f6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast
new file mode 100644
index 0000000..16f1b3f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast
@@ -0,0 +1,71 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [3]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast
new file mode 100644
index 0000000..7acd8c0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast
@@ -0,0 +1,71 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-edit-distance.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [1]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..0e5a6b4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
@@ -0,0 +1,69 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ~=
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..b4fc19f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast
@@ -0,0 +1,59 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ~=
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast
new file mode 100644
index 0000000..c5d132d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast
new file mode 100644
index 0000000..798117d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_olist-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..3987c49
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ulist-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ~=
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [databases]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast
new file mode 100644
index 0000000..6d2fa02
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ulist-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [databases]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [databases]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast
new file mode 100644
index 0000000..ed90e64
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ulist-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ UnorderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [wine]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast
new file mode 100644
index 0000000..fd54f12
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast
@@ -0,0 +1,48 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..ad20927
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -0,0 +1,45 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast
new file mode 100644
index 0000000..a56a462
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast
new file mode 100644
index 0000000..01ed330
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast
@@ -0,0 +1,46 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
new file mode 100644
index 0000000..6440f7e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -0,0 +1,65 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
new file mode 100644
index 0000000..a3648fe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -0,0 +1,65 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
new file mode 100644
index 0000000..9e51d97
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -0,0 +1,45 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast
new file mode 100644
index 0000000..025aa20
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -0,0 +1,45 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
new file mode 100644
index 0000000..83c6b9b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl DBLPNestedType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPNestedType
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
new file mode 100644
index 0000000..4108c72
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl DBLPNestedType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPNestedType
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-word-tokens.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=word ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast
new file mode 100644
index 0000000..1fe0c3a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..e772f9f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -0,0 +1,71 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast
new file mode 100644
index 0000000..d54ef57
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_olist-edit-distance-check-let-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast
new file mode 100644
index 0000000..29ce26d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_olist-edit-distance-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ LiteralExpr [STRING] [walking]
+ ]
+ LiteralExpr [LONG] [1]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast
new file mode 100644
index 0000000..6fe8f83
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast
@@ -0,0 +1,63 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_olist-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast
new file mode 100644
index 0000000..ba67057
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ulist-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=c ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ OrderedListConstructor [
+ LiteralExpr [STRING] [databases]
+ LiteralExpr [STRING] [computers]
+ LiteralExpr [STRING] [wine]
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast
new file mode 100644
index 0000000..48e978f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..a6c08fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -0,0 +1,66 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.8]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
new file mode 100644
index 0000000..cadc921
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -0,0 +1,186 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ LiteralExpr [LONG] [7]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ >
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [240]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
new file mode 100644
index 0000000..a698a84
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
@@ -0,0 +1,186 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-jaccard-check_idx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=referred-topics
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=referred-topics
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=referred-topics
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=referred-topics
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ >
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [240]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast
new file mode 100644
index 0000000..088d1ec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -0,0 +1,116 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast
new file mode 100644
index 0000000..24ca38a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast
@@ -0,0 +1,116 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-contains.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast
new file mode 100644
index 0000000..86cc4e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast
@@ -0,0 +1,105 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-edit-distance-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [aauthors]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [bauthors]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast
new file mode 100644
index 0000000..c9fe10c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast
@@ -0,0 +1,100 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
new file mode 100644
index 0000000..f477597
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..ca69c0d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,108 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast
new file mode 100644
index 0000000..852ddc8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast
@@ -0,0 +1,133 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast
new file mode 100644
index 0000000..7d0cefb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast
@@ -0,0 +1,114 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast
new file mode 100644
index 0000000..9a0270a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast
@@ -0,0 +1,109 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast
new file mode 100644
index 0000000..7cc0e31
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast
@@ -0,0 +1,116 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast
new file mode 100644
index 0000000..754a451
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast
@@ -0,0 +1,120 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-edit-distance-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast
new file mode 100644
index 0000000..ea5e34c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast
@@ -0,0 +1,100 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
new file mode 100644
index 0000000..8c088c3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..8b5badc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast
new file mode 100644
index 0000000..280f534
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast
@@ -0,0 +1,116 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast
new file mode 100644
index 0000000..bb60c12
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast
@@ -0,0 +1,120 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_olist-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast
new file mode 100644
index 0000000..e281004
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast
@@ -0,0 +1,100 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : OrderedList [string]
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_olist-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..07274a1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.7f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast
new file mode 100644
index 0000000..2f0cb06
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast
@@ -0,0 +1,116 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast
new file mode 100644
index 0000000..30ee3fc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast
@@ -0,0 +1,120 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ulist-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [ainterests]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [binterests]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast
new file mode 100644
index 0000000..a41eba6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast
@@ -0,0 +1,100 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerTypetmp [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ nested : CustomerTypetmp
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[nested, cid]]
+DatasetDecl Customers2(CustomerType) partitioned by [[nested, cid]]
+WriteOutputTo nc1:rttest/inverted-index-join_ulist-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=interests
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.7]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=cid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..f82fb83
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,103 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
new file mode 100644
index 0000000..317caba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -0,0 +1,140 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [t1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sim]
+ :
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+]
+LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.6]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [20]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast
new file mode 100644
index 0000000..6daba98
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast
@@ -0,0 +1,124 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast
new file mode 100644
index 0000000..36a5db9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast
@@ -0,0 +1,109 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_word-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast
new file mode 100644
index 0000000..459bc81
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast
@@ -0,0 +1,104 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
new file mode 100644
index 0000000..2bdd565d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -0,0 +1,156 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
new file mode 100644
index 0000000..c42875a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -0,0 +1,179 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast
new file mode 100644
index 0000000..3698698
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordNested [
+ closed RecordType {
+ nested : MyRecord
+ }
+]
+DatasetDecl MyData1(MyRecordNested) partitioned by [[nested, id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index-join_rtree-spatial-intersect-point.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast
new file mode 100644
index 0000000..e270746
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordNested [
+ closed RecordType {
+ nested : MyRecord
+ }
+]
+DatasetDecl MyData1(MyRecordNested) partitioned by [[nested, id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast
new file mode 100644
index 0000000..2b58875
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordNested [
+ closed RecordType {
+ nested : MyRecord
+ }
+]
+DatasetDecl MyData(MyRecordNested) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast
new file mode 100644
index 0000000..e53eac9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+TypeDecl NestedTestType [
+ open RecordType {
+
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ id : string,
+ no-idx : string,
+ nested : NestedTestType
+ }
+]
+DatasetDecl TestSet(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TestSet]
+ ]
+ AS
+ Variable [ Name=x ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=idx
+ ]
+ =
+ LiteralExpr [STRING] [one]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nested
+ ]
+ Field=idx
+ ]
+ =
+ LiteralExpr [STRING] [two]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
new file mode 100644
index 0000000..63392c3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
@@ -0,0 +1,153 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
new file mode 100644
index 0000000..6d5f9ed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
@@ -0,0 +1,152 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
new file mode 100644
index 0000000..9607abf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
@@ -0,0 +1,173 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
new file mode 100644
index 0000000..cdb65ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
@@ -0,0 +1,172 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=countB
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast
new file mode 100644
index 0000000..ef70cb3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast
new file mode 100644
index 0000000..9f1f805
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast
new file mode 100644
index 0000000..5addf60
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast
new file mode 100644
index 0000000..7ca97e3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast
new file mode 100644
index 0000000..0df6d2d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast
new file mode 100644
index 0000000..469a699
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast
new file mode 100644
index 0000000..8d0c77d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast
new file mode 100644
index 0000000..a522e08
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast
new file mode 100644
index 0000000..df80dc5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl Nametmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl NameType [
+ open RecordType {
+ nested : Nametmp
+ }
+]
+DatasetDecl Names(NameType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_06.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast
new file mode 100644
index 0000000..2619950
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast
@@ -0,0 +1,150 @@
+DataverseUse test
+TypeDecl EmploymentType [
+ closed RecordType {
+ organization-name : string,
+ start-date : date,
+ end-date : date?
+ }
+]
+TypeDecl FacebookUserTypetmp [
+ closed RecordType {
+ id : int32,
+ id-copy : int32,
+ alias : string,
+ name : string,
+ user-since : datetime,
+ user-since-copy : datetime,
+ friend-ids : UnorderedList <int32>
+,
+ employment : OrderedList [EmploymentType]
+
+ }
+]
+TypeDecl FacebookMessageTypetmp [
+ open RecordType {
+ message-id : int32,
+ message-id-copy : int32,
+ author-id : int32,
+ in-response-to : int32?,
+ sender-location : point?,
+ message : string
+ }
+]
+TypeDecl FacebookUserType [
+ closed RecordType {
+ nested : FacebookUserTypetmp
+ }
+]
+TypeDecl FacebookMessageType [
+ closed RecordType {
+ nested : FacebookMessageTypetmp
+ }
+]
+DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[nested, id]]
+DatasetDecl FacebookMessages(FacebookMessageType) partitioned by [[nested, message-id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multiindex.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [fbu-ID]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [fbm-auth-ID]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=nested
+ ]
+ Field=author-id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [uname]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [message]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=nested
+ ]
+ Field=message
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookMessages]
+ ]
+ AS
+ Variable [ Name=message ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=nested
+ ]
+ Field=author-id-copy
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ >=
+ LiteralExpr [LONG] [11000]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <=
+ LiteralExpr [LONG] [12000]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast
new file mode 100644
index 0000000..85f78c1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast
@@ -0,0 +1,114 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multipred.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=misc
+ ]
+ >
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=misc
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast
new file mode 100644
index 0000000..2bfc7b9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast
new file mode 100644
index 0000000..75d15e0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast
new file mode 100644
index 0000000..13828ea
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast
new file mode 100644
index 0000000..08155b9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ open RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [arec2]
+ :
+ Variable [ Name=a2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a2 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a2 ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast
new file mode 100644
index 0000000..d890c9d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast
new file mode 100644
index 0000000..3d87a03
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-39.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast
new file mode 100644
index 0000000..e9e055d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-32.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Susan]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast
new file mode 100644
index 0000000..559946a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-33.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Isa]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast
new file mode 100644
index 0000000..12bc90c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-34.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Vanpatten]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast
new file mode 100644
index 0000000..c19e835
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-35.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast
new file mode 100644
index 0000000..3f24f5e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-36.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast
new file mode 100644
index 0000000..c8f18e0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast
@@ -0,0 +1,35 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-37.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast
new file mode 100644
index 0000000..96ab5cd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-38.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Young Seok]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast
new file mode 100644
index 0000000..5c8a204
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-39.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Malaika]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast
new file mode 100644
index 0000000..0eebdd0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-40.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Alex]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zach]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast
new file mode 100644
index 0000000..c7c1070
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-41.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zubi]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast
new file mode 100644
index 0000000..bb19dc6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-42.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast
new file mode 100644
index 0000000..b54ee73
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-43.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast
new file mode 100644
index 0000000..707f74e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-44.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast
new file mode 100644
index 0000000..775f209
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-45.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast
new file mode 100644
index 0000000..14829b0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-46.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast
new file mode 100644
index 0000000..1aac06d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-47.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast
new file mode 100644
index 0000000..f2792b8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-48.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ !=
+ LiteralExpr [STRING] [Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast
new file mode 100644
index 0000000..f0b1d99
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-49.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast
new file mode 100644
index 0000000..0297232
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-50.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast
new file mode 100644
index 0000000..4a58d71
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-51.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast
new file mode 100644
index 0000000..b4e65c0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-52.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast
new file mode 100644
index 0000000..d3d837a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-53.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Sofia]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast
new file mode 100644
index 0000000..c4e1842
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-54.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Chen]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast
new file mode 100644
index 0000000..3ffdf5f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-55.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast
new file mode 100644
index 0000000..161a3dc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-56.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Neil]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast
new file mode 100644
index 0000000..5b84f63
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-57.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast
new file mode 100644
index 0000000..22ca310
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-58.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32,
+ lname : string
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast
new file mode 100644
index 0000000..78815cd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast
@@ -0,0 +1,73 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-59.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast
new file mode 100644
index 0000000..65065ef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-62.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast
new file mode 100644
index 0000000..2fc1528
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-63.adm
+TypeDecl TestTypetmp [
+ open RecordType {
+ id : int32
+ }
+]
+TypeDecl TestType [
+ open RecordType {
+ nested : TestTypetmp
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[nested, id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=nested
+ ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast
new file mode 100644
index 0000000..26cae64
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast
@@ -0,0 +1,47 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Mu]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast
new file mode 100644
index 0000000..61925fc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast
@@ -0,0 +1,47 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
new file mode 100644
index 0000000..d12ceed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -0,0 +1,44 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast
new file mode 100644
index 0000000..4555873
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast
@@ -0,0 +1,51 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast
new file mode 100644
index 0000000..8e0250c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast
new file mode 100644
index 0000000..e0f39a7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [1]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..44874f2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..402b08c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -0,0 +1,49 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast
new file mode 100644
index 0000000..9b70e65
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast
@@ -0,0 +1,68 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast
new file mode 100644
index 0000000..3940247f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast
new file mode 100644
index 0000000..34ac5cb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast
@@ -0,0 +1,47 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..17f0ea4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -0,0 +1,44 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast
new file mode 100644
index 0000000..4ce086b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast
@@ -0,0 +1,59 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast
new file mode 100644
index 0000000..ec5d58f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast
@@ -0,0 +1,45 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
new file mode 100644
index 0000000..062e678
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
new file mode 100644
index 0000000..b3d37bd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
new file mode 100644
index 0000000..83610a0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -0,0 +1,44 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast
new file mode 100644
index 0000000..04a8d06
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -0,0 +1,44 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
new file mode 100644
index 0000000..36ca9fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl DBLPNestedType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPNestedType
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
new file mode 100644
index 0000000..00611cd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -0,0 +1,74 @@
+DataverseUse test
+TypeDecl DBLPNestedType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPNestedType
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-word-tokens.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=word ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast
new file mode 100644
index 0000000..2289a82
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..2c41290
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -0,0 +1,70 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast
new file mode 100644
index 0000000..e2d7abe
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast
@@ -0,0 +1,48 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..37d4ee0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -0,0 +1,65 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.8]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
new file mode 100644
index 0000000..6bac05c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -0,0 +1,185 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ LiteralExpr [LONG] [7]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ >
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [240]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast
new file mode 100644
index 0000000..5f185e0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast
new file mode 100644
index 0000000..9199cad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast
new file mode 100644
index 0000000..f0f75b2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast
new file mode 100644
index 0000000..de0a51f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast
@@ -0,0 +1,89 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast
new file mode 100644
index 0000000..a9c2373
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -0,0 +1,115 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast
new file mode 100644
index 0000000..6c615b2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast
@@ -0,0 +1,115 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast
new file mode 100644
index 0000000..567cac1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast
@@ -0,0 +1,100 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast
new file mode 100644
index 0000000..b4e0ea6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast
@@ -0,0 +1,114 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast
new file mode 100644
index 0000000..b4e0ea6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast
@@ -0,0 +1,114 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast
new file mode 100644
index 0000000..ec7ea04
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast
@@ -0,0 +1,115 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-contains.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast
new file mode 100644
index 0000000..6f919c6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast
@@ -0,0 +1,104 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-edit-distance-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [aauthors]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [bauthors]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast
new file mode 100644
index 0000000..aef0e68
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast
new file mode 100644
index 0000000..c612f1d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast
@@ -0,0 +1,99 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast
new file mode 100644
index 0000000..5f02579
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast
@@ -0,0 +1,84 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast
new file mode 100644
index 0000000..4c0e321
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast
@@ -0,0 +1,98 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast
new file mode 100644
index 0000000..4c0e321
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast
@@ -0,0 +1,98 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
new file mode 100644
index 0000000..d9997c1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -0,0 +1,98 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
new file mode 100644
index 0000000..0e70327
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
@@ -0,0 +1,98 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
new file mode 100644
index 0000000..f788eb4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
@@ -0,0 +1,83 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
new file mode 100644
index 0000000..64bafa2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
@@ -0,0 +1,97 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
new file mode 100644
index 0000000..64bafa2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
@@ -0,0 +1,97 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..7dc305b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,107 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..14f8baf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,107 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..f36d189
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
new file mode 100644
index 0000000..de88875
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
@@ -0,0 +1,106 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast
new file mode 100644
index 0000000..680f1a4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast
@@ -0,0 +1,132 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast
new file mode 100644
index 0000000..c8c76ed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast
@@ -0,0 +1,132 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast
new file mode 100644
index 0000000..5c27747
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast
@@ -0,0 +1,117 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast
new file mode 100644
index 0000000..0aaba9d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast
@@ -0,0 +1,131 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast
new file mode 100644
index 0000000..af6a5c8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast
@@ -0,0 +1,113 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_ngram-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast
new file mode 100644
index 0000000..591fe75
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast
@@ -0,0 +1,108 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast
new file mode 100644
index 0000000..3ed252f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast
@@ -0,0 +1,108 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast
new file mode 100644
index 0000000..78220a7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast
@@ -0,0 +1,93 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast
new file mode 100644
index 0000000..7362c07
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast
@@ -0,0 +1,107 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..52b61c3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,102 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..3d5b7f1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,102 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..687c075
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast
new file mode 100644
index 0000000..9a289ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast
@@ -0,0 +1,101 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
new file mode 100644
index 0000000..6ea18ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -0,0 +1,139 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [t1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sim]
+ :
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+]
+LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=message-text
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.6]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [20]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast
new file mode 100644
index 0000000..b87f210
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast
@@ -0,0 +1,123 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast
new file mode 100644
index 0000000..0941add
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast
@@ -0,0 +1,123 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast
new file mode 100644
index 0000000..eee4066
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast
@@ -0,0 +1,108 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast
new file mode 100644
index 0000000..10e9f85
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast
@@ -0,0 +1,122 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast
new file mode 100644
index 0000000..67cbef2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast
@@ -0,0 +1,108 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join-noeqjoin_word-jaccard-inline.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [atitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [btitle]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast
new file mode 100644
index 0000000..e4bcddd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast
@@ -0,0 +1,103 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast
new file mode 100644
index 0000000..e3fd23c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast
@@ -0,0 +1,103 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast
new file mode 100644
index 0000000..1093868
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast
@@ -0,0 +1,88 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast
new file mode 100644
index 0000000..c5ffde4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast
@@ -0,0 +1,102 @@
+DataverseUse test
+TypeDecl DBLPTypetmp [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXTypetmp [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl DBLPType [
+ closed RecordType {
+ nested : DBLPTypetmp
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ nested : CSXTypetmp
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[nested, id]]
+DatasetDecl CSX(CSXType) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
new file mode 100644
index 0000000..dfb4308
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -0,0 +1,155 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
new file mode 100644
index 0000000..0b80a04
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -0,0 +1,178 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageNestedType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ nested : TweetMessageNestedType
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[nested, tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=nested
+ ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast
new file mode 100644
index 0000000..3698698
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordNested [
+ closed RecordType {
+ nested : MyRecord
+ }
+]
+DatasetDecl MyData1(MyRecordNested) partitioned by [[nested, id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index-join_rtree-spatial-intersect-point.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast
new file mode 100644
index 0000000..e270746
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordNested [
+ closed RecordType {
+ nested : MyRecord
+ }
+]
+DatasetDecl MyData1(MyRecordNested) partitioned by [[nested, id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast
new file mode 100644
index 0000000..2b58875
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordNested [
+ closed RecordType {
+ nested : MyRecord
+ }
+]
+DatasetDecl MyData(MyRecordNested) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast
new file mode 100644
index 0000000..f91769c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl MyRecordNestedOpen [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordOpen [
+ closed RecordType {
+ nested : MyRecordNestedOpen
+ }
+]
+DatasetDecl MyData1(MyRecordOpen) partitioned by [[nested, id]]
+DatasetDecl MyData2(MyRecordOpen) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast
new file mode 100644
index 0000000..f91769c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast
@@ -0,0 +1,64 @@
+DataverseUse test
+TypeDecl MyRecordNestedOpen [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordOpen [
+ closed RecordType {
+ nested : MyRecordNestedOpen
+ }
+]
+DatasetDecl MyData1(MyRecordOpen) partitioned by [[nested, id]]
+DatasetDecl MyData2(MyRecordOpen) partitioned by [[nested, id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=nested
+ ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast
new file mode 100644
index 0000000..7c06c85
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast
@@ -0,0 +1,132 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+DatasetDecl LineItems(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+WriteOutputTo nc1:/tmp/nested_loj.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [cust]
+ :
+ Variable [ Name=c ]
+ )
+ (
+ LiteralExpr [STRING] [orders]
+ :
+ Variable [ Name=orders ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=orders ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [order]
+ :
+ Variable [ Name=o ]
+ )
+ (
+ LiteralExpr [STRING] [items]
+ :
+ Variable [ Name=items ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+ ]
+ LetVariable [ Name=items ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=l ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ]
+ )
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ ]
+ )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast
new file mode 100644
index 0000000..926e14d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast
@@ -0,0 +1,192 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+DatasetDecl LineItems(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+DatasetDecl PartSupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+WriteOutputTo nc1:/tmp/nested_loj.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [cust]
+ :
+ Variable [ Name=c ]
+ )
+ (
+ LiteralExpr [STRING] [orders]
+ :
+ Variable [ Name=orders ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+LetVariable [ Name=orders ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [order]
+ :
+ Variable [ Name=o ]
+ )
+ (
+ LiteralExpr [STRING] [items]
+ :
+ Variable [ Name=items ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+ ]
+ LetVariable [ Name=items ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [item]
+ :
+ Variable [ Name=l ]
+ )
+ (
+ LiteralExpr [STRING] [part_supplier]
+ :
+ Variable [ Name=partsupp ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+ LetVariable [ Name=partsupp ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=ps ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [PartSupp]
+ ]
+ AS
+ Variable [ Name=ps ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_partkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_suppkey
+ ]
+ ]
+ ]
+ )
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ]
+ )
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ ]
+ )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast
new file mode 100644
index 0000000..4578539
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl TestType [
+ open RecordType {
+ id : string,
+ no-idx : string
+ }
+]
+DatasetDecl TestSet(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TestSet]
+ ]
+ AS
+ Variable [ Name=x ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=idx
+ ]
+ =
+ LiteralExpr [STRING] [one]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=idx
+ ]
+ =
+ LiteralExpr [STRING] [two]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
new file mode 100644
index 0000000..9533c68
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
@@ -0,0 +1,121 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
new file mode 100644
index 0000000..2beceaa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
@@ -0,0 +1,120 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
new file mode 100644
index 0000000..7318652
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
@@ -0,0 +1,135 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
new file mode 100644
index 0000000..616417b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
@@ -0,0 +1,134 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/btree-index-join_leftouterjoin-probe-pidx-with-join-btree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2info]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=countA
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=countB
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast
new file mode 100644
index 0000000..53c81c4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast
new file mode 100644
index 0000000..fe9fdcc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast
new file mode 100644
index 0000000..28f154b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast
new file mode 100644
index 0000000..c10a1ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast
new file mode 100644
index 0000000..f5a0c73
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast
new file mode 100644
index 0000000..36f07af
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast
new file mode 100644
index 0000000..6125bf0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast
new file mode 100644
index 0000000..dfee5dd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_05.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast
new file mode 100644
index 0000000..15b8be3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl Name [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl Names(Name) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_secondary-composite-key-prefix-prefix-join_06.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [emp1]
+ :
+ Variable [ Name=emp1 ]
+ )
+ (
+ LiteralExpr [STRING] [emp2]
+ :
+ Variable [ Name=emp2 ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Names]
+ ]
+ AS
+ Variable [ Name=emp2 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=fname
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=fname
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp1 ]
+ Field=lname
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=emp2 ]
+ Field=lname
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast
new file mode 100644
index 0000000..3e51567
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast
@@ -0,0 +1,116 @@
+DataverseUse test
+TypeDecl EmploymentType [
+ closed RecordType {
+ organization-name : string,
+ start-date : date,
+ end-date : date?
+ }
+]
+TypeDecl FacebookUserType [
+ closed RecordType {
+ id : int32,
+ id-copy : int32,
+ alias : string,
+ name : string,
+ user-since : datetime,
+ user-since-copy : datetime,
+ friend-ids : UnorderedList <int32>
+,
+ employment : OrderedList [EmploymentType]
+
+ }
+]
+TypeDecl FacebookMessageType [
+ open RecordType {
+ message-id : int32,
+ message-id-copy : int32,
+ author-id : int32,
+ in-response-to : int32?,
+ sender-location : point?,
+ message : string
+ }
+]
+DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[id]]
+DatasetDecl FacebookMessages(FacebookMessageType) partitioned by [[message-id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multiindex.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [fbu-ID]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [fbm-auth-ID]
+ :
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=author-id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [uname]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [message]
+ :
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=message
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookMessages]
+ ]
+ AS
+ Variable [ Name=message ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=message ]
+ Field=author-id-copy
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ >=
+ LiteralExpr [LONG] [11000]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=id
+ ]
+ <=
+ LiteralExpr [LONG] [12000]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast
new file mode 100644
index 0000000..6752e08
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join-multipred.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=misc
+ ]
+ >
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=misc
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast
new file mode 100644
index 0000000..3362470
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast
new file mode 100644
index 0000000..e27d9e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast
new file mode 100644
index 0000000..4d02d7a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast
new file mode 100644
index 0000000..6b634ef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast
@@ -0,0 +1,59 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast
new file mode 100644
index 0000000..6b634ef
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast
@@ -0,0 +1,59 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/btree-index-join_title-secondary-equi-join_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast
new file mode 100644
index 0000000..7dcd4ad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-31.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Roger]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast
new file mode 100644
index 0000000..b225f70
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-32.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Susan]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast
new file mode 100644
index 0000000..6a965d0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-33.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Isa]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast
new file mode 100644
index 0000000..4c1d734
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-34.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Vanpatten]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast
new file mode 100644
index 0000000..63d6979
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-35.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast
new file mode 100644
index 0000000..63ef2cc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-36.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast
new file mode 100644
index 0000000..95e84b5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-37.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast
new file mode 100644
index 0000000..4a6fa80
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-38.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Young Seok]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Kim]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast
new file mode 100644
index 0000000..3cf7f65
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-39.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ or
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Malaika]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast
new file mode 100644
index 0000000..1ca10d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-40.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Alex]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zach]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast
new file mode 100644
index 0000000..b6490b1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-41.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Zubi]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast
new file mode 100644
index 0000000..e3c929e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-42.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Allan]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast
new file mode 100644
index 0000000..5d1f248d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-43.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast
new file mode 100644
index 0000000..7d5f869
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-44.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast
new file mode 100644
index 0000000..0005394
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast
@@ -0,0 +1,56 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-45.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast
new file mode 100644
index 0000000..55d0226
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast
@@ -0,0 +1,56 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-46.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast
new file mode 100644
index 0000000..862fd86
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-47.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast
new file mode 100644
index 0000000..6f0be75
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-48.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ !=
+ LiteralExpr [STRING] [Michael]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ !=
+ LiteralExpr [STRING] [Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast
new file mode 100644
index 0000000..f8f11de
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast
@@ -0,0 +1,56 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-49.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast
new file mode 100644
index 0000000..f83b0ce
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast
@@ -0,0 +1,56 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-50.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast
new file mode 100644
index 0000000..533ceab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast
@@ -0,0 +1,56 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-51.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast
new file mode 100644
index 0000000..4e1882c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-52.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast
new file mode 100644
index 0000000..6589f96
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-53.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Sofia]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast
new file mode 100644
index 0000000..4df6b32
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-54.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Chen]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast
new file mode 100644
index 0000000..6b792e1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-55.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Julio]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast
new file mode 100644
index 0000000..acafd98
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-56.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Neil]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast
new file mode 100644
index 0000000..30c882a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-57.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast
new file mode 100644
index 0000000..c6e4b34
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast
@@ -0,0 +1,27 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-58.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Max]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast
new file mode 100644
index 0000000..277fb24
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast
@@ -0,0 +1,56 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-49.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast
new file mode 100644
index 0000000..6bef5dc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-62.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ =
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast
new file mode 100644
index 0000000..44b7ee8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-63.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <
+ LiteralExpr [STRING] [Julio]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ =
+ LiteralExpr [STRING] [Xu]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast
new file mode 100644
index 0000000..752ab96
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Mu]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast
new file mode 100644
index 0000000..f0bda95
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast
new file mode 100644
index 0000000..1bc655f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast
new file mode 100644
index 0000000..535abc4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast
new file mode 100644
index 0000000..14c8ca3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -0,0 +1,33 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast
new file mode 100644
index 0000000..19eb9bd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast
@@ -0,0 +1,33 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
+ <=
+ LiteralExpr [LONG] [1]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
new file mode 100644
index 0000000..5fc1e5f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -0,0 +1,32 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-edit-distance.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ ~=
+ LiteralExpr [STRING] [Amihay Motro]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..bd0b731
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast
new file mode 100644
index 0000000..a80c3b5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast
new file mode 100644
index 0000000..8ba09f2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast
new file mode 100644
index 0000000..02f6e76
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast
new file mode 100644
index 0000000..7f65b4a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-fuzzyeq-jaccard.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast
new file mode 100644
index 0000000..4e94166
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast
@@ -0,0 +1,48 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard-check.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast
new file mode 100644
index 0000000..31d56de
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
new file mode 100644
index 0000000..b4ae60d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
new file mode 100644
index 0000000..117c646
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=edb ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+LetVariable [ Name=eda ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=edb ]
+ Index: Variable [ Name=edb ]
+ ]
+ and
+ IndexAccessor [
+ Variable [ Name=eda ]
+ Index: Variable [ Name=eda ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
new file mode 100644
index 0000000..0dbfd47
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast
new file mode 100644
index 0000000..6e36688
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Amihay Motro]
+ LiteralExpr [LONG] [1]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast
new file mode 100644
index 0000000..326ecfa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -0,0 +1,65 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FunctionCall test.substring@3[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [0]
+ LiteralExpr [LONG] [8]
+ ]
+ LiteralExpr [STRING] [datbase]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
new file mode 100644
index 0000000..146b5fb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-edit-distance-check-word-tokens.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title]
+ :
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=word ]
+]
+Where
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ Variable [ Name=word ]
+ LiteralExpr [STRING] [Multmedia]
+ LiteralExpr [LONG] [1]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast
new file mode 100644
index 0000000..50c1eee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -0,0 +1,45 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..a021ee6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -0,0 +1,62 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.gram-tokens@3[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast
new file mode 100644
index 0000000..572a3b5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast
new file mode 100644
index 0000000..4e81a84
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-complex_word-jaccard-check-multi-let.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [Paper]
+ :
+ Variable [ Name=paper_tokens ]
+ )
+ (
+ LiteralExpr [STRING] [Query]
+ :
+ Variable [ Name=query_tokens ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=paper_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=query_tokens ]
+ :=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ Variable [ Name=paper_tokens ]
+ Variable [ Name=query_tokens ]
+ LiteralExpr [FLOAT] [0.8]
+ ]
+Where
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
new file mode 100644
index 0000000..7cb7620
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -0,0 +1,147 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_leftouterjoin-probe-pidx-with-join-edit-distance-check_idx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweet]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=message-text
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar-tweets]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [topics]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=message-text
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=message-text
+ ]
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=message-text
+ ]
+ LiteralExpr [LONG] [7]
+ ]
+ Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ >
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [240]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast
new file mode 100644
index 0000000..5f185e0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast
new file mode 100644
index 0000000..749ac15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast
@@ -0,0 +1,90 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast
new file mode 100644
index 0000000..f0f75b2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast
new file mode 100644
index 0000000..de0a51f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast
@@ -0,0 +1,89 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-contains-04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [title1]
+ :
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ )
+ (
+ LiteralExpr [STRING] [title2]
+ :
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=o2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=title
+ ]
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=title
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=o2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast
new file mode 100644
index 0000000..e2be001
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast
new file mode 100644
index 0000000..ee772de
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast
new file mode 100644
index 0000000..2625826
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast
new file mode 100644
index 0000000..c03fc57
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast
new file mode 100644
index 0000000..c03fc57
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast
new file mode 100644
index 0000000..4f9f6f5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast
@@ -0,0 +1,78 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance-check@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=ed ]
+ Index: Variable [ Name=ed ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast
new file mode 100644
index 0000000..1078ccd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance-contains.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ Index: FunctionCall test.edit-distance-contains@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ LiteralExpr [LONG] [3]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast
new file mode 100644
index 0000000..924c2ba
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast
new file mode 100644
index 0000000..e6b16a4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast
@@ -0,0 +1,77 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast
new file mode 100644
index 0000000..5cf795e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast
@@ -0,0 +1,67 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast
new file mode 100644
index 0000000..e29c169
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast
new file mode 100644
index 0000000..e29c169
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast
new file mode 100644
index 0000000..1ffecec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-edit-distance_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [ed]
+ :
+ Variable [ Name=ed ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
new file mode 100644
index 0000000..a67bb4f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
new file mode 100644
index 0000000..5228f37
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
new file mode 100644
index 0000000..9f1edbf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
@@ -0,0 +1,66 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_03.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
new file mode 100644
index 0000000..d105d66
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
new file mode 100644
index 0000000..d105d66
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-edit-distance_01.adm
+Set simfunction=edit-distance
+Set simthreshold=3
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=authors
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=authors
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..2d6fd8c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..f54a688
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_02.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..6afbdd9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,75 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_03.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
new file mode 100644
index 0000000..3e1f2d1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
@@ -0,0 +1,84 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ~=
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast
new file mode 100644
index 0000000..36048d7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast
@@ -0,0 +1,104 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast
new file mode 100644
index 0000000..6b235f1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast
@@ -0,0 +1,104 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast
new file mode 100644
index 0000000..da9f690
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast
@@ -0,0 +1,94 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast
new file mode 100644
index 0000000..3410831
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast
@@ -0,0 +1,103 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast
new file mode 100644
index 0000000..b17c189
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast
@@ -0,0 +1,87 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast
new file mode 100644
index 0000000..c9cae12
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast
new file mode 100644
index 0000000..da9c748
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast
@@ -0,0 +1,86 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast
new file mode 100644
index 0000000..6a20190
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast
@@ -0,0 +1,76 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast
new file mode 100644
index 0000000..86c04c2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast
new file mode 100644
index 0000000..95454f5
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast
@@ -0,0 +1,84 @@
+DataverseUse test
+Set import-private-functions=true
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_ngram-jaccard_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ FunctionCall test.gram-tokens@3[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [FALSE]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast
new file mode 100644
index 0000000..575738b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -0,0 +1,80 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast
new file mode 100644
index 0000000..bc2ab3e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast
@@ -0,0 +1,80 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_02.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast
new file mode 100644
index 0000000..6b18e22
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast
@@ -0,0 +1,70 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_03.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast
new file mode 100644
index 0000000..c352aed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-fuzzyeq-jaccard_01.adm
+Set simfunction=jaccard
+Set simthreshold=0.5f
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast
new file mode 100644
index 0000000..4d96b4c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -0,0 +1,113 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check-after-btree-access.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [t1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [t2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sim]
+ :
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+]
+LetVariable [ Name=sim ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=message-text
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=message-text
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.6]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [20]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast
new file mode 100644
index 0000000..9312f4f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast
@@ -0,0 +1,95 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast
new file mode 100644
index 0000000..c522135
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast
@@ -0,0 +1,95 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast
new file mode 100644
index 0000000..3b51a56
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast
@@ -0,0 +1,85 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast
new file mode 100644
index 0000000..ea0d477
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast
@@ -0,0 +1,94 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Index: FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast
new file mode 100644
index 0000000..8c9a4b7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast
@@ -0,0 +1,82 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard-check_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard-check@3[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+Where
+ OperatorExpr [
+ IndexAccessor [
+ Variable [ Name=jacc ]
+ Index: Variable [ Name=jacc ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast
new file mode 100644
index 0000000..d506e1bc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ closed RecordType {
+ id : int32,
+ csxid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast
new file mode 100644
index 0000000..4071847
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast
@@ -0,0 +1,81 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast
new file mode 100644
index 0000000..8ea189a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast
@@ -0,0 +1,71 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast
new file mode 100644
index 0000000..615ec68
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast
@@ -0,0 +1,80 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl CSXType [
+ open RecordType {
+ id : int32,
+ csxid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl CSX(CSXType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [CSX]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast
new file mode 100644
index 0000000..42f995e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast
@@ -0,0 +1,79 @@
+DataverseUse test
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-join_word-jaccard_04.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [arec]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [brec]
+ :
+ Variable [ Name=b ]
+ )
+ (
+ LiteralExpr [STRING] [jacc]
+ :
+ Variable [ Name=jacc ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=title
+ ]
+ ]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=id
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
new file mode 100644
index 0000000..b0f9288
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -0,0 +1,126 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
new file mode 100644
index 0000000..d37268a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -0,0 +1,140 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast
new file mode 100644
index 0000000..fc94123
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast
@@ -0,0 +1,65 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordOpen [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData1(MyRecordOpen) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index-join_rtree-spatial-intersect-point.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast
new file mode 100644
index 0000000..13a1358
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast
@@ -0,0 +1,65 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+TypeDecl MyRecordOpen [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecordOpen) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast
new file mode 100644
index 0000000..d890e8a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast
@@ -0,0 +1,52 @@
+DataverseUse test
+TypeDecl MyRecord [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast
new file mode 100644
index 0000000..038fc0a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+TypeDecl MyRecord [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast
new file mode 100644
index 0000000..038fc0a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+TypeDecl MyRecord [
+ open RecordType {
+ id : int32,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
new file mode 100644
index 0000000..e2d5014
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
@@ -0,0 +1,62 @@
+DataverseUse gby-using-orderby-desc
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:rttest/gby-using-orderby-desc.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ Variable [ Name=name ]
+ )
+ (
+ LiteralExpr [STRING] [age]
+ :
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [age]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Groupby
+ Variable [ Name=name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=name
+ ]
+ With
+ Variable [ Name=c ]
+
+Orderby
+ Variable [ Name=name ]
+ DESC
+ Variable [ Name=age ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
new file mode 100644
index 0000000..643a8b0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
@@ -0,0 +1,82 @@
+DataverseUse orders-aggreg
+TypeDecl OrderType [
+ closed RecordType {
+ oid : int32,
+ cid : int32,
+ orderstatus : string,
+ orderpriority : string,
+ clerk : string,
+ total : float
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[oid]]
+WriteOutputTo nc1:/tmp/orders-aggreg.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [cid]
+ :
+ Variable [ Name=cid ]
+ )
+ (
+ LiteralExpr [STRING] [ordpercust]
+ :
+ FunctionCall orders-aggreg.count@1[
+ Variable [ Name=o ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [totalcust]
+ :
+ FunctionCall orders-aggreg.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=total
+ ]
+ ]
+ FROM [ Variable [ Name=o ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [avgcust]
+ :
+ FunctionCall orders-aggreg.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=total
+ ]
+ ]
+ FROM [ Variable [ Name=o ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Groupby
+ Variable [ Name=cid ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=cid
+ ]
+ With
+ Variable [ Name=o ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast
new file mode 100644
index 0000000..ca0be74
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast
@@ -0,0 +1,71 @@
+DataverseUse index_search
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_orderstatus]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderstatus
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderstatus
+ ]
+ =
+ LiteralExpr [STRING] [P]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast
new file mode 100644
index 0000000..66d6a4b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast
@@ -0,0 +1,70 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ open RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search-conjunctive.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ >
+ LiteralExpr [DOUBLE] [150000.0]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast
new file mode 100644
index 0000000..860b0fd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast
@@ -0,0 +1,78 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ open RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search-conjunctive.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_totalprice]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ >
+ LiteralExpr [DOUBLE] [150000.0]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast
new file mode 100644
index 0000000..9e4beb4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast
@@ -0,0 +1,70 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search-conjunctive.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ >
+ LiteralExpr [DOUBLE] [150000.0]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast
new file mode 100644
index 0000000..136f1f8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast
@@ -0,0 +1,78 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search-conjunctive.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_totalprice]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ >
+ LiteralExpr [DOUBLE] [150000.0]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast
new file mode 100644
index 0000000..7eeb2b7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast
@@ -0,0 +1,52 @@
+DataverseUse index_search
+TypeDecl OrderType [
+ open RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast
new file mode 100644
index 0000000..31fe195
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast
@@ -0,0 +1,52 @@
+DataverseUse index_search
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/index_search.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ =
+ LiteralExpr [LONG] [40]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast
new file mode 100644
index 0000000..4217fa0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast
@@ -0,0 +1,52 @@
+DataverseUse prim_index_search
+TypeDecl OrderType [
+ open RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/prim_index_search.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ =
+ LiteralExpr [LONG] [34]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast
new file mode 100644
index 0000000..6574c68
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast
@@ -0,0 +1,52 @@
+DataverseUse prim_index_search
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/prim_index_search.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ =
+ LiteralExpr [LONG] [34]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast
new file mode 100644
index 0000000..2f71b8b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast
@@ -0,0 +1,81 @@
+DataverseUse pull-select-above-eq-join
+TypeDecl UserType [
+ open RecordType {
+ uid : int32,
+ name : string,
+ city : string,
+ lottery_numbers : UnorderedList <int32>
+
+ }
+]
+TypeDecl VisitorType [
+ open RecordType {
+ vid : int32,
+ name : string,
+ city : string,
+ lottery_numbers : UnorderedList <int32>
+
+ }
+]
+DatasetDecl Users(UserType) partitioned by [[uid]]
+DatasetDecl Visitors(VisitorType) partitioned by [[vid]]
+WriteOutputTo nc1:/tmp/pull-select-above-eq-join.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=uid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [vid]
+ :
+ FieldAccessor [
+ Variable [ Name=visitor ]
+ Field=vid
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Users]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Visitors]
+ ]
+ AS
+ Variable [ Name=visitor ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=visitor ]
+ Field=name
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=city
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=visitor ]
+ Field=city
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast
new file mode 100644
index 0000000..45841bd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast
@@ -0,0 +1,64 @@
+DataverseUse fuzzyjoin_080
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/fuzzyjoin_080.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [matches]
+ :
+ Variable [ Name=matches ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperDBLP ]
+]
+LetVariable [ Name=matches ]
+ :=
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=authors
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=authors
+ ]
+ ]
+ )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast
new file mode 100644
index 0000000..914f997
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast
@@ -0,0 +1,63 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+WriteOutputTo nc1:/tmp/push_limit.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [price]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [date]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ >
+ LiteralExpr [LONG] [100]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ASC
+
+Limit
+ LiteralExpr [LONG] [10]
+ Offset
+ LiteralExpr [LONG] [5]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
new file mode 100644
index 0000000..9ed8f0e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
@@ -0,0 +1,239 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+WriteOutputTo nc1:rttest/tpch_q1_pricing_summary_report_nt.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_returnflag]
+ :
+ Variable [ Name=l_returnflag ]
+ )
+ (
+ LiteralExpr [STRING] [l_linestatus]
+ :
+ Variable [ Name=l_linestatus ]
+ )
+ (
+ LiteralExpr [STRING] [sum_qty]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_quantity
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_base_price]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_disc_price]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_charge]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_tax
+ ]
+ ]
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ave_qty]
+ :
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_quantity
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ave_price]
+ :
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ave_disc]
+ :
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count_order]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=l ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_shipdate
+ ]
+ <=
+ LiteralExpr [STRING] [1998-09-02]
+ ]
+Groupby
+ Variable [ Name=l_returnflag ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_returnflag
+ ]
+ Variable [ Name=l_linestatus ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_linestatus
+ ]
+ With
+ Variable [ Name=l ]
+
+Orderby
+ Variable [ Name=l_returnflag ]
+ ASC
+ Variable [ Name=l_linestatus ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
new file mode 100644
index 0000000..81491c0
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
@@ -0,0 +1,209 @@
+DataverseUse q3_shipping_priority
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+DatasetDecl LineItems(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+WriteOutputTo nc1:/tmp/q3_shipping_priority.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_orderkey]
+ :
+ Variable [ Name=l_orderkey ]
+ )
+ (
+ LiteralExpr [STRING] [revenue]
+ :
+ Variable [ Name=revenue ]
+ )
+ (
+ LiteralExpr [STRING] [o_orderdate]
+ :
+ Variable [ Name=o_orderdate ]
+ )
+ (
+ LiteralExpr [STRING] [o_shippriority]
+ :
+ Variable [ Name=o_shippriority ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=l ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_mktsegment
+ ]
+ =
+ LiteralExpr [STRING] [BUILDING]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ ]
+ ]
+ and
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ <
+ LiteralExpr [STRING] [1995-03-15]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_shipdate
+ ]
+ >
+ LiteralExpr [STRING] [1995-03-15]
+ ]
+ ]
+ ]
+Groupby
+ Variable [ Name=l_orderkey ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ Variable [ Name=o_orderdate ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ Variable [ Name=o_shippriority ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_shippriority
+ ]
+ With
+ Variable [ Name=c ]
+ Variable [ Name=l ]
+ Variable [ Name=o ]
+
+LetVariable [ Name=revenue ]
+ :=
+ FunctionCall q3_shipping_priority.sum@1[
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+Orderby
+ Variable [ Name=revenue ]
+ DESC
+ Variable [ Name=o_orderdate ]
+ ASC
+
+Limit
+ LiteralExpr [LONG] [10]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
new file mode 100644
index 0000000..0e1f7ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
@@ -0,0 +1,433 @@
+DataverseUse q5_local_supplier
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl RegionType [
+ closed RecordType {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+ }
+]
+DatasetDecl LineItems(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customers(CustomerType) partitioned by [[c_custkey]]
+DatasetDecl Suppliers(SupplierType) partitioned by [[s_suppkey]]
+DatasetDecl Nations(NationType) partitioned by [[n_nationkey]]
+DatasetDecl Regions(RegionType) partitioned by [[r_regionkey]]
+WriteOutputTo nc1:/tmp/q5_local_supplier.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ Variable [ Name=n_name ]
+ )
+ (
+ LiteralExpr [STRING] [revenue]
+ :
+ Variable [ Name=revenue ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [s_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=s_nationkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=s1 ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [s_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=s1 ]
+ Field=s_nationkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItems]
+ ]
+ AS
+ Variable [ Name=l ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=n1 ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [s_suppkey]
+ :
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_suppkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [s_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_nationkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Suppliers]
+ ]
+ AS
+ Variable [ Name=s ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [n_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_nationkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Nations]
+ ]
+ AS
+ Variable [ Name=n ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Regions]
+ ]
+ AS
+ Variable [ Name=r ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_regionkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=r ]
+ Field=r_regionkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=r ]
+ Field=r_name
+ ]
+ =
+ LiteralExpr [STRING] [ASIA]
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=n1 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=n1 ]
+ Field=n_nationkey
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=s1 ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=s1 ]
+ Field=s_suppkey
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=l1 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ >=
+ LiteralExpr [STRING] [1994-01-01]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ <
+ LiteralExpr [STRING] [1995-01-01]
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=o1 ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=s_nationkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=o_custkey
+ ]
+ ]
+ ]
+Groupby
+ Variable [ Name=n_name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=o1 ]
+ Field=n_name
+ ]
+ With
+ Variable [ Name=o1 ]
+ Variable [ Name=c ]
+
+LetVariable [ Name=revenue ]
+ :=
+ FunctionCall q5_local_supplier.sum@1[
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ ]
+ ]
+ FROM [ Variable [ Name=o1 ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+Orderby
+ Variable [ Name=revenue ]
+ DESC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast
new file mode 100644
index 0000000..0e9337f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast
@@ -0,0 +1,442 @@
+DataverseUse q08_group_by
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl RegionType [
+ closed RecordType {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+DatasetDecl Supplier(SupplierType) partitioned by [[s_suppkey]]
+DatasetDecl Nation(NationType) partitioned by [[n_nationkey]]
+DatasetDecl Region(RegionType) partitioned by [[r_regionkey]]
+DatasetDecl Part(PartType) partitioned by [[p_partkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderdate]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrcop ]
+ Field=o_orderdate
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrcop ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrcop ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_suppkey]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrcop ]
+ Field=l_suppkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [s_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_nationkey
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Supplier]
+ ]
+ AS
+ Variable [ Name=s ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderdate]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrco ]
+ Field=o_orderdate
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrco ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrco ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_suppkey]
+ :
+ FieldAccessor [
+ Variable [ Name=lnrco ]
+ Field=l_suppkey
+ ]
+ )
+ ]
+ ]
+ FROM [ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderdate]
+ :
+ FieldAccessor [
+ Variable [ Name=nrco ]
+ Field=o_orderdate
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_partkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_partkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_suppkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_suppkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [o_orderdate]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderdate
+ ]
+ )
+ (
+ LiteralExpr [STRING] [o_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_orderkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [c_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customer]
+ ]
+ AS
+ Variable [ Name=c ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=n1 ]
+ Field=n_nationkey
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Nation]
+ ]
+ AS
+ Variable [ Name=n1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Region]
+ ]
+ AS
+ Variable [ Name=r1 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=n1 ]
+ Field=n_regionkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=r1 ]
+ Field=r_regionkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=r1 ]
+ Field=r_name
+ ]
+ =
+ LiteralExpr [STRING] [AMERICA]
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=nr ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=nr ]
+ Field=n_nationkey
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=nrc ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=nrc ]
+ Field=c_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=nrco ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=nrco ]
+ Field=o_orderkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=nrco ]
+ Field=o_orderdate
+ ]
+ >=
+ LiteralExpr [STRING] [1995-01-01]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=nrco ]
+ Field=o_orderdate
+ ]
+ <=
+ LiteralExpr [STRING] [1996-12-31]
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=lnrco ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Part]
+ ]
+ AS
+ Variable [ Name=p ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=p ]
+ Field=p_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=lnrco ]
+ Field=l_partkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=p ]
+ Field=p_type
+ ]
+ =
+ LiteralExpr [STRING] [ECONOMY ANODIZED STEEL]
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=lnrcop ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=lnrcop ]
+ Field=l_suppkey
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast
new file mode 100644
index 0000000..8f0e8b8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast
@@ -0,0 +1,412 @@
+DataverseUse q09_group_by
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : int32,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl RegionType [
+ closed RecordType {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+ }
+]
+TypeDecl PartType [
+ closed RecordType {
+ p_partkey : int32,
+ p_name : string,
+ p_mfgr : string,
+ p_brand : string,
+ p_type : string,
+ p_size : int32,
+ p_container : string,
+ p_retailprice : double,
+ p_comment : string
+ }
+]
+TypeDecl PartSuppType [
+ closed RecordType {
+ ps_partkey : int32,
+ ps_suppkey : int32,
+ ps_availqty : int32,
+ ps_supplycost : double,
+ ps_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Supplier(SupplierType) partitioned by [[s_suppkey]]
+DatasetDecl Region(RegionType) partitioned by [[r_regionkey]]
+DatasetDecl Nation(NationType) partitioned by [[n_nationkey]]
+DatasetDecl Part(PartType) partitioned by [[p_partkey]]
+DatasetDecl Partsupp(PartSuppType) partitioned by [[ps_partkey], [ps_suppkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_quantity]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=l_quantity
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=l_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ps_supplycost]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=ps_supplycost
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Part]
+ ]
+ AS
+ Variable [ Name=p ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_quantity]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_quantity
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_partkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_partkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=n_name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ps_supplycost]
+ :
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_supplycost
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Partsupp]
+ ]
+ AS
+ Variable [ Name=ps ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_suppkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_suppkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_extendedprice]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_extendedprice
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_discount]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_discount
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_quantity]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_quantity
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_partkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_partkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [l_orderkey]
+ :
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_orderkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=s1 ]
+ Field=n_name
+ ]
+ )
+ ]
+ ]
+ FROM [ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [s_suppkey]
+ :
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_suppkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_name
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Supplier]
+ ]
+ AS
+ Variable [ Name=s ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Nation]
+ ]
+ AS
+ Variable [ Name=n ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=s_nationkey
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=s1 ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=s1 ]
+ Field=s_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_suppkey
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=l1 ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_suppkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_suppkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ps ]
+ Field=ps_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=l_partkey
+ ]
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=l2 ]
+]
+Where
+ OperatorExpr [
+ FunctionCall q09_group_by.contains@2[
+ FieldAccessor [
+ Variable [ Name=p ]
+ Field=p_name
+ ]
+ LiteralExpr [STRING] [green]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=p ]
+ Field=p_partkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=l_partkey
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast
new file mode 100644
index 0000000..4c5e744
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast
@@ -0,0 +1,63 @@
+DataverseUse events
+TypeDecl AddressType [
+ closed RecordType {
+ street : string,
+ city : string,
+ zip : string,
+ latlong : point
+ }
+]
+TypeDecl UserType [
+ open RecordType {
+ name : string,
+ email : string,
+ interests : UnorderedList <string>
+,
+ address : AddressType,
+ member_of : UnorderedList < open RecordType {
+ sig_name : string,
+ chapter_name : string,
+ member_since : date
+ }
+>
+
+ }
+]
+DatasetDecl User(UserType) partitioned by [[name]]
+WriteOutputTo nc1:/tmp/q1.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ Variable [ Name=i ]
+ =
+ LiteralExpr [STRING] [movies]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
new file mode 100644
index 0000000..a7bc644
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
@@ -0,0 +1,145 @@
+DataverseUse events
+TypeDecl AddressType [
+ closed RecordType {
+ street : string,
+ city : string,
+ zip : string
+ }
+]
+TypeDecl EventType [
+ closed RecordType {
+ name : string,
+ location : AddressType?,
+ organizers : UnorderedList < open RecordType {
+ name : string,
+ role : string
+ }
+>
+,
+ sponsoring_sigs : OrderedList [ open RecordType {
+ sig_name : string,
+ chapter_name : string
+ }
+]
+,
+ interest_keywords : UnorderedList <string>
+,
+ price : double?,
+ start_time : datetime,
+ end_time : datetime
+ }
+]
+DatasetDecl Event(EventType) partitioned by [[name]]
+WriteOutputTo nc1:/tmp/q2.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [sig_name]
+ :
+ Variable [ Name=sig_name ]
+ )
+ (
+ LiteralExpr [STRING] [total_count]
+ :
+ Variable [ Name=sig_sponsorship_count ]
+ )
+ (
+ LiteralExpr [STRING] [chapter_breakdown]
+ :
+ Variable [ Name=by_chapter ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Event]
+ ]
+ AS
+ Variable [ Name=event ]
+,
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=sponsoring_sigs
+ ]
+ AS
+ Variable [ Name=sponsor ]
+]
+LetVariable [ Name=es ]
+ :=
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [event]
+ :
+ Variable [ Name=event ]
+ )
+ (
+ LiteralExpr [STRING] [sponsor]
+ :
+ Variable [ Name=sponsor ]
+ )
+ ]
+Groupby
+ Variable [ Name=sig_name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=sponsor ]
+ Field=sig_name
+ ]
+ With
+ Variable [ Name=es ]
+ Variable [ Name=sponsor ]
+ Variable [ Name=event ]
+
+LetVariable [ Name=sig_sponsorship_count ]
+ :=
+ FunctionCall events.count@1[
+ Variable [ Name=es ]
+ ]
+LetVariable [ Name=by_chapter ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [chapter_name]
+ :
+ Variable [ Name=chapter_name ]
+ )
+ (
+ LiteralExpr [STRING] [escount]
+ :
+ FunctionCall events.count@1[
+ Variable [ Name=e ]
+ ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=es ]
+ AS
+ Variable [ Name=e ]
+ ]
+ Groupby
+ Variable [ Name=chapter_name ]
+ :=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=e ]
+ Field=sponsor
+ ]
+ Field=chapter_name
+ ]
+ With
+ Variable [ Name=e ]
+ Variable [ Name=by_chapter ]
+ Variable [ Name=sig_sponsorship_count ]
+ Variable [ Name=es ]
+ Variable [ Name=sponsor ]
+ Variable [ Name=event ]
+
+ )
+Orderby
+ Variable [ Name=sig_sponsorship_count ]
+ DESC
+
+Limit
+ LiteralExpr [LONG] [5]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
new file mode 100644
index 0000000..416cf4e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
@@ -0,0 +1,186 @@
+Query:
+LetVariable [ Name=sample ]
+ :=
+ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [r]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ LiteralExpr [STRING] [1a2b]
+ )
+ (
+ LiteralExpr [STRING] [t]
+ :
+ FunctionCall null.datetime@1[
+ LiteralExpr [STRING] [2000-01-01T01:00:00]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [event]
+ :
+ LiteralExpr [STRING] [e1]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [r]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ LiteralExpr [STRING] [1a2b]
+ )
+ (
+ LiteralExpr [STRING] [t]
+ :
+ FunctionCall null.datetime@1[
+ LiteralExpr [STRING] [2000-01-01T01:01:00]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [event]
+ :
+ LiteralExpr [STRING] [e2]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [r]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ LiteralExpr [STRING] [3c4d]
+ )
+ (
+ LiteralExpr [STRING] [t]
+ :
+ FunctionCall null.datetime@1[
+ LiteralExpr [STRING] [2000-01-01T01:02:00]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [event]
+ :
+ LiteralExpr [STRING] [e1]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [r]
+ :
+ LiteralExpr [LONG] [4]
+ )
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ LiteralExpr [STRING] [3c4d]
+ )
+ (
+ LiteralExpr [STRING] [t]
+ :
+ FunctionCall null.datetime@1[
+ LiteralExpr [STRING] [2000-01-01T01:03:00]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [event]
+ :
+ LiteralExpr [STRING] [e3]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [r]
+ :
+ LiteralExpr [LONG] [5]
+ )
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ LiteralExpr [STRING] [1a2b]
+ )
+ (
+ LiteralExpr [STRING] [t]
+ :
+ FunctionCall null.datetime@1[
+ LiteralExpr [STRING] [2000-01-01T01:04:00]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [event]
+ :
+ LiteralExpr [STRING] [e1]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [r]
+ :
+ LiteralExpr [LONG] [6]
+ )
+ (
+ LiteralExpr [STRING] [uid]
+ :
+ LiteralExpr [STRING] [1a2b]
+ )
+ (
+ LiteralExpr [STRING] [t]
+ :
+ FunctionCall null.datetime@1[
+ LiteralExpr [STRING] [2000-01-01T01:05:00]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [event]
+ :
+ LiteralExpr [STRING] [e4]
+ )
+ ]
+ ]
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [u]
+ :
+ Variable [ Name=u ]
+ )
+ (
+ LiteralExpr [STRING] [recs]
+ :
+ (
+ SELECT ELEMENT [
+ Variable [ Name=srec ]
+ ]
+ FROM [ Variable [ Name=s ]
+ AS
+ Variable [ Name=srec ]
+ ]
+ )
+ )
+]
+]
+FROM [ Variable [ Name=sample ]
+ AS
+ Variable [ Name=s ]
+]
+Groupby
+ Variable [ Name=u ]
+ :=
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=uid
+ ]
+ With
+ Variable [ Name=s ]
+ Variable [ Name=sample ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
new file mode 100644
index 0000000..7f8f2d3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
@@ -0,0 +1,304 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : int32,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+FunctionDecl q22_customer_tmp([]) {
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [c_acctbal]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_acctbal
+ ]
+ )
+ (
+ LiteralExpr [STRING] [c_custkey]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_custkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [cntrycode]
+ :
+ Variable [ Name=phone_substr ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=Customer ]
+ AS
+ Variable [ Name=c ]
+ ]
+ LetVariable [ Name=phone_substr ]
+ :=
+ FunctionCall tpch.substring@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_phone
+ ]
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [13]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [31]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [23]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [29]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [30]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [18]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [17]
+ ]
+ ]
+ )
+}
+
+Query:
+LetVariable [ Name=avg ]
+ :=
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_acctbal
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customer]
+ ]
+ AS
+ Variable [ Name=c ]
+ ]
+ LetVariable [ Name=phone_substr ]
+ :=
+ FunctionCall tpch.substring@3[
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_phone
+ ]
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=c_acctbal
+ ]
+ >
+ LiteralExpr [DOUBLE] [0.0]
+ ]
+ and
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [13]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [31]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [23]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [29]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [30]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [18]
+ ]
+ or
+ OperatorExpr [
+ Variable [ Name=phone_substr ]
+ =
+ LiteralExpr [STRING] [17]
+ ]
+ ]
+ ]
+ )
+ ]
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [cntrycode]
+ :
+ Variable [ Name=cntrycode ]
+ )
+ (
+ LiteralExpr [STRING] [numcust]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=ct ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [totacctbal]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=c_acctbal
+ ]
+ ]
+ FROM [ Variable [ Name=ct ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+]
+]
+FROM [ FunctionCall tpch.q22_customer_tmp@0[
+ ]
+ AS
+ Variable [ Name=ct ]
+]
+Where
+ OperatorExpr [
+ FunctionCall tpch.count@1[
+ (
+ SELECT ELEMENT [
+ Variable [ Name=o ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=o ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ct ]
+ Field=c_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_custkey
+ ]
+ ]
+ )
+ ]
+ =
+ LiteralExpr [LONG] [0]
+ ]
+Groupby
+ Variable [ Name=cntrycode ]
+ :=
+ FieldAccessor [
+ Variable [ Name=ct ]
+ Field=cntrycode
+ ]
+ With
+ Variable [ Name=ct ]
+ Variable [ Name=avg ]
+
+Orderby
+ Variable [ Name=cntrycode ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
new file mode 100644
index 0000000..fef8a60
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
@@ -0,0 +1,55 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_linenumber]
+ :
+ Variable [ Name=l_linenumber ]
+ )
+ (
+ LiteralExpr [STRING] [count_order]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=l ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+]
+Groupby
+ Variable [ Name=l_linenumber ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_linenumber
+ ]
+ With
+ Variable [ Name=l ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
new file mode 100644
index 0000000..1409681
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl TestType [
+ closed RecordType {
+ key1 : int32,
+ value : int32
+ }
+]
+DatasetDecl test(TestType) partitioned by [[key1]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [gid]
+ :
+ Variable [ Name=aid ]
+ )
+ (
+ LiteralExpr [STRING] [avg]
+ :
+ FunctionCall test.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=j ]
+ Field=value
+ ]
+ ]
+ FROM [ Variable [ Name=i ]
+ AS
+ Variable [ Name=j ]
+ ]
+ Where
+ FunctionCall test.not@1[
+ FunctionCall test.is-null@1[
+ FieldAccessor [
+ Variable [ Name=j ]
+ Field=value
+ ]
+ ]
+ ]
+ )
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [test]
+ ]
+ AS
+ Variable [ Name=i ]
+]
+Groupby
+ Variable [ Name=aid ]
+ :=
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=key1
+ ]
+ With
+ Variable [ Name=i ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
new file mode 100644
index 0000000..5b5cb9a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
@@ -0,0 +1,272 @@
+DataverseUse tpch
+TypeDecl OrderType [
+ closed RecordType {
+ o_orderkey : int32,
+ o_custkey : int32,
+ o_orderstatus : string,
+ o_totalprice : double,
+ o_orderdate : string,
+ o_orderpriority : string,
+ o_clerk : string,
+ o_shippriority : int32,
+ o_comment : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ c_custkey : int32,
+ c_name : string,
+ c_address : string,
+ c_nationkey : int32,
+ c_phone : string,
+ c_acctbal : double,
+ c_mktsegment : string,
+ c_comment : string
+ }
+]
+TypeDecl SupplierType [
+ closed RecordType {
+ s_suppkey : int32,
+ s_name : string,
+ s_address : string,
+ s_nationkey : int32,
+ s_phone : string,
+ s_acctbal : double,
+ s_comment : string
+ }
+]
+TypeDecl NationType [
+ closed RecordType {
+ n_nationkey : int32,
+ n_name : string,
+ n_regionkey : int32,
+ n_comment : string
+ }
+]
+TypeDecl RegionType [
+ closed RecordType {
+ r_regionkey : int32,
+ r_name : string,
+ r_comment : string
+ }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Supplier(SupplierType) partitioned by [[s_suppkey]]
+DatasetDecl Region(RegionType) partitioned by [[r_regionkey]]
+DatasetDecl Nation(NationType) partitioned by [[n_nationkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+DatasetDecl SelectedNation(NationType) partitioned by [[n_nationkey]]
+Query:
+LetVariable [ Name=t ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n_nationkey]
+ :
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_nationkey
+ ]
+ )
+ (
+ LiteralExpr [STRING] [n_name]
+ :
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_name
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Nation]
+ ]
+ AS
+ Variable [ Name=nation ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [SelectedNation]
+ ]
+ AS
+ Variable [ Name=sn ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=nation ]
+ Field=n_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=sn ]
+ Field=n_nationkey
+ ]
+ ]
+ )
+LetVariable [ Name=X ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [nation_key]
+ :
+ Variable [ Name=nation_key ]
+ )
+ (
+ LiteralExpr [STRING] [order_date]
+ :
+ Variable [ Name=orderdate ]
+ )
+ (
+ LiteralExpr [STRING] [sum_price]
+ :
+ Variable [ Name=sum ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=t ]
+ AS
+ Variable [ Name=n ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customer]
+ ]
+ AS
+ Variable [ Name=customer ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Orders]
+ ]
+ AS
+ Variable [ Name=orders ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=orders ]
+ Field=o_custkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=customer ]
+ Field=c_custkey
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=customer ]
+ Field=c_nationkey
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_nationkey
+ ]
+ ]
+ ]
+ Groupby
+ Variable [ Name=orderdate ]
+ :=
+ FieldAccessor [
+ Variable [ Name=orders ]
+ Field=o_orderdate
+ ]
+ Variable [ Name=nation_key ]
+ :=
+ FieldAccessor [
+ Variable [ Name=n ]
+ Field=n_nationkey
+ ]
+ With
+ Variable [ Name=orders ]
+ Variable [ Name=n ]
+ Variable [ Name=customer ]
+ Variable [ Name=X ]
+ Variable [ Name=t ]
+
+ LetVariable [ Name=sum ]
+ :=
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=o_totalprice
+ ]
+ ]
+ FROM [ Variable [ Name=orders ]
+ AS
+ Variable [ Name=o ]
+ ]
+ )
+ ]
+ )
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [nation_key]
+ :
+ Variable [ Name=nation_key ]
+ )
+ (
+ LiteralExpr [STRING] [sum_price]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [orderdate]
+ :
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=order_date
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_price]
+ :
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=sum_price
+ ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=x ]
+ AS
+ Variable [ Name=y ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=y ]
+ Field=sum_price
+ ]
+ DESC
+
+ Limit
+ LiteralExpr [LONG] [3]
+ )
+ )
+]
+]
+FROM [ Variable [ Name=X ]
+ AS
+ Variable [ Name=x ]
+]
+Groupby
+ Variable [ Name=nation_key ]
+ :=
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=nation_key
+ ]
+ With
+ Variable [ Name=x ]
+ Variable [ Name=X ]
+ Variable [ Name=t ]
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
new file mode 100644
index 0000000..1726c87
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
@@ -0,0 +1,204 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_returnflag]
+ :
+ Variable [ Name=l_returnflag ]
+ )
+ (
+ LiteralExpr [STRING] [l_linestatus]
+ :
+ Variable [ Name=l_linestatus ]
+ )
+ (
+ LiteralExpr [STRING] [count_cheaps]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=cheaps ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [avg_expensive_discounts]
+ :
+ FunctionCall tpch.avg@1[
+ Variable [ Name=expensives ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_disc_prices]
+ :
+ FunctionCall tpch.sum@1[
+ Variable [ Name=disc_prices ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [total_charges]
+ :
+ FunctionCall tpch.sum@1[
+ Variable [ Name=charges ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_shipdate
+ ]
+ <=
+ LiteralExpr [STRING] [1998-09-02]
+ ]
+Groupby
+ Variable [ Name=l_returnflag ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_returnflag
+ ]
+ Variable [ Name=l_linestatus ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_linestatus
+ ]
+ With
+ Variable [ Name=l ]
+
+LetVariable [ Name=expensives ]
+ :=
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ <=
+ LiteralExpr [DOUBLE] [0.05]
+ ]
+ )
+LetVariable [ Name=cheaps ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ >
+ LiteralExpr [DOUBLE] [0.05]
+ ]
+ )
+LetVariable [ Name=charges ]
+ :=
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_tax
+ ]
+ ]
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+LetVariable [ Name=disc_prices ]
+ :=
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+Orderby
+ Variable [ Name=l_returnflag ]
+ ASC
+ Variable [ Name=l_linestatus ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
new file mode 100644
index 0000000..3be4f1c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
@@ -0,0 +1,128 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [l_returnflag]
+ :
+ Variable [ Name=l_returnflag ]
+ )
+ (
+ LiteralExpr [STRING] [l_linestatus]
+ :
+ Variable [ Name=l_linestatus ]
+ )
+ (
+ LiteralExpr [STRING] [count_cheaps]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=cheap ]
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count_expensives]
+ :
+ FunctionCall tpch.count@1[
+ Variable [ Name=expensive ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_shipdate
+ ]
+ <=
+ LiteralExpr [STRING] [1998-09-02]
+ ]
+Groupby
+ Variable [ Name=l_returnflag ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_returnflag
+ ]
+ Variable [ Name=l_linestatus ]
+ :=
+ FieldAccessor [
+ Variable [ Name=l ]
+ Field=l_linestatus
+ ]
+ With
+ Variable [ Name=l ]
+
+LetVariable [ Name=cheap ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=m ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=m ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=m ]
+ Field=l_discount
+ ]
+ >
+ LiteralExpr [DOUBLE] [0.05]
+ ]
+ )
+LetVariable [ Name=expensive ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=a ]
+ ]
+ FROM [ Variable [ Name=l ]
+ AS
+ Variable [ Name=a ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=l_discount
+ ]
+ <=
+ LiteralExpr [DOUBLE] [0.05]
+ ]
+ )
+Orderby
+ Variable [ Name=l_returnflag ]
+ ASC
+ Variable [ Name=l_linestatus ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
new file mode 100644
index 0000000..56a8784
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
@@ -0,0 +1,231 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [sum_qty_partial]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_quantity
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_shipdate
+ ]
+ <=
+ LiteralExpr [STRING] [1998-09-02]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_base_price]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_disc_price]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [sum_charge]
+ :
+ FunctionCall tpch.sum@1[
+ (
+ SELECT ELEMENT [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ -
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ *
+ OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_tax
+ ]
+ ]
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ave_qty]
+ :
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_quantity
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_shipdate
+ ]
+ <=
+ LiteralExpr [STRING] [1998-09-02]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ave_price]
+ :
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_extendedprice
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [ave_disc]
+ :
+ FunctionCall tpch.avg@1[
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=l_discount
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=i ]
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [count_order]
+ :
+ FunctionCall tpch.count@1[
+ (
+ SELECT ELEMENT [
+ Variable [ Name=l ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [LineItem]
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+ )
+ ]
+ )
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
new file mode 100644
index 0000000..7a7b3f2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+TypeDecl sType [
+ closed RecordType {
+ b : int32
+ }
+]
+DatasetDecl s(sType) partitioned by [[b]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [x]
+ :
+ Variable [ Name=x ]
+ )
+ (
+ LiteralExpr [STRING] [y]
+ :
+ Variable [ Name=y ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [s]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=z ]
+ Field=c
+ ]
+ ]
+ FROM [ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [c]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [c]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [c]
+ :
+ LiteralExpr [NULL]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=z ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=b
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=z ]
+ Field=a
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=y ]
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
new file mode 100644
index 0000000..98b006e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
@@ -0,0 +1,70 @@
+DataverseUse test
+TypeDecl sType [
+ closed RecordType {
+ b : int32
+ }
+]
+DatasetDecl s(sType) partitioned by [[b]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [x]
+ :
+ Variable [ Name=x ]
+ )
+ (
+ LiteralExpr [STRING] [y]
+ :
+ Variable [ Name=y ]
+ )
+]
+]
+FROM [ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=z ]
+ Field=b
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [s]
+ ]
+ AS
+ Variable [ Name=z ]
+ ]
+ Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=x ]
+ Field=a
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=z ]
+ Field=b
+ ]
+ ]
+ )
+ AS
+ Variable [ Name=y ]
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
new file mode 100644
index 0000000..576eeb7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+ open RecordType {
+ screen-name : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+ }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TwitterUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=friends_count
+ ]
+ DESC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
new file mode 100644
index 0000000..ec49be3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+ open RecordType {
+ screen-name : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+ }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TwitterUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=friends_count
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
new file mode 100644
index 0000000..aefabe9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+ open RecordType {
+ screen-name : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+ }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TwitterUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=screen-name
+ ]
+ DESC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
new file mode 100644
index 0000000..28b636d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+ open RecordType {
+ screen-name : string,
+ lang : string,
+ friends_count : int64,
+ statuses_count : int64,
+ name : string,
+ followers_count : int64
+ }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TwitterUsers]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=screen-name
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast
new file mode 100644
index 0000000..013ea15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+WriteOutputTo nc1:/tmp/rec_access.adm
+Query:
+FieldAccessor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ ]
+ Field=a
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
new file mode 100644
index 0000000..e98418d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
@@ -0,0 +1,102 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ open RecordType {
+ screen_name : string,
+ lang : string,
+ friends_count : int32,
+ statuses_count : int32,
+ name : string,
+ followers_count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ open RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender_location : point?,
+ send_time : datetime,
+ referred_topics : UnorderedList <string>
+,
+ message_text : string
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_issue730.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [message]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender_location
+ ]
+ Variable [ Name=n ]
+ ]
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender_location
+ ]
+ LiteralExpr [DOUBLE] [5.0]
+ ]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=send_time
+ ]
+ >=
+ FunctionCall test.datetime@1[
+ LiteralExpr [STRING] [2011-06-18T14:10:17]
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=send_time
+ ]
+ <
+ FunctionCall test.datetime@1[
+ LiteralExpr [STRING] [2011-06-18T15:10:17]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
new file mode 100644
index 0000000..1c45852
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -0,0 +1,127 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
new file mode 100644
index 0000000..628cc16
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -0,0 +1,141 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+ closed RecordType {
+ screen-name : string,
+ lang : string,
+ friends-count : int32,
+ statuses-count : int32,
+ name : string,
+ followers-count : int32
+ }
+]
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ user : TwitterUserType,
+ sender-location : point,
+ send-time : datetime,
+ referred-topics : UnorderedList <string>
+,
+ message-text : string,
+ countA : int32,
+ countB : int32
+ }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc1]
+ :
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ )
+ (
+ LiteralExpr [STRING] [nearby-message]
+ :
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [tweetid2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ )
+ (
+ LiteralExpr [STRING] [loc2]
+ :
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t2 ]
+ ]
+ Where
+ OperatorExpr [
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=sender-location
+ ]
+ Variable [ Name=n ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ !=
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=t2 ]
+ Field=tweetid
+ ]
+ ASC
+
+ )
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+ :=
+ FunctionCall test.create-circle@2[
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=sender-location
+ ]
+ LiteralExpr [DOUBLE] [0.5]
+ ]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ <
+ FunctionCall test.int64@1[
+ LiteralExpr [STRING] [10]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=t1 ]
+ Field=tweetid
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
new file mode 100644
index 0000000..de3f414
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
@@ -0,0 +1,88 @@
+DataverseUse twitter
+TypeDecl TweetMessageType [
+ closed RecordType {
+ tweetid : int64,
+ sender-location : point,
+ text : string
+ }
+]
+TypeDecl TweetHistorySubscription [
+ open RecordType {
+ subscription-id : int32,
+ location : point
+ }
+]
+DatasetDecl TweetHistorySubscriptions(TweetHistorySubscription) partitioned by [[subscription-id]]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/query-issue838.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [subscription-id]
+ :
+ FieldAccessor [
+ Variable [ Name=sub ]
+ Field=subscription-id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [changeSet]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [execution-time]
+ :
+ FunctionCall twitter.current-datetime@0[
+ ]
+ )
+ (
+ LiteralExpr [STRING] [message-text]
+ :
+ Variable [ Name=text ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetHistorySubscriptions]
+ ]
+ AS
+ Variable [ Name=sub ]
+,
+ (
+ SELECT ELEMENT [
+ Variable [ Name=tweet ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TweetMessages]
+ ]
+ AS
+ Variable [ Name=tweet ]
+ ]
+ LetVariable [ Name=circle ]
+ :=
+ FunctionCall twitter.create-circle@2[
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [location]
+ ]
+ LiteralExpr [DOUBLE] [30.0]
+ ]
+ Where
+ FunctionCall twitter.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=tweet ]
+ Field=sender-location
+ ]
+ Variable [ Name=circle ]
+ ]
+ )
+ AS
+ Variable [ Name=text ]
+]
+LetVariable [ Name=location ]
+ :=
+ FieldAccessor [
+ Variable [ Name=sub ]
+ Field=location
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
new file mode 100644
index 0000000..f0bf3f7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index-join_rtree-spatial-intersect-point.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
new file mode 100644
index 0000000..f6c641f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData1]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData2]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
new file mode 100644
index 0000000..4494871
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [a]
+ :
+ Variable [ Name=a ]
+ )
+ (
+ LiteralExpr [STRING] [b]
+ :
+ Variable [ Name=b ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=a ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=b ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=a ]
+ Field=point
+ ]
+ FieldAccessor [
+ Variable [ Name=b ]
+ Field=point
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
new file mode 100644
index 0000000..644a3b8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+ open RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index_rtree-secondary-index-open.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=point
+ ]
+ FunctionCall test.create-polygon@1[
+ OrderedListConstructor [
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [1.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [12.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [12.0]
+ LiteralExpr [DOUBLE] [1.0]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
new file mode 100644
index 0000000..a283d04
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index_rtree-secondary-index.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=point
+ ]
+ FunctionCall test.create-polygon@1[
+ OrderedListConstructor [
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [1.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [12.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [12.0]
+ LiteralExpr [DOUBLE] [1.0]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl LineIDType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+ }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast
new file mode 100644
index 0000000..ab52c9a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast
@@ -0,0 +1,15 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl LineIDType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+ }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl LineIDType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+ }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32,
+ l_linenumber : int32,
+ l_quantity : double,
+ l_extendedprice : double,
+ l_discount : double,
+ l_tax : double,
+ l_returnflag : string,
+ l_linestatus : string,
+ l_shipdate : string,
+ l_commitdate : string,
+ l_receiptdate : string,
+ l_shipinstruct : string,
+ l_shipmode : string,
+ l_comment : string
+ }
+]
+TypeDecl LineIDType [
+ closed RecordType {
+ l_orderkey : int32,
+ l_partkey : int32,
+ l_suppkey : int32
+ }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
new file mode 100644
index 0000000..9e0d9ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
new file mode 100644
index 0000000..9e04619
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ >=
+ Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
new file mode 100644
index 0000000..8a045ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=ed ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
new file mode 100644
index 0000000..c79c629
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [3]
+ >
+ Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
new file mode 100644
index 0000000..080a508
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_05.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=ed ]
+ >=
+ LiteralExpr [LONG] [2]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
new file mode 100644
index 0000000..9dfd7fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_06.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ <=
+ Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
new file mode 100644
index 0000000..3595d15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_07.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=ed ]
+ >
+ LiteralExpr [LONG] [2]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
new file mode 100644
index 0000000..eb03e16
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_08.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+ :=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ <
+ Variable [ Name=ed ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
new file mode 100644
index 0000000..8b4917e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ <=
+ LiteralExpr [LONG] [2]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
new file mode 100644
index 0000000..0217bad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ >=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
new file mode 100644
index 0000000..fe8097c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ <
+ LiteralExpr [LONG] [3]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
new file mode 100644
index 0000000..684dc9c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [3]
+ >
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
new file mode 100644
index 0000000..5fc23b4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_05.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ >=
+ LiteralExpr [LONG] [2]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
new file mode 100644
index 0000000..9afcb14
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_06.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ <=
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
new file mode 100644
index 0000000..92b6dfd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_07.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ >
+ LiteralExpr [LONG] [2]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast
new file mode 100644
index 0000000..78fa7c4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_08.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ <
+ FunctionCall test.edit-distance@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast
new file mode 100644
index 0000000..feeb848
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast
@@ -0,0 +1,33 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_fuzzyeq-to-edit-distance-check.adm
+Set simfunction=edit-distance
+Set simthreshold=1
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=authors
+ ]
+ ~=
+ LiteralExpr [STRING] [Michael J. Carey]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast
new file mode 100644
index 0000000..0d3fdb9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_fuzzyeq-to-jaccard-check.adm
+Set simfunction=jaccard
+Set simthreshold=0.8f
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ ~=
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast
new file mode 100644
index 0000000..5b6462f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast
new file mode 100644
index 0000000..dc65be9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ <=
+ Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast
new file mode 100644
index 0000000..9927d71
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast
new file mode 100644
index 0000000..914a2ff
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ <
+ Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast
new file mode 100644
index 0000000..78782ed
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ <=
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast
new file mode 100644
index 0000000..212d775
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ >=
+ Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast
new file mode 100644
index 0000000..e468bc3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ <
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast
new file mode 100644
index 0000000..430cfb6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=jacc ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ >
+ Variable [ Name=jacc ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast
new file mode 100644
index 0000000..7ef3998
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ >=
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast
new file mode 100644
index 0000000..516bdc1
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ <=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast
new file mode 100644
index 0000000..cab8170
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ >
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast
new file mode 100644
index 0000000..175601a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_03.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ <
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast
new file mode 100644
index 0000000..e9917ee
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_05.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ <=
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast
new file mode 100644
index 0000000..8be01dc
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_06.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ >=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast
new file mode 100644
index 0000000..27bd68c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_07.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ <
+ LiteralExpr [FLOAT] [0.8]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast
new file mode 100644
index 0000000..155a8dd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast
@@ -0,0 +1,38 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_jaccard-to-jaccard-check_08.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=paper ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+]
+Where
+ OperatorExpr [
+ LiteralExpr [FLOAT] [0.8]
+ >
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index-search-in-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index-search-in-delete.ast
new file mode 100644
index 0000000..e473596
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index-search-in-delete.ast
@@ -0,0 +1,25 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast
new file mode 100644
index 0000000..256f105
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast
@@ -0,0 +1,57 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-primary-16.adm
+TypeDecl TestType [
+ open RecordType {
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Craig]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ >=
+ LiteralExpr [STRING] [Kevin]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Mary]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=lname
+ ]
+ <=
+ LiteralExpr [STRING] [Tomes]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index-search-in-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index-search-in-delete.ast
new file mode 100644
index 0000000..ac9fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index-search-in-delete.ast
@@ -0,0 +1,11 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast
new file mode 100644
index 0000000..ee9ee67
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_ngram-contains.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.contains@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ LiteralExpr [STRING] [Multimedia]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-index-search-in-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-index-search-in-delete.ast
new file mode 100644
index 0000000..ab52c9a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-index-search-in-delete.ast
@@ -0,0 +1,15 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast
new file mode 100644
index 0000000..a283d04
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+ closed RecordType {
+ id : int32,
+ point : point,
+ kwds : string,
+ line1 : line,
+ line2 : line,
+ poly1 : polygon,
+ poly2 : polygon,
+ rec : rectangle,
+ circle : circle
+ }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index_rtree-secondary-index.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=id
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [MyData]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+Where
+ FunctionCall test.spatial-intersect@2[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=point
+ ]
+ FunctionCall test.create-polygon@1[
+ OrderedListConstructor [
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [1.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [12.0]
+ LiteralExpr [DOUBLE] [4.0]
+ LiteralExpr [DOUBLE] [12.0]
+ LiteralExpr [DOUBLE] [1.0]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast
new file mode 100644
index 0000000..55c75c6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-57.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-search-in-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-search-in-delete.ast
new file mode 100644
index 0000000..ecf76bf
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-search-in-delete.ast
@@ -0,0 +1,25 @@
+DataverseUse test
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32,
+ address : AddressType?,
+ interests : UnorderedList <string>
+,
+ children : OrderedList [ open RecordType {
+ name : string,
+ age : int32?
+ }
+]
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast
new file mode 100644
index 0000000..55c75c6
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast
@@ -0,0 +1,40 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/btree-index_btree-secondary-57.adm
+TypeDecl TestType [
+ open RecordType {
+ id : int32,
+ fname : string,
+ lname : string
+ }
+]
+DatasetDecl testdst(TestType) partitioned by [[id]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=emp ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [testdst]
+ ]
+ AS
+ Variable [ Name=emp ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ >=
+ LiteralExpr [STRING] [Max]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=emp ]
+ Field=fname
+ ]
+ <=
+ LiteralExpr [STRING] [Roger]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index-search-in-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index-search-in-delete.ast
new file mode 100644
index 0000000..ac9fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index-search-in-delete.ast
@@ -0,0 +1,11 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast
new file mode 100644
index 0000000..af1190f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast
@@ -0,0 +1,41 @@
+DataverseUse test
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/inverted-index-basic_word-jaccard.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=o ]
+]
+LetVariable [ Name=jacc ]
+ :=
+ FunctionCall test.similarity-jaccard@2[
+ FunctionCall test.word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=o ]
+ Field=title
+ ]
+ ]
+ FunctionCall test.word-tokens@1[
+ LiteralExpr [STRING] [Transactions for Cooperative Environments]
+ ]
+ ]
+Where
+ OperatorExpr [
+ Variable [ Name=jacc ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast
new file mode 100644
index 0000000..140b880
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast
@@ -0,0 +1,59 @@
+DataverseUse custlimit
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
+WriteOutputTo nc1:/tmp/custlimit.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [custname]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [custage]
+ :
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=age
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Customers]
+ ]
+ AS
+ Variable [ Name=c ]
+]
+Orderby
+ FieldAccessor [
+ Variable [ Name=c ]
+ Field=age
+ ]
+ ASC
+
+Limit
+ LiteralExpr [LONG] [10]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
new file mode 100644
index 0000000..1369a6b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
@@ -0,0 +1,392 @@
+DataverseUse fuzzyjoin
+TypeDecl DBLPType [
+ open RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+Set import-private-functions=true
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [left]
+ :
+ Variable [ Name=paperLeft ]
+ )
+ (
+ LiteralExpr [STRING] [right]
+ :
+ Variable [ Name=paperRight ]
+ )
+ (
+ LiteralExpr [STRING] [sim]
+ :
+ FieldAccessor [
+ Variable [ Name=ridpair ]
+ Field=sim
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperLeft ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperRight ]
+,
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [idLeft]
+ :
+ Variable [ Name=idLeft ]
+ )
+ (
+ LiteralExpr [STRING] [idRight]
+ :
+ Variable [ Name=idRight ]
+ )
+ (
+ LiteralExpr [STRING] [sim]
+ :
+ IndexAccessor [
+ Variable [ Name=sim ]
+ Index: Variable [ Name=sim ]
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperLeft ]
+,
+ FunctionCall fuzzyjoin.subset-collection@3[
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tokensLeft]
+ ]
+ LiteralExpr [LONG] [0]
+ FunctionCall fuzzyjoin.prefix-len-jaccard@2[
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [lenLeft]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ AS
+ Variable [ Name=prefixTokenLeft ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperRight ]
+,
+ FunctionCall fuzzyjoin.subset-collection@3[
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tokensRight]
+ ]
+ LiteralExpr [LONG] [0]
+ FunctionCall fuzzyjoin.prefix-len-jaccard@2[
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [lenRight]
+ ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ ]
+ AS
+ Variable [ Name=prefixTokenRight ]
+ ]
+ LetVariable [ Name=lenLeft ]
+ :=
+ FunctionCall fuzzyjoin.len@1[
+ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperLeft ]
+ Field=title
+ ]
+ ]
+ ]
+ LetVariable [ Name=tokensLeft ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperLeft ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=tokenUnranked ]
+,
+ (
+ SELECT ELEMENT [
+ Variable [ Name=tokenGroupped ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=token ]
+ ]
+ Groupby
+ Variable [ Name=tokenGroupped ]
+ :=
+ Variable [ Name=token ]
+ With
+ Variable [ Name=paper ]
+ Variable [ Name=token ]
+ Variable [ Name=tokenUnranked ]
+ Variable [ Name=tokensLeft ]
+ Variable [ Name=lenLeft ]
+ Variable [ Name=paperLeft ]
+ Variable [ Name=paperRight ]
+ Variable [ Name=prefixTokenRight ]
+ Variable [ Name=prefixTokenLeft ]
+ Variable [ Name=paperLeft ]
+ Variable [ Name=paperRight ]
+
+ Orderby
+ FunctionCall fuzzyjoin.count@1[
+ Variable [ Name=paper ]
+ ]
+ ASC
+ Variable [ Name=tokenGroupped ]
+ ASC
+
+ )
+ AS
+ Variable [ Name=tokenRanked ]
+ AT
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=tokenUnranked ]
+ =
+ Variable [ Name=tokenRanked ]
+ ]
+ Orderby
+ Variable [ Name=i ]
+ ASC
+
+ )
+ LetVariable [ Name=lenRight ]
+ :=
+ FunctionCall fuzzyjoin.len@1[
+ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperRight ]
+ Field=title
+ ]
+ ]
+ ]
+ LetVariable [ Name=tokensRight ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=i ]
+ ]
+ FROM [ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperRight ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=tokenUnranked ]
+,
+ (
+ SELECT ELEMENT [
+ Variable [ Name=tokenGroupped ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paper ]
+,
+ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paper ]
+ Field=title
+ ]
+ ]
+ AS
+ Variable [ Name=token ]
+ ]
+ Groupby
+ Variable [ Name=tokenGroupped ]
+ :=
+ Variable [ Name=token ]
+ With
+ Variable [ Name=paper ]
+ Variable [ Name=token ]
+ Variable [ Name=tokenUnranked ]
+ Variable [ Name=tokensRight ]
+ Variable [ Name=lenRight ]
+ Variable [ Name=tokensLeft ]
+ Variable [ Name=lenLeft ]
+ Variable [ Name=paperLeft ]
+ Variable [ Name=paperRight ]
+ Variable [ Name=prefixTokenRight ]
+ Variable [ Name=prefixTokenLeft ]
+ Variable [ Name=paperLeft ]
+ Variable [ Name=paperRight ]
+
+ Orderby
+ FunctionCall fuzzyjoin.count@1[
+ Variable [ Name=paper ]
+ ]
+ ASC
+ Variable [ Name=tokenGroupped ]
+ ASC
+
+ )
+ AS
+ Variable [ Name=tokenRanked ]
+ AT
+ Variable [ Name=i ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=tokenUnranked ]
+ =
+ Variable [ Name=tokenRanked ]
+ ]
+ Orderby
+ Variable [ Name=i ]
+ ASC
+
+ )
+ LetVariable [ Name=sim ]
+ :=
+ FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
+ Variable [ Name=lenLeft ]
+ Variable [ Name=tokensLeft ]
+ Variable [ Name=lenRight ]
+ Variable [ Name=tokensRight ]
+ Variable [ Name=prefixTokenLeft ]
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=prefixTokenLeft ]
+ =
+ Variable [ Name=prefixTokenRight ]
+ ]
+ and
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=sim ]
+ >=
+ LiteralExpr [FLOAT] [0.5]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=paperLeft ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=paperRight ]
+ Field=id
+ ]
+ ]
+ ]
+ ]
+ Groupby
+ Variable [ Name=idLeft ]
+ :=
+ FieldAccessor [
+ Variable [ Name=paperLeft ]
+ Field=id
+ ]
+ Variable [ Name=idRight ]
+ :=
+ FieldAccessor [
+ Variable [ Name=paperRight ]
+ Field=id
+ ]
+ With
+ Variable [ Name=sim ]
+ Variable [ Name=tokensRight ]
+ Variable [ Name=lenRight ]
+ Variable [ Name=tokensLeft ]
+ Variable [ Name=lenLeft ]
+ Variable [ Name=paperLeft ]
+ Variable [ Name=paperRight ]
+ Variable [ Name=prefixTokenRight ]
+ Variable [ Name=prefixTokenLeft ]
+ Variable [ Name=paperLeft ]
+ Variable [ Name=paperRight ]
+
+ )
+ AS
+ Variable [ Name=ridpair ]
+]
+Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ridpair ]
+ Field=idLeft
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=paperLeft ]
+ Field=id
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=ridpair ]
+ Field=idRight
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=paperRight ]
+ Field=id
+ ]
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=paperLeft ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=paperRight ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
new file mode 100644
index 0000000..c5360e2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
@@ -0,0 +1,150 @@
+DataverseUse TinySocial
+TypeDecl EmploymentType [
+ open RecordType {
+ organization-name : string,
+ start-date : date,
+ end-date : date?
+ }
+]
+TypeDecl FacebookUserType [
+ closed RecordType {
+ id : int32,
+ alias : string,
+ name : string,
+ user-since : datetime,
+ friend-ids : UnorderedList <int32>
+,
+ employment : OrderedList [EmploymentType]
+
+ }
+]
+DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[id]]
+Query:
+LetVariable [ Name=lonelyusers ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=d ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookUsers]
+ ]
+ AS
+ Variable [ Name=d ]
+ ]
+ Where
+ OperatorExpr [
+ FunctionCall TinySocial.count@1[
+ FieldAccessor [
+ Variable [ Name=d ]
+ Field=friend-ids
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [2]
+ ]
+ )
+LetVariable [ Name=lonelyusers2 ]
+ :=
+ (
+ SELECT ELEMENT [
+ Variable [ Name=d ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [FacebookUsers]
+ ]
+ AS
+ Variable [ Name=d ]
+ ]
+ Where
+ OperatorExpr [
+ FunctionCall TinySocial.count@1[
+ FieldAccessor [
+ Variable [ Name=d ]
+ Field=friend-ids
+ ]
+ ]
+ <
+ LiteralExpr [LONG] [2]
+ ]
+ )
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [user1]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=name
+ ]
+ )
+ ]
+ )
+ (
+ LiteralExpr [STRING] [user2]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=id
+ ]
+ )
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=name
+ ]
+ )
+ ]
+ )
+]
+]
+FROM [ Variable [ Name=lonelyusers ]
+ AS
+ Variable [ Name=l1 ]
+,
+ Variable [ Name=lonelyusers2 ]
+ AS
+ Variable [ Name=l2 ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=id
+ ]
+ <
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=id
+ ]
+ ]
+Orderby
+ FieldAccessor [
+ Variable [ Name=l1 ]
+ Field=id
+ ]
+ ASC
+ FieldAccessor [
+ Variable [ Name=l2 ]
+ Field=id
+ ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast
new file mode 100644
index 0000000..6efe636
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/unnest-to-join_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=y ]
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ ]
+ AS
+ Variable [ Name=x ]
+,
+ OrderedListConstructor [
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ LiteralExpr [LONG] [7]
+ LiteralExpr [LONG] [8]
+ LiteralExpr [LONG] [9]
+ ]
+ AS
+ Variable [ Name=y ]
+]
+Where
+ OperatorExpr [
+ Variable [ Name=x ]
+ =
+ Variable [ Name=y ]
+ ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast
new file mode 100644
index 0000000..c82765f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+WriteOutputTo nc1:rttest/unnest-to-join_02.adm
+Query:
+SELECT ELEMENT [
+QuantifiedExpression SOME [
+ [Variable [ Name=x ]
+ In
+ OrderedListConstructor [
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ LiteralExpr [LONG] [3]
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ ]
+ ]
+ [Variable [ Name=y ]
+ In
+ OrderedListConstructor [
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ LiteralExpr [LONG] [7]
+ LiteralExpr [LONG] [8]
+ LiteralExpr [LONG] [9]
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ Variable [ Name=x ]
+ =
+ Variable [ Name=y ]
+ ]
+ ]
+]
+]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast
new file mode 100644
index 0000000..625892a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast
@@ -0,0 +1,90 @@
+DataverseUse fuzzyjoin
+TypeDecl DBLPType [
+ closed RecordType {
+ id : int32,
+ dblpid : string,
+ title : string,
+ authors : string,
+ misc : string
+ }
+]
+TypeDecl TOKENSRANKEDADMType [
+ closed RecordType {
+ token : int32,
+ rank : int32
+ }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+DatasetDecl TOKENSRANKEDADM(TOKENSRANKEDADMType) partitioned by [[rank]]
+WriteOutputTo nc1:rttest/unnest_list_in_subplan.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ Variable [ Name=idDBLP ]
+ )
+ (
+ LiteralExpr [STRING] [tokens]
+ :
+ Variable [ Name=tokensDBLP ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [DBLP]
+ ]
+ AS
+ Variable [ Name=paperDBLP ]
+]
+LetVariable [ Name=idDBLP ]
+ :=
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=id
+ ]
+LetVariable [ Name=tokensUnrankedDBLP ]
+ :=
+ FunctionCall fuzzyjoin.counthashed-word-tokens@1[
+ FieldAccessor [
+ Variable [ Name=paperDBLP ]
+ Field=title
+ ]
+ ]
+LetVariable [ Name=tokensDBLP ]
+ :=
+ (
+ SELECT ELEMENT [
+ FieldAccessor [
+ Variable [ Name=tokenRanked ]
+ Field=rank
+ ]
+ ]
+ FROM [ Variable [ Name=tokensUnrankedDBLP ]
+ AS
+ Variable [ Name=tokenUnranked ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [TOKENSRANKEDADM]
+ ]
+ AS
+ Variable [ Name=tokenRanked ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=tokenUnranked ]
+ =
+ FieldAccessor [
+ Variable [ Name=tokenRanked ]
+ Field=token
+ ]
+ ]
+ Orderby
+ FieldAccessor [
+ Variable [ Name=tokenRanked ]
+ Field=rank
+ ]
+ ASC
+
+ )