summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHÃ¥vard Pettersen <3535158+havardpe@users.noreply.github.com>2020-12-04 23:30:44 +0100
committerGitHub <noreply@github.com>2020-12-04 23:30:44 +0100
commit57a44319f652817b5841d4d3d476a070235970f5 (patch)
tree62358c0d4ef6d332ba9598f6574463a63e9b67b5 /document
parenta90709008ec0d108ee9a2e26bda20e39a10424b5 (diff)
parent15fe399eff5ade4ea12dded37c28ec4629899015 (diff)
Merge pull request #15678 from vespa-engine/havardpe/remove-engine-or-factory
remove EngineOrFactory
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp10
-rw-r--r--document/src/vespa/document/serialization/vespadocumentdeserializer.cpp7
-rw-r--r--document/src/vespa/document/update/tensor_add_update.cpp8
-rw-r--r--document/src/vespa/document/update/tensor_modify_update.cpp11
-rw-r--r--document/src/vespa/document/update/tensor_remove_update.cpp11
5 files changed, 23 insertions, 24 deletions
diff --git a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
index 183caa7e3e0..cc3aed67387 100644
--- a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
@@ -4,14 +4,14 @@
#include <vespa/document/base/exceptions.h>
#include <vespa/document/datatype/tensor_data_type.h>
#include <vespa/vespalib/util/xmlstream.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/value.h>
#include <ostream>
#include <cassert>
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::TensorSpec;
using vespalib::eval::ValueType;
using namespace vespalib::xml;
@@ -51,7 +51,7 @@ TensorFieldValue::TensorFieldValue(const TensorFieldValue &rhs)
_altered(true)
{
if (rhs._tensor) {
- _tensor = EngineOrFactory::get().copy(*rhs._tensor);
+ _tensor = FastValueBuilderFactory::get().copy(*rhs._tensor);
}
}
@@ -78,7 +78,7 @@ TensorFieldValue::operator=(const TensorFieldValue &rhs)
if (&_dataType == &rhs._dataType || !rhs._tensor ||
_dataType.isAssignableType(rhs._tensor->type())) {
if (rhs._tensor) {
- _tensor = EngineOrFactory::get().copy(*rhs._tensor);
+ _tensor = FastValueBuilderFactory::get().copy(*rhs._tensor);
} else {
_tensor.reset();
}
@@ -109,7 +109,7 @@ TensorFieldValue::make_empty_if_not_existing()
{
if (!_tensor) {
TensorSpec empty_spec(_dataType.getTensorType().to_spec());
- _tensor = EngineOrFactory::get().from_spec(empty_spec);
+ _tensor = value_from_spec(empty_spec, FastValueBuilderFactory::get());
}
}
diff --git a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp
index eaa5a484ad1..6567b8cb6b5 100644
--- a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp
+++ b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp
@@ -22,7 +22,8 @@
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/backtrace.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/value.h>
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/document/base/exceptions.h>
@@ -41,7 +42,7 @@ using vespalib::nbostream;
using vespalib::Memory;
using vespalib::stringref;
using vespalib::compression::CompressionConfig;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
namespace document {
@@ -372,7 +373,7 @@ VespaDocumentDeserializer::readTensor()
std::unique_ptr<vespalib::eval::Value> tensor;
if (length != 0) {
nbostream wrapStream(_stream.peek(), length);
- tensor = EngineOrFactory::get().decode(wrapStream);
+ tensor = vespalib::eval::decode_value(wrapStream, FastValueBuilderFactory::get());
if (wrapStream.size() != 0) {
throw DeserializeException("Leftover bytes deserializing tensor field value.", VESPA_STRLOC);
}
diff --git a/document/src/vespa/document/update/tensor_add_update.cpp b/document/src/vespa/document/update/tensor_add_update.cpp
index d71ab7d922c..c9ffad2a789 100644
--- a/document/src/vespa/document/update/tensor_add_update.cpp
+++ b/document/src/vespa/document/update/tensor_add_update.cpp
@@ -9,7 +9,7 @@
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/eval/eval/value.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/tensor/partial_update.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/stllike/asciistream.h>
@@ -20,7 +20,7 @@
using vespalib::IllegalArgumentException;
using vespalib::IllegalStateException;
using vespalib::make_string;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::tensor::TensorPartialUpdate;
namespace document {
@@ -86,8 +86,8 @@ TensorAddUpdate::applyTo(const vespalib::eval::Value &tensor) const
{
auto addTensor = _tensor->getAsTensorPtr();
if (addTensor) {
- auto engine = EngineOrFactory::get();
- return TensorPartialUpdate::add(tensor, *addTensor, engine);
+ const auto &factory = FastValueBuilderFactory::get();
+ return TensorPartialUpdate::add(tensor, *addTensor, factory);
}
return {};
}
diff --git a/document/src/vespa/document/update/tensor_modify_update.cpp b/document/src/vespa/document/update/tensor_modify_update.cpp
index 970550b7c88..4da93d0ae46 100644
--- a/document/src/vespa/document/update/tensor_modify_update.cpp
+++ b/document/src/vespa/document/update/tensor_modify_update.cpp
@@ -10,7 +10,7 @@
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/eval/eval/operation.h>
#include <vespa/eval/eval/value.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/tensor/partial_update.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/stllike/asciistream.h>
@@ -22,7 +22,7 @@ using vespalib::IllegalArgumentException;
using vespalib::IllegalStateException;
using vespalib::make_string;
using vespalib::eval::ValueType;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::tensor::TensorPartialUpdate;
using join_fun_t = double (*)(double, double);
@@ -163,8 +163,8 @@ TensorModifyUpdate::applyTo(const vespalib::eval::Value &tensor) const
{
auto cellsTensor = _tensor->getAsTensorPtr();
if (cellsTensor) {
- auto engine = EngineOrFactory::get();
- return TensorPartialUpdate::modify(tensor, getJoinFunction(_operation), *cellsTensor, engine);
+ const auto &factory = FastValueBuilderFactory::get();
+ return TensorPartialUpdate::modify(tensor, getJoinFunction(_operation), *cellsTensor, factory);
}
return {};
}
@@ -213,8 +213,7 @@ verifyCellsTensorIsSparse(const vespalib::eval::Value *cellsTensor)
if (cellsTensor == nullptr) {
return;
}
- auto engine = EngineOrFactory::get();
- if (TensorPartialUpdate::check_suitably_sparse(*cellsTensor, engine)) {
+ if (cellsTensor->type().is_sparse()) {
return;
}
vespalib::string err = make_string("Expected cells tensor to be sparse, but has type '%s'",
diff --git a/document/src/vespa/document/update/tensor_remove_update.cpp b/document/src/vespa/document/update/tensor_remove_update.cpp
index f04728e95a4..7b81581aeed 100644
--- a/document/src/vespa/document/update/tensor_remove_update.cpp
+++ b/document/src/vespa/document/update/tensor_remove_update.cpp
@@ -6,7 +6,7 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/fieldvalue/tensorfieldvalue.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/tensor/partial_update.h>
#include <vespa/eval/eval/value.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -19,7 +19,7 @@ using vespalib::IllegalStateException;
using vespalib::make_string;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::tensor::TensorPartialUpdate;
namespace document {
@@ -110,8 +110,8 @@ TensorRemoveUpdate::applyTo(const vespalib::eval::Value &tensor) const
{
auto addressTensor = _tensor->getAsTensorPtr();
if (addressTensor) {
- auto engine = EngineOrFactory::get();
- return TensorPartialUpdate::remove(tensor, *addressTensor, engine);
+ const auto &factory = FastValueBuilderFactory::get();
+ return TensorPartialUpdate::remove(tensor, *addressTensor, factory);
}
return {};
}
@@ -160,8 +160,7 @@ verifyAddressTensorIsSparse(const Value *addressTensor)
if (addressTensor == nullptr) {
throw IllegalStateException("Address tensor is not set", VESPA_STRLOC);
}
- auto engine = EngineOrFactory::get();
- if (TensorPartialUpdate::check_suitably_sparse(*addressTensor, engine)) {
+ if (addressTensor->type().is_sparse()) {
return;
}
auto err = make_string("Expected address tensor to be sparse, but has type '%s'",