aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-09-29 13:22:13 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2022-09-29 13:22:13 +0200
commit7302ce45688748474129c0f0a50778818c1784eb (patch)
treea6aa733b648d2c2c02004c339eb185568881f7f4 /config-model/src/main/java
parent606796ed3b3bce9953e419effa9365103ca4032d (diff)
Warn if enable-bit-vectors is used. It is default and has no effect any longer.
Diffstat (limited to 'config-model/src/main/java')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/derived/AttributeFields.java5
-rw-r--r--config-model/src/main/java/com/yahoo/schema/document/Attribute.java44
-rw-r--r--config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedFields.java1
-rw-r--r--config-model/src/main/java/com/yahoo/schema/parser/ParsedAttribute.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java13
5 files changed, 24 insertions, 42 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/AttributeFields.java b/config-model/src/main/java/com/yahoo/schema/derived/AttributeFields.java
index 567bd564eb5..1ce1c48c0f1 100644
--- a/config-model/src/main/java/com/yahoo/schema/derived/AttributeFields.java
+++ b/config-model/src/main/java/com/yahoo/schema/derived/AttributeFields.java
@@ -99,7 +99,6 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce
private void applyRanking(ImmutableSDField field, Attribute attribute) {
Ranking ranking = field.getRanking();
if (ranking != null && ranking.isFilter()) {
- attribute.setEnableBitVectors(true);
attribute.setEnableOnlyBitVector(true);
}
}
@@ -201,7 +200,6 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce
if (attribute.isCreateIfNonExistent()) {
aaB.createifnonexistent(true);
}
- aaB.enablebitvectors(attribute.isEnabledBitVectors());
aaB.enableonlybitvector(attribute.isEnabledOnlyBitVector());
if (attribute.isFastSearch() || attribute.isFastRank()) {
// TODO make a separate fastrank flag in config instead of overloading fastsearch
@@ -282,9 +280,6 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce
if (isAttributeInFieldSet(attribute, fs)) {
AttributesConfig.Attribute.Builder attrBuilder = getConfig(attribute.getName(), attribute, false);
attrBuilder.maxuncommittedmemory(maxUnCommittedMemory);
- if (attribute.isFastSearch()) {
- attrBuilder.enablebitvectors(true);
- }
builder.attribute(attrBuilder);
}
}
diff --git a/config-model/src/main/java/com/yahoo/schema/document/Attribute.java b/config-model/src/main/java/com/yahoo/schema/document/Attribute.java
index ca8279752ac..34e86cbf4a8 100644
--- a/config-model/src/main/java/com/yahoo/schema/document/Attribute.java
+++ b/config-model/src/main/java/com/yahoo/schema/document/Attribute.java
@@ -50,7 +50,6 @@ public final class Attribute implements Cloneable, Serializable {
private boolean removeIfZero = false;
private boolean createIfNonExistent = false;
- private boolean enableBitVectors = false;
private boolean enableOnlyBitVector = false;
private boolean fastRank = false;
@@ -145,8 +144,8 @@ public final class Attribute implements Cloneable, Serializable {
/** Creates an attribute with default settings */
public Attribute(String name, DataType fieldType) {
this(name, convertDataType(fieldType), convertCollectionType(fieldType), convertTensorType(fieldType), convertTargetType(fieldType));
- setRemoveIfZero(fieldType instanceof WeightedSetDataType ? ((WeightedSetDataType)fieldType).removeIfZero() : false);
- setCreateIfNonExistent(fieldType instanceof WeightedSetDataType ? ((WeightedSetDataType)fieldType).createIfNonExistent() : false);
+ setRemoveIfZero(fieldType instanceof WeightedSetDataType wsdt && wsdt.removeIfZero());
+ setCreateIfNonExistent(fieldType instanceof WeightedSetDataType wsdt && wsdt.createIfNonExistent());
}
public Attribute(String name, Type type, CollectionType collectionType) {
@@ -179,7 +178,7 @@ public final class Attribute implements Cloneable, Serializable {
* Multi value attributes are not.</p>
*/
public boolean isPrefetch() {
- if (prefetch!=null) return prefetch.booleanValue();
+ if (prefetch!=null) return prefetch;
if (tensorType.isPresent()) {
return false;
@@ -196,7 +195,6 @@ public final class Attribute implements Cloneable, Serializable {
public boolean isRemoveIfZero() { return removeIfZero; }
public boolean isCreateIfNonExistent() { return createIfNonExistent; }
- public boolean isEnabledBitVectors() { return enableBitVectors; }
public boolean isEnabledOnlyBitVector() { return enableOnlyBitVector; }
public boolean isFastSearch() { return fastSearch; }
public boolean isFastRank() { return fastRank; }
@@ -230,7 +228,6 @@ public final class Attribute implements Cloneable, Serializable {
* True or false to override default, null to use default
*/
public void setPrefetch(Boolean prefetch) { this.prefetch = prefetch; }
- public void setEnableBitVectors(boolean enableBitVectors) { this.enableBitVectors = enableBitVectors; }
public void setEnableOnlyBitVector(boolean enableOnlyBitVector) { this.enableOnlyBitVector = enableOnlyBitVector; }
public void setFastRank(boolean value) {
Supplier<IllegalArgumentException> badGen = () ->
@@ -335,23 +332,22 @@ public final class Attribute implements Cloneable, Serializable {
/** Converts to the right field type from an attribute type */
private DataType toDataType(Type attributeType) {
- switch (attributeType) {
- case STRING : return DataType.STRING;
- case INTEGER: return DataType.INT;
- case LONG: return DataType.LONG;
- case FLOAT16: return DataType.FLOAT16;
- case FLOAT: return DataType.FLOAT;
- case DOUBLE: return DataType.DOUBLE;
- case BOOL: return DataType.BOOL;
- case BYTE: return DataType.BYTE;
- case PREDICATE: return DataType.PREDICATE;
- case TENSOR: return DataType.getTensor(tensorType.orElseThrow(IllegalStateException::new));
- case REFERENCE: return createReferenceDataType();
- default: throw new IllegalArgumentException("Unknown attribute type " + attributeType);
- }
+ return switch (attributeType) {
+ case STRING -> DataType.STRING;
+ case INTEGER -> DataType.INT;
+ case LONG -> DataType.LONG;
+ case FLOAT16 -> DataType.FLOAT16;
+ case FLOAT -> DataType.FLOAT;
+ case DOUBLE -> DataType.DOUBLE;
+ case BOOL -> DataType.BOOL;
+ case BYTE -> DataType.BYTE;
+ case PREDICATE -> DataType.PREDICATE;
+ case TENSOR -> DataType.getTensor(tensorType.orElseThrow(IllegalStateException::new));
+ case REFERENCE-> createReferenceDataType();
+ default -> throw new IllegalArgumentException("Unknown attribute type " + attributeType);
+ };
}
- @SuppressWarnings("deprecation")
private DataType createReferenceDataType() {
if (referenceDocumentType.isEmpty()) {
throw new IllegalStateException("Referenced document type is not set");
@@ -379,15 +375,14 @@ public final class Attribute implements Cloneable, Serializable {
public int hashCode() {
return Objects.hash(
name, type, collectionType, sorting, dictionary, isPrefetch(), fastAccess, removeIfZero,
- createIfNonExistent, isPosition, mutable, paged, enableBitVectors, enableOnlyBitVector,
+ createIfNonExistent, isPosition, mutable, paged, enableOnlyBitVector,
tensorType, referenceDocumentType, distanceMetric, hnswIndexParams);
}
@Override
public boolean equals(Object object) {
- if (! (object instanceof Attribute)) return false;
+ if (! (object instanceof Attribute other)) return false;
- Attribute other = (Attribute)object;
if (!this.name.equals(other.name)) return false;
return isCompatible(other);
}
@@ -399,7 +394,6 @@ public final class Attribute implements Cloneable, Serializable {
if (this.isPrefetch() != other.isPrefetch()) return false;
if (this.removeIfZero != other.removeIfZero) return false;
if (this.createIfNonExistent != other.createIfNonExistent) return false;
- if (this.enableBitVectors != other.enableBitVectors) return false;
if (this.enableOnlyBitVector != other.enableOnlyBitVector) return false;
if (this.fastSearch != other.fastSearch) return false;
if (this.mutable != other.mutable) return false;
diff --git a/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedFields.java b/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedFields.java
index 443dfb1602d..d00af722158 100644
--- a/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedFields.java
+++ b/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedFields.java
@@ -86,7 +86,6 @@ public class ConvertParsedFields {
}
attribute.setFastAccess(parsed.getFastAccess());
attribute.setMutable(parsed.getMutable());
- attribute.setEnableBitVectors(parsed.getEnableBitVectors());
attribute.setEnableOnlyBitVector(parsed.getEnableOnlyBitVector());
// attribute.setTensorType(?)
diff --git a/config-model/src/main/java/com/yahoo/schema/parser/ParsedAttribute.java b/config-model/src/main/java/com/yahoo/schema/parser/ParsedAttribute.java
index de06436a1eb..26916a6685e 100644
--- a/config-model/src/main/java/com/yahoo/schema/parser/ParsedAttribute.java
+++ b/config-model/src/main/java/com/yahoo/schema/parser/ParsedAttribute.java
@@ -14,7 +14,6 @@ import java.util.Optional;
**/
class ParsedAttribute extends ParsedBlock {
- private boolean enableBitVectors = false;
private boolean enableOnlyBitVector = false;
private boolean enableFastAccess = false;
private boolean enableFastRank = false;
@@ -32,7 +31,6 @@ class ParsedAttribute extends ParsedBlock {
List<String> getAliases() { return List.copyOf(aliases.keySet()); }
String lookupAliasedFrom(String alias) { return aliases.get(alias); }
Optional<String> getDistanceMetric() { return Optional.ofNullable(distanceMetric); }
- boolean getEnableBitVectors() { return this.enableBitVectors; }
boolean getEnableOnlyBitVector() { return this.enableOnlyBitVector; }
boolean getFastAccess() { return this.enableFastAccess; }
boolean getFastRank() { return this.enableFastRank; }
@@ -56,7 +54,6 @@ class ParsedAttribute extends ParsedBlock {
return this.sortSettings;
}
- void setEnableBitVectors(boolean value) { this.enableBitVectors = value; }
void setEnableOnlyBitVector(boolean value) { this.enableOnlyBitVector = value; }
void setFastAccess(boolean value) { this.enableFastAccess = true; }
void setFastRank(boolean value) { this.enableFastRank = true; }
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
index daade2d74d9..877ea1d59e7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
@@ -24,12 +24,12 @@ import com.yahoo.vespa.model.search.Tuning;
import org.w3c.dom.Element;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
+import java.util.LinkedHashMap;
+import java.util.Optional;
+import java.util.Objects;
import java.util.TreeMap;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -118,10 +118,7 @@ public class ContentSearchCluster extends AbstractConfigProducer<SearchCluster>
}
private boolean getFlushOnShutdown(Boolean flushOnShutdownElem) {
- if (flushOnShutdownElem != null) {
- return flushOnShutdownElem;
- }
- return true;
+ return Objects.requireNonNullElse(flushOnShutdownElem, true);
}
private Double getQueryTimeout(ModelElement clusterElem) {
@@ -151,7 +148,7 @@ public class ContentSearchCluster extends AbstractConfigProducer<SearchCluster>
0,
docTypeName,
clusterName);
- search.addSearchCluster(deployState, cluster, getQueryTimeout(clusterElem), Arrays.asList(docType));
+ search.addSearchCluster(deployState, cluster, getQueryTimeout(clusterElem), List.of(docType));
}
private void buildIndexedSearchCluster(DeployState deployState, ModelElement clusterElem,