summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--document/src/vespa/document/select/valuenodes.h1
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/basictype.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp80
-rw-r--r--searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/numericbase.h8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h5
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.h1
8 files changed, 52 insertions, 57 deletions
diff --git a/document/src/vespa/document/select/valuenodes.h b/document/src/vespa/document/select/valuenodes.h
index fa592055477..8009542c364 100644
--- a/document/src/vespa/document/select/valuenodes.h
+++ b/document/src/vespa/document/select/valuenodes.h
@@ -6,7 +6,6 @@
#include <vespa/document/base/fieldpath.h>
namespace document {
- class BucketDistribution;
class BucketIdFactory;
class DocumentId;
class BucketId;
diff --git a/searchcommon/src/vespa/searchcommon/attribute/basictype.h b/searchcommon/src/vespa/searchcommon/attribute/basictype.h
index 9be26b0816b..926246c7029 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/basictype.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/basictype.h
@@ -34,7 +34,6 @@ class BasicType
Type type() const { return _type; }
const char * asString() const { return asString(_type); }
- bool isUnsigned() const { return isUnsigned(_type); }
size_t fixedSize() const { return fixedSize(_type); }
static BasicType fromType(bool) { return BOOL; }
static BasicType fromType(int8_t) { return INT8; }
@@ -48,7 +47,6 @@ class BasicType
private:
static const char * asString(Type t) { return _typeTable[t]._name; }
- static bool isUnsigned(Type t) { return _typeTable[t]._name[0] == 'u'; }
static size_t fixedSize(Type t) { return _typeTable[t]._fixedSize; }
static Type asType(const vespalib::string & t);
diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp
index 21789364442..ab3b0588f3f 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp
@@ -4,6 +4,7 @@
#include "selectcontext.h"
#include <vespa/searchcommon/attribute/attributecontent.h>
#include <vespa/searchlib/attribute/attributevector.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.common.attribute_field_value_node");
@@ -23,6 +24,9 @@ using search::attribute::AttributeContent;
using search::attribute::BasicType;
using search::attribute::CollectionType;
using search::attribute::IAttributeVector;
+using vespalib::IllegalArgumentException;
+using vespalib::IllegalStateException;
+using vespalib::make_string;
AttributeFieldValueNode::
AttributeFieldValueNode(const vespalib::string& doctype,
@@ -47,51 +51,53 @@ getValue(const Context &context) const
assert(docId != 0u);
const AttributeVector &v(*_attribute);
if (v.isUndefined(docId)) {
- return Value::UP(new NullValue);
+ return std::make_unique<NullValue>();
}
switch (v.getBasicType()) {
- case BasicType::STRING:
- do {
- AttributeContent<const char *> content;
- content.fill(v, docId);
- assert(content.size() == 1u);
- return Value::UP(new StringValue(content[0]));
- } while (0);
- break;
- case BasicType::BOOL:
- case BasicType::UINT2:
- case BasicType::UINT4:
- case BasicType::INT8:
- case BasicType::INT16:
- case BasicType::INT32:
- case BasicType::INT64:
- do {
- AttributeContent<IAttributeVector::largeint_t> content;
- content.fill(v, docId);
- assert(content.size() == 1u);
- return Value::UP(new IntegerValue(content[0], false));
- } while (0);
- break;
- case BasicType::FLOAT:
- case BasicType::DOUBLE:
- do {
- AttributeContent<double> content;
- content.fill(v, docId);
- assert(content.size() == 1u);
- return Value::UP(new FloatValue(content[0]));
- } while (0);
- break;
- default:
- LOG_ABORT("should not be reached");
+ case BasicType::STRING:
+ {
+ AttributeContent<const char *> content;
+ content.fill(v, docId);
+ assert(content.size() == 1u);
+ return std::make_unique<StringValue>(content[0]);
+ };
+ case BasicType::BOOL:
+ case BasicType::UINT2:
+ case BasicType::UINT4:
+ case BasicType::INT8:
+ case BasicType::INT16:
+ case BasicType::INT32:
+ case BasicType::INT64:
+ {
+ AttributeContent<IAttributeVector::largeint_t> content;
+ content.fill(v, docId);
+ assert(content.size() == 1u);
+ return std::make_unique<IntegerValue>(content[0], false);
+ }
+ case BasicType::FLOAT:
+ case BasicType::DOUBLE:
+ {
+ AttributeContent<double> content;
+ content.fill(v, docId);
+ assert(content.size() == 1u);
+ return std::make_unique<FloatValue>(content[0]);
+ };
+ case BasicType::NONE:
+ case BasicType::PREDICATE:
+ case BasicType::TENSOR:
+ case BasicType::REFERENCE:
+ throw new IllegalArgumentException(make_string("Attribute '%s' of type '%s' can not be used for selection",
+ v.getName().c_str(), v.getInternalBasicType().asString()));
+ case BasicType::MAX_TYPE:
+ throw new IllegalStateException(make_string("Attribute '%s' has illegal type '%d'", v.getName().c_str(), v.getBasicType()));
}
- return Value::UP();
+ return std::make_unique<NullValue>();;
}
std::unique_ptr<Value>
-AttributeFieldValueNode::traceValue(const Context &context,
- std::ostream& out) const
+AttributeFieldValueNode::traceValue(const Context &context, std::ostream& out) const
{
return defaultTrace(getValue(context), out);
}
diff --git a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp
index 4a7491130f4..d679319924d 100644
--- a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp
+++ b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp
@@ -1,15 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("enum_comparator_test");
#include <vespa/searchlib/attribute/enumcomparator.h>
#include <vespa/vespalib/btree/btreeroot.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/searchlib/attribute/enumstore.hpp>
-#include <vespa/vespalib/btree/btreenode.hpp>
-#include <vespa/vespalib/btree/btreenodeallocator.hpp>
-#include <vespa/vespalib/btree/btreeroot.hpp>
+
+#include <vespa/log/log.h>
+LOG_SETUP("enum_comparator_test");
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/numericbase.h b/searchlib/src/vespa/searchlib/attribute/numericbase.h
index 87cccfec185..67be41fe98a 100644
--- a/searchlib/src/vespa/searchlib/attribute/numericbase.h
+++ b/searchlib/src/vespa/searchlib/attribute/numericbase.h
@@ -65,7 +65,7 @@ protected:
template <typename BaseType>
search::Range<BaseType>
- cappedRange(bool isFloat, bool isUnsigned)
+ cappedRange(bool isFloat)
{
BaseType low = static_cast<BaseType>(_low);
BaseType high = static_cast<BaseType>(_high);
@@ -79,11 +79,7 @@ protected:
}
} else {
if (_low <= (numMin)) {
- if (isUnsigned) {
- low = numMin;
- } else {
- low = numMin + 1; // we must avoid the undefined value
- }
+ low = numMin + 1; // we must avoid the undefined value
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
index 78778e8085a..68b9ae5da7b 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
@@ -6,11 +6,11 @@
#include "postinglisttraits.h"
#include "postingstore.h"
#include "ipostinglistsearchcontext.h"
+#include "posting_list_merger.h"
#include <vespa/searchcommon/attribute/search_context_params.h>
#include <vespa/searchcommon/common/range.h>
#include <vespa/vespalib/util/regexp.h>
#include <regex>
-#include "posting_list_merger.h"
namespace search::attribute {
@@ -337,8 +337,7 @@ getIterators(bool shouldApplyRangeLimit)
bool isFloat =
_toBeSearched.getBasicType() == BasicType::FLOAT ||
_toBeSearched.getBasicType() == BasicType::DOUBLE;
- bool isUnsigned = _toBeSearched.getInternalBasicType().isUnsigned();
- search::Range<BaseType> capped = this->template cappedRange<BaseType>(isFloat, isUnsigned);
+ search::Range<BaseType> capped = this->template cappedRange<BaseType>(isFloat);
auto compLow = _enumStore.make_comparator(capped.lower());
auto compHigh = _enumStore.make_comparator(capped.upper());
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
index 9444cee975d..4dfc52304ac 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
@@ -1,8 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "btreeiterator.h"
-#include "btreeroot.h"
-#include "btreenodeallocator.h"
#include "btreeiterator.hpp"
#include "btreenode.hpp"
@@ -10,6 +7,7 @@ namespace search::btree {
template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>;
template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>;
+template class BTreeIteratorBase<datastore::EntryRef, BTreeNoLeafData, NoAggregated>;
template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>;
template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>;
template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.h b/vespalib/src/vespa/vespalib/btree/btreeiterator.h
index 7c247cd01da..e3ad2147346 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.h
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.h
@@ -870,6 +870,7 @@ private:
extern template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>;
+extern template class BTreeIteratorBase<datastore::EntryRef, BTreeNoLeafData, NoAggregated>;
extern template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>;
extern template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>;