aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java')
-rw-r--r--container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
index bd29e2afd53..178163cf961 100644
--- a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
@@ -82,10 +82,14 @@ public class YqlParserTestCase {
static private IndexFacts createIndexFactsForInTest() {
SearchDefinition sd = new SearchDefinition("default");
- sd.addIndex(new Index("field"));
+ Index fieldIndex = new Index("field");
+ fieldIndex.setInteger(true);
+ sd.addIndex(fieldIndex);
Index stringIndex = new Index("string");
stringIndex.setString(true);
sd.addIndex(stringIndex);
+ Index floatIndex = new Index("float");
+ sd.addIndex(floatIndex);
return new IndexFacts(new IndexModel(sd));
}
@@ -1183,10 +1187,9 @@ public class YqlParserTestCase {
parser.setUserQuery(createUserQuery());
query = parse("select * from sources * where string in ('a','b', @foostring)");
assertStringInItem("string", new String[]{"a","b","might","this", "work"}, query);
- parser.setUserQuery(createUserQuery());
- query = parse("select * from sources * where field in (29.9, -7.4)");
- assertNumericInItem("field", new long[]{-7, 29}, query);
parser.setUserQuery(null);
+ assertParseFail("select * from sources * where field in (29.9, -7.4)",
+ new ClassCastException("Cannot cast java.lang.Double to java.lang.Long"));
assertParseFail("select * from sources * where string in ('a', 25L)",
new ClassCastException("Cannot cast java.lang.Long to java.lang.String"));
assertParseFail("select * from sources * where field in ('a', 25L)",
@@ -1195,6 +1198,9 @@ public class YqlParserTestCase {
new IllegalArgumentException("Field 'nofield' does not exist."));
assertParseFail("select * from sources * where field not in (25)",
new IllegalArgumentException("Expected AND, CALL, CONTAINS, EQ, GT, GTEQ, IN, LT, LTEQ or OR, got NOT_IN."));
+ assertParseFail("select * from sources * where float in (25)",
+ new IllegalArgumentException("The in operator is only supported for integer and string fields. " +
+ "The field float is not of these types"));
}
private static void assertNumericInItem(String field, long[] values, QueryTree query) {