Fixing issue 536 - change jaccard-similarity function to support unordered list as its second parameter
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
index f25fd7d..fb8becc 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
@@ -729,8 +729,8 @@
IAObject obj = constVal.getObject();
type = obj.getType();
typeTag = type.getTypeTag();
- if (typeTag != ATypeTag.ORDEREDLIST && typeTag != ATypeTag.STRING) {
- throw new AlgebricksException("Only ordered lists and string types supported.");
+ if (typeTag != ATypeTag.ORDEREDLIST && typeTag != ATypeTag.STRING && typeTag != ATypeTag.UNORDEREDLIST) {
+ throw new AlgebricksException("Only ordered lists, string, and unordered lists types supported.");
}
}
jobGenParams.setSearchKeyType(typeTag);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.query.aql
index 27a838ba..257c79d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.query.aql
@@ -1,6 +1,6 @@
use dataverse test;
for $c in dataset('Customers')
-let $jacc := similarity-jaccard-check($c.interests, ["databases", "computers", "wine"], 0.7f)
+let $jacc := similarity-jaccard-check($c.interests, {{"databases", "computers", "wine"}}, 0.7f)
where $jacc[0]
return $c