From 465e1212b7153b6fec914ab91c2b06052a42ebe8 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Wed, 1 Nov 2023 10:51:08 +0100 Subject: Revert "validate for array/wset attributes" --- .../main/java/com/yahoo/schema/RankProfile.java | 24 ++-------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'config-model/src/main/java/com/yahoo/schema/RankProfile.java') diff --git a/config-model/src/main/java/com/yahoo/schema/RankProfile.java b/config-model/src/main/java/com/yahoo/schema/RankProfile.java index 188918e99e5..1ff85c9c89f 100644 --- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java @@ -1265,34 +1265,14 @@ public class RankProfile implements Cloneable { return Optional.empty(); // if this context does not contain this input } - private static class AttributeErrorType extends TensorType { - private final String attr; - private final Attribute.CollectionType collType; - AttributeErrorType(String attr, Attribute.CollectionType collType) { - super(TensorType.Value.INT8, List.of()); - this.attr = attr; - this.collType = collType; - } - private void doThrow() { - throw new IllegalArgumentException("Cannot use attribute(" + attr +") " + collType + " as ranking expression input"); - } - @Override public TensorType.Value valueType() { doThrow(); return null; } - @Override public int rank() { doThrow(); return 0; } - @Override public List dimensions() { doThrow(); return null; } - } - private void addAttributeFeatureTypes(ImmutableSDField field, Map featureTypes) { Attribute attribute = field.getAttribute(); field.getAttributes().forEach((k, a) -> { String name = k; if (attribute == a) // this attribute should take the fields name name = field.getName(); // switch to that - it is separate for imported fields - if (a.getCollectionType().equals(Attribute.CollectionType.SINGLE)) { - featureTypes.put(FeatureNames.asAttributeFeature(name), - a.tensorType().orElse(TensorType.empty)); - } else { - featureTypes.put(FeatureNames.asAttributeFeature(name), new AttributeErrorType(name, a.getCollectionType())); - } + featureTypes.put(FeatureNames.asAttributeFeature(name), + a.tensorType().orElse(TensorType.empty)); }); } -- cgit v1.2.3