From 06f290f5477996d86cbc4a5d98da68e5cf0cb367 Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Thu, 19 May 2022 13:14:52 +0000 Subject: Changing 'fast-rank' on an attribute should trigger the restart action. Add more testing of 'fast-rank' on un-supported attributes. --- .../java/com/yahoo/schema/processing/TensorFieldTestCase.java | 11 +++++++++++ .../change/search/AttributeChangeValidatorTest.java | 8 ++++++++ 2 files changed, 19 insertions(+) (limited to 'config-model/src/test/java') diff --git a/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java index 67c77508e3b..9164f361a92 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java @@ -54,6 +54,17 @@ public class TensorFieldTestCase { } } + @Test + public void requireThatIndexedTensorAttributeCannotBeFastRank() throws ParseException { + try { + createFromString(getSd("field f1 type tensor(x[3]) { indexing: attribute \n attribute: fast-rank }")); + fail("Expected exception"); + } + catch (IllegalArgumentException e) { + assertEquals("The attribute 'f1' (tensor(x[3])) does not support 'fast-rank'. Only supported for tensor types with at least one mapped dimension", e.getMessage()); + } + } + @Test public void requireThatIllegalTensorTypeSpecThrowsException() throws ParseException { try { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java index 3cfde4c4d19..c3aa387da54 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java @@ -75,6 +75,14 @@ public class AttributeChangeValidatorTest { "Field 'f1' changed: add attribute 'fast-search'")); } + @Test + public void changing_fast_rank_require_restart() throws Exception { + new Fixture("field f1 type tensor(x{}) { indexing: attribute }", + "field f1 type tensor(x{}) { indexing: attribute \n attribute: fast-rank }"). + assertValidation(newRestartAction(ClusterSpec.Id.from("test"), + "Field 'f1' changed: add attribute 'fast-rank'")); + } + @Test public void changing_btree2hash_require_restart() throws Exception { new Fixture("field f1 type long { indexing: attribute\n attribute: fast-search\n dictionary: btree}", -- cgit v1.2.3