From cfeefa8456632146b99c8133e8321523ce261840 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Fri, 27 Nov 2020 11:44:30 +0000 Subject: remove superfluous include --- document/src/vespa/document/update/tensor_add_update.cpp | 1 - document/src/vespa/document/update/tensor_modify_update.cpp | 2 -- document/src/vespa/document/update/tensor_remove_update.cpp | 3 --- 3 files changed, 6 deletions(-) (limited to 'document') diff --git a/document/src/vespa/document/update/tensor_add_update.cpp b/document/src/vespa/document/update/tensor_add_update.cpp index 3ae599f22a0..d71ab7d922c 100644 --- a/document/src/vespa/document/update/tensor_add_update.cpp +++ b/document/src/vespa/document/update/tensor_add_update.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/document/src/vespa/document/update/tensor_modify_update.cpp b/document/src/vespa/document/update/tensor_modify_update.cpp index 2ff45b11b07..970550b7c88 100644 --- a/document/src/vespa/document/update/tensor_modify_update.cpp +++ b/document/src/vespa/document/update/tensor_modify_update.cpp @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/document/src/vespa/document/update/tensor_remove_update.cpp b/document/src/vespa/document/update/tensor_remove_update.cpp index 688f9cf5399..f04728e95a4 100644 --- a/document/src/vespa/document/update/tensor_remove_update.cpp +++ b/document/src/vespa/document/update/tensor_remove_update.cpp @@ -8,9 +8,6 @@ #include #include #include -#include -#include -#include #include #include #include -- cgit v1.2.3 From 5f7755b688fedbec191a06ce3c4c3d6cfb685c14 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Fri, 27 Nov 2020 11:44:10 +0000 Subject: use factory.from_spec() instead of tensor::makeTensor --- .../tensor_fieldvalue/tensor_fieldvalue_test.cpp | 7 +-- .../documentdb/feedhandler/feedhandler_test.cpp | 13 ++--- .../tests/proton/server/documentretriever_test.cpp | 7 +-- .../src/tests/features/tensor/tensor_test.cpp | 58 +++++++++++----------- 4 files changed, 42 insertions(+), 43 deletions(-) (limited to 'document') diff --git a/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp b/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp index 231fba93d10..067cf4ac649 100644 --- a/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp +++ b/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp @@ -9,16 +9,13 @@ LOG_SETUP("fieldvalue_test"); #include #include #include -#include #include using namespace document; -using namespace vespalib::tensor; using vespalib::eval::TensorSpec; using vespalib::eval::ValueType; using vespalib::eval::EngineOrFactory; -using vespalib::tensor::test::makeTensor; namespace { @@ -33,8 +30,8 @@ vespalib::eval::Value::UP createTensor(const TensorSpec &spec) { std::unique_ptr makeSimpleTensor() { - return makeTensor(TensorSpec("tensor(x{},y{})"). - add({{"x", "4"}, {"y", "5"}}, 7)); + return EngineOrFactory::get().from_spec(TensorSpec("tensor(x{},y{})"). + add({{"x", "4"}, {"y", "5"}}, 7)); } FieldValue::UP clone(FieldValue &fv) { diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index c28a099a990..ed3bb3253c9 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -5,8 +5,9 @@ #include #include #include +#include +#include #include -#include #include #include #include @@ -57,10 +58,10 @@ using storage::spi::UpdateResult; using vespalib::ThreadStackExecutor; using vespalib::ThreadStackExecutorBase; using vespalib::makeClosure; +using vespalib::eval::EngineOrFactory; using vespalib::eval::TensorSpec; using vespalib::eval::Value; using vespalib::eval::ValueType; -using vespalib::tensor::test::makeTensor; using namespace proton; using namespace search::index; @@ -329,13 +330,13 @@ struct UpdateContext { auto fieldValue = field.createValue(); if (fieldName == "tensor") { dynamic_cast(*fieldValue) = - makeTensor(TensorSpec("tensor(x{},y{})"). - add({{"x","8"},{"y","9"}}, 11)); + EngineOrFactory::get().from_spec(TensorSpec("tensor(x{},y{})"). + add({{"x","8"},{"y","9"}}, 11)); } else if (fieldName == "tensor2") { auto tensorFieldValue = std::make_unique(tensor1DType); *tensorFieldValue = - makeTensor(TensorSpec("tensor(x{})"). - add({{"x","8"}}, 11)); + EngineOrFactory::get().from_spec(TensorSpec("tensor(x{})"). + add({{"x","8"}}, 11)); fieldValue = std::move(tensorFieldValue); } else { fieldValue->assign(document::StringFieldValue("new value")); diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index b93f90b3317..019e1bce40a 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -92,7 +92,6 @@ using vespalib::eval::EngineOrFactory; using vespalib::eval::TensorSpec; using vespalib::eval::ValueType; using vespalib::eval::Value; -using vespalib::eval::test::makeTensor; using namespace document::config_builder; using namespace search::index; @@ -111,8 +110,10 @@ const char dyn_field_nas[] = "dynamic null attr string field"; // in document, n const char position_field[] = "position_field"; vespalib::string dyn_field_tensor("dynamic_tensor_field"); vespalib::string tensor_spec("tensor(x{})"); -std::unique_ptr static_tensor = makeTensor(TensorSpec(tensor_spec).add({{"x", "1"}}, 1.5)); -std::unique_ptr dynamic_tensor = makeTensor(TensorSpec(tensor_spec).add({{"x", "2"}}, 3.5)); +std::unique_ptr static_tensor = + EngineOrFactory::get().from_spec(TensorSpec(tensor_spec).add({{"x", "1"}}, 1.5)); +std::unique_ptr dynamic_tensor = + EngineOrFactory::get().from_spec(TensorSpec(tensor_spec).add({{"x", "2"}}, 3.5)); const char zcurve_field[] = "position_field_zcurve"; const char position_array_field[] = "position_array"; const char zcurve_array_field[] = "position_array_zcurve"; diff --git a/searchlib/src/tests/features/tensor/tensor_test.cpp b/searchlib/src/tests/features/tensor/tensor_test.cpp index 116b4ed2bb5..188a1347901 100644 --- a/searchlib/src/tests/features/tensor/tensor_test.cpp +++ b/searchlib/src/tests/features/tensor/tensor_test.cpp @@ -15,8 +15,8 @@ #include #include #include +#include #include -#include #include using search::feature_t; @@ -30,10 +30,10 @@ using search::tensor::DirectTensorAttribute; using search::AttributeVector; using vespalib::eval::EngineOrFactory; using vespalib::eval::Function; +using vespalib::eval::spec_from_value; using vespalib::eval::Value; using vespalib::eval::ValueType; using vespalib::eval::TensorSpec; -using vespalib::tensor::test::makeTensor; using AVC = search::attribute::Config; using AVBT = search::attribute::BasicType; @@ -113,10 +113,10 @@ struct ExecFixture DirectTensorAttribute *directAttr = dynamic_cast(attrs[1].get()); - auto doc_tensor = makeTensor(TensorSpec("tensor(x{})") - .add({{"x", "a"}}, 3) - .add({{"x", "b"}}, 5) - .add({{"x", "c"}}, 7)); + auto doc_tensor = EngineOrFactory::get().from_spec(TensorSpec("tensor(x{})") + .add({{"x", "a"}}, 3) + .add({{"x", "b"}}, 5) + .add({{"x", "c"}}, 7)); tensorAttr->setTensor(1, *doc_tensor); directAttr->set_tensor(1, std::move(doc_tensor)); @@ -138,16 +138,16 @@ struct ExecFixture void setupQueryEnvironment() { setQueryTensor("tensorquery", "tensor(q{})", - makeTensor(TensorSpec("tensor(q{})") - .add({{"q", "d"}}, 11 ) - .add({{"q", "e"}}, 13 ) - .add({{"q", "f"}}, 17 ))); + EngineOrFactory::get().from_spec(TensorSpec("tensor(q{})") + .add({{"q", "d"}}, 11 ) + .add({{"q", "e"}}, 13 ) + .add({{"q", "f"}}, 17 ))); setQueryTensor("mappedtensorquery", "tensor(x[2])", - makeTensor(TensorSpec("tensor(x{},y{})") - .add({{"x", "0"},{"y", "0"}}, 11 ) - .add({{"x", "0"},{"y", "1"}}, 13 ) - .add({{"x", "1"},{"y", "0"}}, 17 ))); + EngineOrFactory::get().from_spec(TensorSpec("tensor(x{},y{})") + .add({{"x", "0"},{"y", "0"}}, 11 ) + .add({{"x", "0"},{"y", "1"}}, 13 ) + .add({{"x", "1"},{"y", "0"}}, 17 ))); setQueryTensorType("null", "tensor(q{})"); } const Value &extractTensor(uint32_t docid) { @@ -163,28 +163,28 @@ struct ExecFixture TEST_F("require that tensor attribute can be extracted as tensor in attribute feature", ExecFixture("attribute(tensorattr)")) { - EXPECT_EQUAL(*makeTensor(TensorSpec("tensor(x{})") - .add({{"x", "b"}}, 5) - .add({{"x", "c"}}, 7) - .add({{"x", "a"}}, 3)), f.execute()); + EXPECT_EQUAL(TensorSpec("tensor(x{})") + .add({{"x", "b"}}, 5) + .add({{"x", "c"}}, 7) + .add({{"x", "a"}}, 3), spec_from_value(f.execute())); } TEST_F("require that direct tensor attribute can be extracted in attribute feature", ExecFixture("attribute(directattr)")) { - EXPECT_EQUAL(*makeTensor(TensorSpec("tensor(x{})") - .add({{"x", "b"}}, 5) - .add({{"x", "c"}}, 7) - .add({{"x", "a"}}, 3)), f.execute()); + EXPECT_EQUAL(TensorSpec("tensor(x{})") + .add({{"x", "b"}}, 5) + .add({{"x", "c"}}, 7) + .add({{"x", "a"}}, 3), spec_from_value(f.execute())); } TEST_F("require that tensor from query can be extracted as tensor in query feature", ExecFixture("query(tensorquery)")) { - EXPECT_EQUAL(*makeTensor(TensorSpec("tensor(q{})") - .add({{"q", "f"}}, 17) - .add({{"q", "d"}}, 11) - .add({{"q", "e"}}, 13)), f.execute()); + EXPECT_EQUAL(TensorSpec("tensor(q{})") + .add({{"q", "f"}}, 17) + .add({{"q", "d"}}, 11) + .add({{"q", "e"}}, 13), spec_from_value(f.execute())); } TEST_F("require that empty tensor is created if attribute does not exists", @@ -217,9 +217,9 @@ TEST_F("require that empty tensor with correct type is returned by direct tensor TEST_F("require that wrong tensor type from query tensor gives empty tensor", ExecFixture("query(mappedtensorquery)")) { - EXPECT_EQUAL(*makeTensor(TensorSpec("tensor(x[2])") - .add({{"x", 0}}, 0) - .add({{"x", 1}}, 0)), f.execute()); + EXPECT_EQUAL(TensorSpec("tensor(x[2])") + .add({{"x", 0}}, 0) + .add({{"x", 1}}, 0), spec_from_value(f.execute())); } TEST_MAIN() { TEST_RUN_ALL(); } -- cgit v1.2.3