diff options
7 files changed, 25 insertions, 14 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h index 22e2e46c1e4..79795d94170 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h +++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h @@ -366,13 +366,19 @@ public: */ virtual bool getIsFastSearch() const = 0; - /* + /** * Returns the committed docid limit for the attribute. * * @return committed docid limit for the attribute. */ virtual uint32_t getCommittedDocIdLimitSlow() const = 0; + /* + * Returns whether the current attribute vector is an imported attribute + * vector. + */ + virtual bool isImported() const = 0; + /** * Will serialize the values for the documentid in ascending order. The serialized form can be used by memcmp and * sortorder will be preserved. diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index e6cfe303bed..998cd78623d 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -346,6 +346,12 @@ AttributeVector::getCommittedDocIdLimitSlow() const } bool +AttributeVector::isImported() const +{ + return false; +} + +bool AttributeVector::headerTypeOK(const vespalib::GenericHeader &header) const { return header.hasTag(dataTypeTag) && diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index f00a8779c92..2392504bdaf 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -434,6 +434,7 @@ public: virtual bool getIsFilter() const override; virtual bool getIsFastSearch() const override; virtual uint32_t getCommittedDocIdLimitSlow() const override; + virtual bool isImported() const override; /** * Updates the base file name of this attribute vector and saves diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp index 98e93fb41df..a27c73e112e 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp @@ -146,6 +146,11 @@ uint32_t ImportedAttributeVectorReadGuard::getCommittedDocIdLimitSlow() const { return _reference_attribute.getCommittedDocIdLimit(); } +bool ImportedAttributeVectorReadGuard::isImported() const +{ + return true; +} + long ImportedAttributeVectorReadGuard::onSerializeForAscendingSort(DocId doc, void *serTo, long available, diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h index 6c02c20c48a..6c8dca11d31 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h @@ -76,6 +76,7 @@ public: virtual bool getIsFilter() const override; virtual bool getIsFastSearch() const override; virtual uint32_t getCommittedDocIdLimitSlow() const override; + virtual bool isImported() const override; protected: virtual long onSerializeForAscendingSort(DocId doc, void * serTo, long available, diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp index be909d7a7e6..3688e00d47d 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp @@ -355,10 +355,6 @@ template class ArrayParam<double>; namespace { -bool isImportedAttribute(const IAttributeVector& attribute) noexcept { - return dynamic_cast<const ImportedAttributeVectorReadGuard*>(&attribute) != nullptr; -} - using dotproduct::ArrayParam; template <typename A> @@ -373,7 +369,7 @@ bool supportsGetRawValues(const A & attr) noexcept { } } -// Precondition: isImportedAttribute(*attribute) == false +// Precondition: attribute->isImported() == false template <typename A> FeatureExecutor & createForDirectArrayImpl(const IAttributeVector * attribute, @@ -471,7 +467,7 @@ FeatureExecutor & createFromObject(const IAttributeVector * attribute, const fef::Anything & object, vespalib::Stash &stash) { if (attribute->getCollectionType() == attribute::CollectionType::ARRAY) { - if (!isImportedAttribute(*attribute)) { + if (!attribute->isImported()) { switch (attribute->getBasicType()) { case BasicType::INT32: return createForDirectArray<IntegerAttributeTemplate<int32_t>>(attribute, dynamic_cast<const ArrayParam<int32_t> &>(object), stash); @@ -507,7 +503,7 @@ createFromObject(const IAttributeVector * attribute, const fef::Anything & objec FeatureExecutor * createTypedArrayExecutor(const IAttributeVector * attribute, const Property & prop, vespalib::Stash & stash) { - if (!isImportedAttribute(*attribute)) { + if (!attribute->isImported()) { switch (attribute->getBasicType()) { case BasicType::INT32: return &createForDirectArray<IntegerAttributeTemplate<int32_t>>(attribute, prop, stash); @@ -586,7 +582,7 @@ createFromString(const IAttributeVector * attribute, const Property & prop, vesp } fef::Anything::UP attemptParseArrayQueryVector(const IAttributeVector & attribute, const Property & prop) { - if (!isImportedAttribute(attribute)) { + if (!attribute.isImported()) { switch (attribute.getBasicType()) { case BasicType::INT32: return std::make_unique<ArrayParam<int32_t>>(prop); diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp index b9a9d96ff66..90451c01294 100644 --- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp @@ -143,10 +143,6 @@ InternalMaxReduceProdJoinBlueprint::setup(const IIndexEnvironment &env, const Pa return true; } -bool isImportedAttribute(const IAttributeVector &attribute) noexcept { - return dynamic_cast<const ImportedAttributeVectorReadGuard*>(&attribute) != nullptr; -} - template<typename A> bool supportsGetRawValues(const A &attr) noexcept { try { @@ -163,7 +159,7 @@ template <typename BaseType> FeatureExecutor & selectTypedExecutor(const IAttributeVector *attribute, const IntegerVector &vector, vespalib::Stash &stash) { - if (!isImportedAttribute(*attribute)) { + if (!attribute->isImported()) { using A = IntegerAttributeTemplate<BaseType>; using VT = multivalue::Value<BaseType>; using ExactA = MultiValueNumericAttribute<A, VT>; |