summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2016-09-15 09:28:36 +0200
committerGeir Storli <geirst@yahoo-inc.com>2016-09-15 09:28:36 +0200
commit0d15262410021732ea150f057cf3213751db4d98 (patch)
tree93c2eb27d171dd2aa274670ee15c812a92e5eff1 /searchcommon
parent6f3115944901cc50c604f6b165724958dddb51f2 (diff)
Change to use eval::ValueType instead of tensor::TensorType.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/tests/attribute/config/attribute_config_test.cpp25
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/config.cpp4
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/config.h8
3 files changed, 18 insertions, 19 deletions
diff --git a/searchcommon/src/tests/attribute/config/attribute_config_test.cpp b/searchcommon/src/tests/attribute/config/attribute_config_test.cpp
index 3a7994ee39b..50522aae3b9 100644
--- a/searchcommon/src/tests/attribute/config/attribute_config_test.cpp
+++ b/searchcommon/src/tests/attribute/config/attribute_config_test.cpp
@@ -7,7 +7,7 @@
using search::attribute::Config;
using search::attribute::BasicType;
using search::attribute::CollectionType;
-using vespalib::tensor::TensorType;
+using vespalib::eval::ValueType;
struct Fixture
@@ -38,7 +38,7 @@ TEST_F("test default attribute config", Fixture)
EXPECT_TRUE(!f._config.getEnableOnlyBitVector());
EXPECT_TRUE(!f._config.getIsFilter());
EXPECT_TRUE(!f._config.fastAccess());
- EXPECT_TRUE(!f._config.tensorType().is_valid());
+ EXPECT_TRUE(f._config.tensorType().is_error());
}
TEST_F("test integer weightedset attribute config",
@@ -54,7 +54,7 @@ TEST_F("test integer weightedset attribute config",
EXPECT_TRUE(!f._config.getEnableOnlyBitVector());
EXPECT_TRUE(!f._config.getIsFilter());
EXPECT_TRUE(!f._config.fastAccess());
- EXPECT_TRUE(!f._config.tensorType().is_valid());
+ EXPECT_TRUE(f._config.tensorType().is_error());
}
@@ -76,21 +76,20 @@ TEST("test operator== on attribute config for tensor type")
Config cfg2(BasicType::Type::TENSOR);
Config cfg3(BasicType::Type::TENSOR);
- TensorType dense_x = TensorType::fromSpec("tensor(x[10])");
- TensorType sparse_x = TensorType::fromSpec("tensor(x{})");
+ ValueType dense_x = ValueType::from_spec("tensor(x[10])");
+ ValueType sparse_x = ValueType::from_spec("tensor(x{})");
- // invalid tensors are not equal
- EXPECT_TRUE(cfg1 != cfg2);
- EXPECT_TRUE(cfg2 != cfg3);
- EXPECT_TRUE(cfg1 != cfg3);
+ EXPECT_TRUE(cfg1 == cfg2);
+ EXPECT_TRUE(cfg2 == cfg3);
+ EXPECT_TRUE(cfg1 == cfg3);
cfg1.setTensorType(dense_x);
cfg3.setTensorType(dense_x);
EXPECT_EQUAL(dense_x, cfg1.tensorType());
EXPECT_EQUAL(dense_x, cfg3.tensorType());
- EXPECT_TRUE(cfg1.tensorType().is_valid());
- EXPECT_TRUE(!cfg2.tensorType().is_valid());
- EXPECT_TRUE(cfg3.tensorType().is_valid());
+ EXPECT_TRUE(!cfg1.tensorType().is_error());
+ EXPECT_TRUE(cfg2.tensorType().is_error());
+ EXPECT_TRUE(!cfg3.tensorType().is_error());
EXPECT_TRUE(cfg1 != cfg2);
EXPECT_TRUE(cfg2 != cfg3);
@@ -98,7 +97,7 @@ TEST("test operator== on attribute config for tensor type")
cfg3.setTensorType(sparse_x);
EXPECT_EQUAL(sparse_x, cfg3.tensorType());
- EXPECT_TRUE(cfg3.tensorType().is_valid());
+ EXPECT_TRUE(!cfg3.tensorType().is_error());
EXPECT_TRUE(cfg1 != cfg3);
}
diff --git a/searchcommon/src/vespa/searchcommon/attribute/config.cpp b/searchcommon/src/vespa/searchcommon/attribute/config.cpp
index e160d7b9222..17f758770be 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/config.cpp
+++ b/searchcommon/src/vespa/searchcommon/attribute/config.cpp
@@ -21,7 +21,7 @@ Config::Config() :
_lower_bound(LLONG_MIN),
_upper_bound(LLONG_MAX),
_dense_posting_list_threshold(0.4),
- _tensorType(vespalib::tensor::TensorType::invalid())
+ _tensorType(vespalib::eval::ValueType::error_type())
{
}
@@ -42,7 +42,7 @@ Config::Config(BasicType bt,
_lower_bound(LLONG_MIN),
_upper_bound(LLONG_MAX),
_dense_posting_list_threshold(0.4),
- _tensorType(vespalib::tensor::TensorType::invalid())
+ _tensorType(vespalib::eval::ValueType::error_type())
{
}
diff --git a/searchcommon/src/vespa/searchcommon/attribute/config.h b/searchcommon/src/vespa/searchcommon/attribute/config.h
index dee684763a0..b346799b2ea 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/config.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/config.h
@@ -5,7 +5,7 @@
#include <vespa/searchcommon/attribute/basictype.h>
#include <vespa/searchcommon/attribute/collectiontype.h>
#include <vespa/searchcommon/common/growstrategy.h>
-#include <vespa/vespalib/tensor/tensor_type.h>
+#include <vespa/vespalib/eval/value_type.h>
namespace search {
namespace attribute {
@@ -31,7 +31,7 @@ public:
int64_t lower_bound() const { return _lower_bound; }
int64_t upper_bound() const { return _upper_bound; }
double dense_posting_list_threshold() const { return _dense_posting_list_threshold; }
- vespalib::tensor::TensorType tensorType() const { return _tensorType; }
+ vespalib::eval::ValueType tensorType() const { return _tensorType; }
/**
* Check if attribute posting list can consist of a bitvector in
@@ -73,7 +73,7 @@ public:
void setBounds(int64_t lower, int64_t upper) { _lower_bound = lower;
_upper_bound = upper; }
void setDensePostingListThreshold(double v) { _dense_posting_list_threshold = v; }
- void setTensorType(const vespalib::tensor::TensorType &tensorType_in) {
+ void setTensorType(const vespalib::eval::ValueType &tensorType_in) {
_tensorType = tensorType_in;
}
@@ -148,7 +148,7 @@ private:
int64_t _lower_bound;
int64_t _upper_bound;
double _dense_posting_list_threshold;
- vespalib::tensor::TensorType _tensorType;
+ vespalib::eval::ValueType _tensorType;
};
} // namespace attribute
} // namespace search