summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-04-27 14:15:19 +0200
committerGitHub <noreply@github.com>2022-04-27 14:15:19 +0200
commitac66266271ec2a6a3b3ed75de9f9bcab1f118141 (patch)
treed59e66af3a43f109679b3e721c2b266bf08b4f52 /config-model/src/main/java/com/yahoo
parent9ab10c80ee9af5d287abecaf2c6971497c8bb820 (diff)
parentde28c02fe270ac13725f5de0d94374ce612c1f98 (diff)
Merge pull request #22306 from vespa-engine/arnej/validate-wset-nested-type
validate nested type for weighted sets
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
index a5f00b1ce45..bcf8d8c9172 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedType.java
@@ -153,6 +153,32 @@ class ParsedType {
}
static ParsedType wsetOf(ParsedType vt) {
assert(vt != null);
+ if (vt.getVariant() != Variant.BUILTIN) {
+ throw new IllegalArgumentException("weightedset of complex type '" + vt + "' is not supported");
+ }
+ switch (vt.name()) {
+ // allowed types:
+ case "bool":
+ case "byte":
+ case "int":
+ case "long":
+ case "string":
+ case "uri":
+ break;
+ case "predicate":
+ case "raw":
+ case "tag":
+ throw new IllegalArgumentException("weightedset of complex type '" + vt + "' is not supported");
+ case "float16":
+ case "float":
+ case "double":
+ /* TODO Vespa 8:
+ throw new IllegalArgumentException("weightedset of inexact type '" + vt + "' is not supported");
+ */
+ break;
+ default:
+ throw new IllegalArgumentException("weightedset of unknown type '" + vt + "' is not supported");
+ }
return new ParsedType("weightedset<" + vt.name() + ">", Variant.WSET, vt);
}
static ParsedType documentRef(ParsedType docType) {