http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql
new file mode 100644
index 0000000..8450815
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.3.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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
+ */
+
+use dataverse test;
+
+create index ngram_index on DBLP(title) type ngram(3);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.4.query.aql
new file mode 100644
index 0000000..d494e5f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ngram-jaccard/ngram-jaccard.4.query.aql
@@ -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    : Fuzzy joins two datasets, DBLP and CSX, based on the 
similarity-jaccard function of their titles' 3-gram tokens.
+ *                  DBLP has a 3-gram index on title, and we expect the join 
to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+set import-private-functions 'true';
+
+for $a in dataset('DBLP')
+for $b in dataset('CSX')
+where similarity-jaccard(gram-tokens($a.title, 3, false), 
gram-tokens($b.title, 3, false)) >= 0.5f 
+      and $a.id < $b.id
+order by $a.id, $b.id
+return { "arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.1.ddl.aql
new file mode 100644
index 0000000..14007b8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.1.ddl.aql
@@ -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 joins two datasets, Customers and Customers2, 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as open {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.2.update.aql
new file mode 100644
index 0000000..bdc8dd5
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.2.update.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset Customers 
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+load dataset Customers2
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.3.ddl.aql
new file mode 100644
index 0000000..5c3bc5f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.3.ddl.aql
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.query.aql
new file mode 100644
index 0000000..3c28521
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.query.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+let $ed := edit-distance($a.interests, $b.interests)
+where len($a.interests) > 2 and len($b.interests) > 2 and $ed <= 1 and $a.cid 
< $b.cid
+order by $ed, $a.cid, $b.cid
+return { "arec": $a, "brec": $b, "ed": $ed }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.1.ddl.aql
new file mode 100644
index 0000000..7d2eeaf
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.1.ddl.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, 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 dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as open {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.2.update.aql
new file mode 100644
index 0000000..0c1ede4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, 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
+ */
+
+use dataverse test;
+
+load dataset Customers 
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+load dataset Customers2
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.3.ddl.aql
new file mode 100644
index 0000000..d6d7650
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.3.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, 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
+ */
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.4.query.aql
new file mode 100644
index 0000000..fc248d8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-edit-distance/olist-edit-distance.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, 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
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+where len($a.interests) > 2 and len($b.interests) > 2 and 
edit-distance($a.interests, $b.interests) <= 1 and $a.cid < $b.cid
+order by $a.cid, $b.cid
+return { "arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.1.ddl.aql
new file mode 100644
index 0000000..83d6dd6
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.1.ddl.aql
@@ -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 joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.2.update.aql
new file mode 100644
index 0000000..1bf2e7a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.2.update.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset Customers 
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+load dataset Customers2
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.3.ddl.aql
new file mode 100644
index 0000000..ccc8938
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.3.ddl.aql
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.query.aql
new file mode 100644
index 0000000..6b94773
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.query.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+let $jacc := /*+ indexnl */similarity-jaccard($a.interests, $b.interests)
+where $jacc >= 0.9f  and $a.cid < $b.cid and len($a.interests) > 1 and 
len($b.interests) > 1
+order by $jacc, $a.cid, $b.cid
+return { "a": $a, "b": $b, "jacc": $jacc }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.1.ddl.aql
new file mode 100644
index 0000000..0b20589
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.1.ddl.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: [string],
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.2.update.aql
new file mode 100644
index 0000000..470acbf
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, based 
on the Jaccard similarity 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
+ */
+
+use dataverse test;
+
+load dataset Customers 
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+
+load dataset Customers2
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k_olist/customer.adm"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.3.ddl.aql
new file mode 100644
index 0000000..5622e8e
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.3.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, based 
on the Jaccard similarity 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
+ */
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.4.query.aql
new file mode 100644
index 0000000..f2bb08b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/olist-jaccard/olist-jaccard.4.query.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+where /*+ indexnl */ similarity-jaccard($a.interests, $b.interests) >= 0.9f 
+      and $a.cid < $b.cid and len($a.interests) > 1 and len($b.interests) > 1
+order by $a.cid, $b.cid
+return { "a": $a, "b": $b }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.1.ddl.aql
new file mode 100644
index 0000000..e79e35c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.1.ddl.aql
@@ -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 joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: {{string}},
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.2.update.aql
new file mode 100644
index 0000000..883df5d
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.2.update.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset Customers 
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
+
+load dataset Customers2
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.3.ddl.aql
new file mode 100644
index 0000000..29fd082
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.3.ddl.aql
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.query.aql
new file mode 100644
index 0000000..dfbcfee
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.query.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+let $jacc := /*+ indexnl */ similarity-jaccard($a.interests, $b.interests)
+where $jacc >= 0.9f and $a.cid < $b.cid and len($a.interests) > 1 and 
len($b.interests) > 1
+order by $jacc, $a.cid, $b.cid
+return { "a": $a, "b": $b, "jacc": $jacc }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.1.ddl.aql
new file mode 100644
index 0000000..3dc70a3
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.1.ddl.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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 dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  age: int64?,
+  address: AddressType?,
+  interests: {{string}},
+  children: [ { name: string, age: int64? } ]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+
+create dataset Customers2(CustomerType) primary key cid;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.2.update.aql
new file mode 100644
index 0000000..99aaf1b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, based 
on the Jaccard similarity 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
+ */
+
+use dataverse test;
+
+load dataset Customers 
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
+
+load dataset Customers2
+using localfs
+(("path"="asterix_nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.3.ddl.aql
new file mode 100644
index 0000000..bb4f791
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.3.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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, Customers and Customers2, based 
on the Jaccard similarity 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
+ */
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.4.query.aql
new file mode 100644
index 0000000..287c412
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/ulist-jaccard/ulist-jaccard.4.query.aql
@@ -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    : Fuzzy joins two datasets, Customers and Customers2, based 
on the Jaccard similarity 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
+ */
+
+use dataverse test;
+
+for $a in dataset('Customers')
+for $b in dataset('Customers2')
+where /*+ indexnl */ similarity-jaccard($a.interests, $b.interests) >= 0.9f 
+      and $a.cid < $b.cid and len($a.interests) > 1 and len($b.interests) > 1
+order by $a.cid, $b.cid
+return { "a": $a, "b": $b }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql
new file mode 100644
index 0000000..3e70790
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.1.ddl.aql
@@ -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 joins two datasets, DBLP and CSX, based on the 
similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and we expect the join 
to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type DBLPType as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type CSXType as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+
+create dataset CSX(CSXType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.2.update.aql
new file mode 100644
index 0000000..c8219d4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.2.update.aql
@@ -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    : Fuzzy joins two datasets, DBLP and CSX, based on the 
similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and we expect the join 
to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset DBLP
+using localfs
+(("path"="asterix_nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"))
 pre-sorted;
+
+load dataset CSX
+using localfs
+(("path"="asterix_nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.3.ddl.aql
new file mode 100644
index 0000000..c2bc30f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.3.ddl.aql
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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 test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+create index keyword_index on DBLP(title) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql
new file mode 100644
index 0000000..764b577
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.query.aql
@@ -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    : Fuzzy joins two datasets, DBLP and CSX, based on the 
similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and we expect the join 
to be transformed into an indexed nested-loop join.
+ *                  We test the inlining of variables that enable the select 
to be pushed into the join for subsequent optimization with an index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('DBLP')
+for $b in dataset('CSX')
+let $jacc := similarity-jaccard(word-tokens($a.title), word-tokens($b.title))
+where $jacc >= 0.5f and $a.id < $b.id
+order by $jacc, $a.id, $b.id
+return { "arec": $a, "brec": $b, "jacc": $jacc }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.1.ddl.aql
new file mode 100644
index 0000000..011ea03
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.1.ddl.aql
@@ -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 joins two datasets, DBLP and CSX, based on the 
similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and we expect the join 
to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type DBLPType as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type CSXType as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+
+create dataset CSX(CSXType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.2.update.aql
new file mode 100644
index 0000000..6d14b24
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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
+ */
+
+use dataverse test;
+
+load dataset DBLP
+using localfs
+(("path"="asterix_nc1://data/dblp-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"))
 pre-sorted;
+
+load dataset CSX
+using localfs
+(("path"="asterix_nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.3.ddl.aql
new file mode 100644
index 0000000..94e07e4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.3.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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
+ */
+
+use dataverse test;
+
+create index keyword_index on DBLP(title) type keyword;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.4.query.aql
new file mode 100644
index 0000000..ddf10b1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/inverted-index-join/word-jaccard/word-jaccard.4.query.aql
@@ -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    : Fuzzy joins two datasets, DBLP and CSX, based on the 
similarity-jaccard function of their titles' word tokens.
+ *                  DBLP has a keyword index on title, and we expect the join 
to be transformed into an indexed nested-loop join.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('DBLP')
+for $b in dataset('CSX')
+where similarity-jaccard(word-tokens($a.title), word-tokens($b.title)) >= 0.5f 
+      and $a.id < $b.id
+order by $a.id, $b.id
+return { "arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/json/int01/int01.1.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/json/int01/int01.1.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/json/int01/int01.1.query.aql
new file mode 100644
index 0000000..5c71659
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/json/int01/int01.1.query.aql
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+[ 1, 2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql
new file mode 100644
index 0000000..cad801d
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.1.ddl.aql
@@ -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    : Left-outer 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 dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type CSXType as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+create dataset CSX(CSXType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql
new file mode 100644
index 0000000..fff65d2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.2.update.aql
@@ -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    : Left-outer 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
+ */
+
+use dataverse test;
+
+load dataset DBLP
+using localfs
+(("path"="asterix_nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+
+load dataset CSX
+using localfs
+(("path"="asterix_nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql
new file mode 100644
index 0000000..dfd8c8a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285-2/query_issue285-2.3.query.aql
@@ -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    : Left-outer 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.
+ *
+ *                    TODO(@Sattam): given the 'indexnl' hint
+ *                  we expect the join to be transformed into an indexed 
nested-loop join.
+ *
+ *                    regression test 2 for issue 285--having an order by and 
limit for the outer loop relation
+ *
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $a in dataset('DBLP')
+order by $a.id
+limit 10
+return {
+"aid": $a.id,
+"bids": for $b in dataset('CSX')
+where $a.authors = $b.authors
+order by $b.id
+return $b.id
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql
new file mode 100644
index 0000000..5507c15
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.1.ddl.aql
@@ -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    : Left-outer joins two datasets, DBLP and CSX, based on 
their title.
+ *                  DBLP has a secondary btree index on title.
+ *
+ *                  TODO(@Sattam): given the 'indexnl' hint
+ *                  we expect the join to be transformed into an indexed 
nested-loop join.
+ *
+ *                  regression test for issue 285
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+  id: int64,
+  dblpid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create type CSXType as closed {
+  id: int64,
+  csxid: string,
+  title: string,
+  authors: string,
+  misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
+create dataset CSX(CSXType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql
new file mode 100644
index 0000000..fff65d2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/leftouterjoin/query_issue285/query_issue285.2.update.aql
@@ -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    : Left-outer 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
+ */
+
+use dataverse test;
+
+load dataset DBLP
+using localfs
+(("path"="asterix_nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+
+load dataset CSX
+using localfs
+(("path"="asterix_nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+

Reply via email to