summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-03-31 06:55:28 +0000
committerArne Juul <arnej@verizonmedia.com>2021-03-31 06:55:28 +0000
commit88fa50bab055d7d9ac889c993d4262acf85e43c4 (patch)
tree6af61fe06bb630fe439743b9dd376df686f4f9b4 /searchlib
parent32862b3ad0e4110111082ce64baae6cc2370bea5 (diff)
check tensor type of attribute explicitly
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
index 6a096450d82..2c4fb50e500 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
@@ -693,9 +693,10 @@ public:
if (tensor_attr == nullptr) {
return fail_nearest_neighbor_term(n, "Attribute is not a tensor");
}
- if (tensor_attr->getTensorType().dimensions().size() != 1) {
- return fail_nearest_neighbor_term(n, make_string("Attribute tensor type (%s) is not of order 1",
- tensor_attr->getTensorType().to_spec().c_str()));
+ const auto & ta_type = tensor_attr->getTensorType();
+ if ((! ta_type.is_dense()) || (ta_type.dimensions().size() != 1)) {
+ return fail_nearest_neighbor_term(n, make_string("Attribute tensor type (%s) is not a dense tensor of order 1",
+ ta_type.to_spec().c_str()));
}
auto query_tensor = getRequestContext().get_query_tensor(n.get_query_tensor_name());
if (query_tensor.get() == nullptr) {
@@ -706,13 +707,13 @@ public:
return fail_nearest_neighbor_term(n, make_string("Query tensor is not a dense tensor (type=%s)",
qt_type.to_spec().c_str()));
}
- if (!is_compatible_for_nearest_neighbor(tensor_attr->getTensorType(), qt_type)) {
+ if (!is_compatible_for_nearest_neighbor(ta_type, qt_type)) {
return fail_nearest_neighbor_term(n, make_string("Attribute tensor type (%s) and query tensor type (%s) are not compatible",
- tensor_attr->getTensorType().to_spec().c_str(), qt_type.to_spec().c_str()));
+ ta_type.to_spec().c_str(), qt_type.to_spec().c_str()));
}
if (tensor_attr->supports_extract_cells_ref() == false) {
return fail_nearest_neighbor_term(n, make_string("Attribute does not support access to tensor data (type=%s)",
- tensor_attr->getTensorType().to_spec().c_str()));
+ ta_type.to_spec().c_str()));
}
setResult(std::make_unique<queryeval::NearestNeighborBlueprint>(_field, *tensor_attr,
std::move(query_tensor),