From 43c2145f1bfab0f2d5d5b3b3999bc7c99c2d62dd Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 14 Jan 2019 13:26:53 +0000 Subject: Handle bool in grouping in the backend too. --- searchlib/src/tests/aggregator/perdocexpr.cpp | 30 +++++- .../searchlib/attribute/singleboolattribute.h | 7 ++ .../src/vespa/searchlib/common/identifiable.h | 3 + .../vespa/searchlib/expression/attributenode.cpp | 9 +- .../searchlib/expression/documentfieldnode.cpp | 12 +-- .../vespa/searchlib/expression/documentfieldnode.h | 12 +-- .../vespa/searchlib/expression/expressiontree.cpp | 4 +- .../vespa/searchlib/expression/integerresultnode.h | 16 ++- .../searchlib/expression/numericfunctionnode.cpp | 4 +- .../searchlib/expression/numericfunctionnode.h | 4 +- .../src/vespa/searchlib/expression/resultnode.h | 4 +- .../src/vespa/searchlib/expression/resultnodes.cpp | 120 +++++++++++++-------- .../vespa/searchlib/expression/resultvector.cpp | 5 +- .../src/vespa/searchlib/expression/resultvector.h | 15 ++- 14 files changed, 162 insertions(+), 83 deletions(-) (limited to 'searchlib/src') diff --git a/searchlib/src/tests/aggregator/perdocexpr.cpp b/searchlib/src/tests/aggregator/perdocexpr.cpp index 25bbd16de07..66d2e48194d 100644 --- a/searchlib/src/tests/aggregator/perdocexpr.cpp +++ b/searchlib/src/tests/aggregator/perdocexpr.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -1534,12 +1535,37 @@ AttributeGuard createInt8Attribute() { return attr1; } +AttributeGuard createBoolAttribute() { + SingleBoolAttribute *selectAttr1(new SingleBoolAttribute("selectAttr1", search::GrowStrategy())); + DocId docId(0); + selectAttr1->addDoc(docId); + selectAttr1->setBit(docId, true); + selectAttr1->addDoc(docId); + selectAttr1->setBit(docId, false); + selectAttr1->addDoc(docId); + selectAttr1->addDoc(docId); + selectAttr1->setBit(docId, true); + selectAttr1->addDoc(docId); + selectAttr1->setBit(docId, true); + + + AttributeVector::SP spSelectAttr1(selectAttr1); + AttributeGuard attr1( spSelectAttr1 ); + return attr1; +} + TEST("testIntegerTypes") { - EXPECT_EQUAL(AttributeNode(*createInt8Attribute()).prepare(false) + EXPECT_EQUAL(AttributeNode(*createBoolAttribute()).prepare(false) .getResult().getClass().id(), + uint32_t(BoolResultNode::classId)); + EXPECT_EQUAL(AttributeNode(*createBoolAttribute()) + .prepare(true).getResult().getClass().id(), + uint32_t(BoolResultNode::classId)); + EXPECT_EQUAL(AttributeNode(*createInt8Attribute()).prepare(false) + .getResult().getClass().id(), uint32_t(Int64ResultNode::classId)); EXPECT_EQUAL(AttributeNode(*createInt8Attribute()) - .prepare(true).getResult().getClass().id(), + .prepare(true).getResult().getClass().id(), uint32_t(Int8ResultNode::classId)); EXPECT_EQUAL(AttributeNode(*createInt16Attribute()) .prepare(false).getResult().getClass().id(), diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h index c10940574e6..789948838cb 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h @@ -89,6 +89,13 @@ public: return getFast(doc); } const BitVector & getBitVector() const { return _bv; } + void setBit(DocId doc, bool value) { + if (value) { + _bv.setBit(doc); + } else { + _bv.clearBit(doc); + } + } protected: bool findEnum(int8_t, EnumHandle &) const override { return false; diff --git a/searchlib/src/vespa/searchlib/common/identifiable.h b/searchlib/src/vespa/searchlib/common/identifiable.h index 35e49b5cddf..adab458378b 100644 --- a/searchlib/src/vespa/searchlib/common/identifiable.h +++ b/searchlib/src/vespa/searchlib/common/identifiable.h @@ -149,6 +149,9 @@ #define CID_search_expression_NormalizeSubjectFunctionNode SEARCHLIB_CID(143) #define CID_search_expression_DebugWaitFunctionNode SEARCHLIB_CID(144) #define CID_search_expression_AttributeMapLookupNode SEARCHLIB_CID(145) +#define CID_search_expression_BoolResultNode SEARCHLIB_CID(146) +#define CID_search_expression_BoolResultNodeVector SEARCHLIB_CID(147) + #define CID_search_QueryNode SEARCHLIB_CID(150) #define CID_search_Query SEARCHLIB_CID(151) diff --git a/searchlib/src/vespa/searchlib/expression/attributenode.cpp b/searchlib/src/vespa/searchlib/expression/attributenode.cpp index 704000b7a04..94b24808e74 100644 --- a/searchlib/src/vespa/searchlib/expression/attributenode.cpp +++ b/searchlib/src/vespa/searchlib/expression/attributenode.cpp @@ -140,7 +140,10 @@ void AttributeNode::onPrepare(bool preserveAccurateTypes) BasicType::Type basicType = attribute->getBasicType(); if (attribute->isIntegerType()) { if (_hasMultiValue) { - if (preserveAccurateTypes) { + if (basicType == BasicType::BOOL) { + setResultType(std::make_unique()); + _handler = std::make_unique>(updateResult()); + } else if (preserveAccurateTypes) { switch (basicType) { case BasicType::INT8: setResultType(std::make_unique()); @@ -167,7 +170,9 @@ void AttributeNode::onPrepare(bool preserveAccurateTypes) _handler = std::make_unique>(updateResult()); } } else { - if (preserveAccurateTypes) { + if (basicType == BasicType::BOOL) { + setResultType(std::make_unique()); + } else if (preserveAccurateTypes) { switch (basicType) { case BasicType::INT8: setResultType(std::make_unique()); diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp index b0884d51db9..9ca49107079 100644 --- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp @@ -10,8 +10,7 @@ #include LOG_SETUP(".searchlib.documentfieldnode"); -namespace search { -namespace expression { +namespace search::expression { using namespace vespalib; using namespace document; @@ -23,9 +22,7 @@ IMPLEMENT_EXPRESSIONNODE(GetDocIdNamespaceSpecificFunctionNode, DocumentAccessor const vespalib::string DocumentAccessorNode::_S_docId("documentid"); -DocumentFieldNode::~DocumentFieldNode() -{ -} +DocumentFieldNode::~DocumentFieldNode() = default; DocumentFieldNode::DocumentFieldNode(const DocumentFieldNode & rhs) : DocumentAccessorNode(rhs), @@ -67,6 +64,8 @@ deduceResultNode(vespalib::stringref fieldName, const FieldValue & fv, bool pres } } else if (cInfo.inherits(FloatFieldValue::classId) || cInfo.inherits(DoubleFieldValue::classId)) { value.reset(nestedMultiValue ? static_cast(new FloatResultNodeVector()) : static_cast(new FloatResultNode())); + } else if (cInfo.inherits(BoolFieldValue::classId)) { + value.reset(nestedMultiValue ? static_cast(new BoolResultNodeVector()) : static_cast(new BoolResultNode())); } else if (cInfo.inherits(StringFieldValue::classId)) { value.reset(nestedMultiValue ? static_cast(new StringResultNodeVector()) : static_cast(new StringResultNode())); } else if (cInfo.inherits(RawFieldValue::classId)) { @@ -83,6 +82,8 @@ deduceResultNode(vespalib::stringref fieldName, const FieldValue & fv, bool pres const Identifiable::RuntimeClass & rInfo = value->getClass(); if (rInfo.inherits(ResultNodeVector::classId)) { //Already multivalue, so we are good to go. + } else if (rInfo.inherits(BoolResultNode::classId)) { + value.reset(new BoolResultNodeVector()); } else if (rInfo.inherits(Int8ResultNode::classId)) { value.reset(new Int8ResultNodeVector()); } else if (rInfo.inherits(Int16ResultNode::classId)) { @@ -338,7 +339,6 @@ GetYMUMChecksumFunctionNode::visitMembers(vespalib::ObjectVisitor &visitor) cons visit(visitor, "checkSum", _checkSum); } -} } // this function was added by ../../forcelink.sh diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h index beb658f7524..d681cdb8c0a 100644 --- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h +++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h @@ -6,8 +6,7 @@ #include "resultvector.h" #include -namespace search { -namespace expression { +namespace search::expression { class DefaultValue final : public ResultNode { @@ -69,13 +68,12 @@ private: bool onExecute() const override; void onDoc(const document::Document & doc) override; void onDocType(const document::DocumentType & docType) override; - document::FieldPath _fieldPath; - mutable ResultNode::CP _value; + document::FieldPath _fieldPath; + mutable ResultNode::CP _value; mutable std::unique_ptr _handler; - vespalib::string _fieldName; - const document::Document * _doc; + vespalib::string _fieldName; + const document::Document * _doc; }; } -} diff --git a/searchlib/src/vespa/searchlib/expression/expressiontree.cpp b/searchlib/src/vespa/searchlib/expression/expressiontree.cpp index ee673d087f0..9fd7caf02f5 100644 --- a/searchlib/src/vespa/searchlib/expression/expressiontree.cpp +++ b/searchlib/src/vespa/searchlib/expression/expressiontree.cpp @@ -7,8 +7,7 @@ #include "arrayatlookupfunctionnode.h" #include "attributenode.h" -namespace search { -namespace expression { +namespace search::expression { using vespalib::Serializer; using vespalib::Deserializer; @@ -223,7 +222,6 @@ operator >> (Deserializer & is, ExpressionTree & et) return is; } -} } // this function was added by ../../forcelink.sh diff --git a/searchlib/src/vespa/searchlib/expression/integerresultnode.h b/searchlib/src/vespa/searchlib/expression/integerresultnode.h index ada513484fd..994c153a353 100644 --- a/searchlib/src/vespa/searchlib/expression/integerresultnode.h +++ b/searchlib/src/vespa/searchlib/expression/integerresultnode.h @@ -5,8 +5,7 @@ #include #include -namespace search { -namespace expression { +namespace search::expression { class BucketResultNode; @@ -88,6 +87,17 @@ private: T _value; }; +class BoolResultNode : public IntegerResultNodeT +{ +private: + using Base = IntegerResultNodeT; +public: + DECLARE_RESULTNODE(BoolResultNode); + BoolResultNode(bool v=false) : Base(v) { } +private: + ConstBufferRef onGetString(size_t index, BufferRef buf) const override; +}; + class Int8ResultNode : public IntegerResultNodeT { private: @@ -133,5 +143,3 @@ private: }; } -} - diff --git a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp index aa871cc165a..eea179f67ff 100644 --- a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp @@ -5,8 +5,8 @@ namespace search::expression { IMPLEMENT_ABSTRACT_EXPRESSIONNODE(NumericFunctionNode, MultiArgFunctionNode); -NumericFunctionNode::NumericFunctionNode() : _handler() { } -NumericFunctionNode::~NumericFunctionNode() {} +NumericFunctionNode::NumericFunctionNode() = default; +NumericFunctionNode::~NumericFunctionNode() = default; NumericFunctionNode::NumericFunctionNode(const NumericFunctionNode & rhs) : MultiArgFunctionNode(rhs), diff --git a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h index 0d056883789..2306d9c1028 100644 --- a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h @@ -4,8 +4,7 @@ #include "multiargfunctionnode.h" #include "resultvector.h" -namespace search { -namespace expression { +namespace search::expression { class NumericFunctionNode : public MultiArgFunctionNode { @@ -174,4 +173,3 @@ private: }; } -} diff --git a/searchlib/src/vespa/searchlib/expression/resultnode.h b/searchlib/src/vespa/searchlib/expression/resultnode.h index 839bb96ceaa..55f08e9455c 100644 --- a/searchlib/src/vespa/searchlib/expression/resultnode.h +++ b/searchlib/src/vespa/searchlib/expression/resultnode.h @@ -5,8 +5,7 @@ #include "serializer.h" #include -namespace search { -namespace expression { +namespace search::expression { class BucketResultNode; @@ -124,4 +123,3 @@ public: }; } -} diff --git a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp index a8a27f89d82..8e34babd92a 100644 --- a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp +++ b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp @@ -12,8 +12,7 @@ #include #include -namespace search { -namespace expression { +namespace search::expression { using vespalib::nbo; using vespalib::Serializer; @@ -31,6 +30,7 @@ IMPLEMENT_RESULTNODE(StringResultNode, SingleResultNode); IMPLEMENT_RESULTNODE(NullResultNode, SingleResultNode); IMPLEMENT_RESULTNODE(PositiveInfinityResultNode, SingleResultNode); IMPLEMENT_RESULTNODE(RawResultNode, SingleResultNode); +IMPLEMENT_RESULTNODE(BoolResultNode, IntegerResultNode); IMPLEMENT_RESULTNODE(Int8ResultNode, IntegerResultNode); IMPLEMENT_RESULTNODE(Int16ResultNode, IntegerResultNode); IMPLEMENT_RESULTNODE(Int32ResultNode, IntegerResultNode); @@ -38,13 +38,9 @@ IMPLEMENT_RESULTNODE(Int64ResultNode, IntegerResultNode); IMPLEMENT_RESULTNODE(EnumResultNode, IntegerResultNode); IMPLEMENT_RESULTNODE(FloatResultNode, NumericResultNode); -void ResultNode::sort() -{ -} +void ResultNode::sort() {} -void ResultNode::reverse() -{ -} +void ResultNode::reverse() {} void ResultNode::negate() { @@ -85,19 +81,22 @@ FloatResultNode::visitMembers(vespalib::ObjectVisitor &visitor) const visit(visitor, "value", _value); } -ResultNode::ConstBufferRef FloatResultNode::onGetString(size_t index, ResultNode::BufferRef buf) const +ResultNode::ConstBufferRef +FloatResultNode::onGetString(size_t index, ResultNode::BufferRef buf) const { (void) index; int numWritten = std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%g", _value))); return ConstBufferRef(buf.str(), numWritten); } -bool FloatResultNode::isNan() const +bool +FloatResultNode::isNan() const { return std::isnan(_value); } -int FloatResultNode::onCmp(const Identifiable & b) const +int +FloatResultNode::onCmp(const Identifiable & b) const { const FloatResultNode & rhs(static_cast(b)); if (isNan()) { @@ -150,13 +149,15 @@ int PositiveInfinityResultNode::onCmp(const Identifiable & b) const int64_t StringResultNode::onGetInteger(size_t index) const { (void) index; return strtoll(_value.c_str(), NULL, 0); } double StringResultNode::onGetFloat(size_t index) const { (void) index; return vespalib::locale::c::strtod(_value.c_str(), NULL); } -Serializer & StringResultNode::onSerialize(Serializer & os) const +Serializer & +StringResultNode::onSerialize(Serializer & os) const { os << _value; return os; } -int StringResultNode::onCmp(const Identifiable & b) const +int +StringResultNode::onCmp(const Identifiable & b) const { if (b.inherits(PositiveInfinityResultNode::classId)) { return -1; @@ -171,14 +172,16 @@ int StringResultNode::onCmp(const Identifiable & b) const } } -Deserializer & StringResultNode::onDeserialize(Deserializer & is) +Deserializer & +StringResultNode::onDeserialize(Deserializer & is) { is >> _value; return is; } -void RawResultNode::add(const ResultNode & b) +void +RawResultNode::add(const ResultNode & b) { char buf[32]; ConstBufferRef s(b.getString(BufferRef(buf, sizeof(buf)))); @@ -196,7 +199,8 @@ void RawResultNode::add(const ResultNode & b) } -void RawResultNode::min(const ResultNode & b) +void +RawResultNode::min(const ResultNode & b) { char buf[32]; ConstBufferRef s(b.getString(BufferRef(buf, sizeof(buf)))); @@ -206,7 +210,8 @@ void RawResultNode::min(const ResultNode & b) } } -void RawResultNode::max(const ResultNode & b) +void +RawResultNode::max(const ResultNode & b) { char buf[32]; ConstBufferRef s(b.getString(BufferRef(buf, sizeof(buf)))); @@ -216,14 +221,16 @@ void RawResultNode::max(const ResultNode & b) } } -void RawResultNode::negate() +void +RawResultNode::negate() { for (size_t i(0); i < _value.size(); i++) { _value[i] = - _value[i]; } } -void StringResultNode::add(const ResultNode & b) +void +StringResultNode::add(const ResultNode & b) { char buf[32]; ConstBufferRef s(b.getString(BufferRef(buf, sizeof(buf)))); @@ -238,7 +245,8 @@ void StringResultNode::add(const ResultNode & b) } } -void StringResultNode::min(const ResultNode & b) +void +StringResultNode::min(const ResultNode & b) { char buf[32]; ConstBufferRef s(b.getString(BufferRef(buf, sizeof(buf)))); @@ -248,7 +256,8 @@ void StringResultNode::min(const ResultNode & b) } } -void StringResultNode::max(const ResultNode & b) +void +StringResultNode::max(const ResultNode & b) { char buf[32]; ConstBufferRef s(b.getString(BufferRef(buf, sizeof(buf)))); @@ -258,7 +267,8 @@ void StringResultNode::max(const ResultNode & b) } } -void StringResultNode::negate() +void +StringResultNode::negate() { for (size_t i(0); i < _value.length(); i++) { _value[i] = - _value[i]; @@ -271,9 +281,14 @@ StringResultNode::visitMembers(vespalib::ObjectVisitor &visitor) const visit(visitor, "value", _value); } -ResultNode::ConstBufferRef StringResultNode::onGetString(size_t index, ResultNode::BufferRef ) const { (void) index; return ConstBufferRef(_value.c_str(), _value.size()); } +ResultNode::ConstBufferRef +StringResultNode::onGetString(size_t index, ResultNode::BufferRef ) const { + (void) index; + return ConstBufferRef(_value.c_str(), _value.size()); +} -void StringResultNode::set(const ResultNode & rhs) +void +StringResultNode::set(const ResultNode & rhs) { char buf[32]; ConstBufferRef b(rhs.getString(BufferRef(buf, sizeof(buf)))); @@ -310,13 +325,15 @@ size_t hashBuf(const void *s, size_t sz) size_t StringResultNode::hash() const { return hashBuf(_value.c_str(), _value.size()); } -size_t StringResultNode::hash(const void * buf) const +size_t +StringResultNode::hash(const void * buf) const { const vespalib::string & s = *static_cast(buf); return hashBuf(s.c_str(), s.size()); } -int64_t RawResultNode::onGetInteger(size_t index) const +int64_t +RawResultNode::onGetInteger(size_t index) const { (void) index; union { @@ -367,19 +384,22 @@ int RawResultNode::onCmp(const Identifiable & b) const size_t RawResultNode::hash() const { return hashBuf(&_value[0], _value.size()); } -size_t RawResultNode::hash(const void * buf) const +size_t +RawResultNode::hash(const void * buf) const { const std::vector & s = *static_cast *>(buf); return hashBuf(&s[0], s.size()); } -Deserializer & RawResultNode::onDeserialize(Deserializer & is) +Deserializer & +RawResultNode::onDeserialize(Deserializer & is) { is >> _value; return is; } -ResultDeserializer & RawResultNode::onDeserializeResult(ResultDeserializer & is) +ResultDeserializer & +RawResultNode::onDeserializeResult(ResultDeserializer & is) { return is.getResult(getClass(), *this); } @@ -390,13 +410,15 @@ RawResultNode::visitMembers(vespalib::ObjectVisitor &visitor) const visit(visitor, "value", _value); } -void RawResultNode::set(const ResultNode & rhs) +void +RawResultNode::set(const ResultNode & rhs) { char buf[32]; ConstBufferRef b(rhs.getString(BufferRef(buf, sizeof(buf)))); setBuffer(b.data(), b.size()); } -void RawResultNode::setBuffer(const void *buf, size_t sz) +void +RawResultNode::setBuffer(const void *buf, size_t sz) { _value.resize(sz + 1); memcpy(&_value[0], buf, sz); @@ -404,37 +426,49 @@ void RawResultNode::setBuffer(const void *buf, size_t sz) _value.resize(sz); } -ResultNode::ConstBufferRef RawResultNode::onGetString(size_t index, BufferRef ) const { (void) index; return ConstBufferRef(&_value[0], _value.size()); } +namespace { + const vespalib::string TRUE = "true"; + const vespalib::string FALSE = "false"; +} -ResultNode::ConstBufferRef EnumResultNode::onGetString(size_t index, BufferRef buf) const { - (void) index; +ResultNode::ConstBufferRef +RawResultNode::onGetString(size_t, BufferRef ) const { + return ConstBufferRef(&_value[0], _value.size()); +} + +ResultNode::ConstBufferRef +EnumResultNode::onGetString(size_t, BufferRef buf) const { int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%ld", getValue())))); return ConstBufferRef(buf.str(), numWritten); } -ResultNode::ConstBufferRef Int8ResultNode::onGetString(size_t index, BufferRef buf) const { - (void) index; +ResultNode::ConstBufferRef +BoolResultNode::onGetString(size_t, BufferRef) const { + return getValue() ? ConstBufferRef(TRUE.data(), TRUE.size()) : ConstBufferRef(FALSE.data(), FALSE.size()); +} + +ResultNode::ConstBufferRef +Int8ResultNode::onGetString(size_t, BufferRef buf) const { int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%d", getValue())))); return ConstBufferRef(buf.str(), numWritten); } -ResultNode::ConstBufferRef Int16ResultNode::onGetString(size_t index, BufferRef buf) const { - (void) index; +ResultNode::ConstBufferRef +Int16ResultNode::onGetString(size_t, BufferRef buf) const { int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%d", getValue())))); return ConstBufferRef(buf.str(), numWritten); } -ResultNode::ConstBufferRef Int32ResultNode::onGetString(size_t index, BufferRef buf) const { - (void) index; +ResultNode::ConstBufferRef +Int32ResultNode::onGetString(size_t, BufferRef buf) const { int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%d", getValue())))); return ConstBufferRef(buf.str(), numWritten); } -ResultNode::ConstBufferRef Int64ResultNode::onGetString(size_t index, BufferRef buf) const { - (void) index; +ResultNode::ConstBufferRef +Int64ResultNode::onGetString(size_t, BufferRef buf) const { int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%ld", getValue())))); return ConstBufferRef(buf.str(), numWritten); } } -} diff --git a/searchlib/src/vespa/searchlib/expression/resultvector.cpp b/searchlib/src/vespa/searchlib/expression/resultvector.cpp index af30ae87fa0..f1aed219965 100644 --- a/searchlib/src/vespa/searchlib/expression/resultvector.cpp +++ b/searchlib/src/vespa/searchlib/expression/resultvector.cpp @@ -2,10 +2,10 @@ #include "resultvector.h" -namespace search { -namespace expression { +namespace search::expression { IMPLEMENT_ABSTRACT_EXPRESSIONNODE(ResultNodeVector, ResultNode); +IMPLEMENT_RESULTNODE(BoolResultNodeVector, ResultNodeVector); IMPLEMENT_RESULTNODE(Int8ResultNodeVector, ResultNodeVector); IMPLEMENT_RESULTNODE(Int16ResultNodeVector, ResultNodeVector); IMPLEMENT_RESULTNODE(Int32ResultNodeVector, ResultNodeVector); @@ -54,7 +54,6 @@ ResultNodeVector::onDeserializeResult(ResultDeserializer & is) return is.getResult(getClass(), *this); } -} } // this function was added by ../../forcelink.sh diff --git a/searchlib/src/vespa/searchlib/expression/resultvector.h b/searchlib/src/vespa/searchlib/expression/resultvector.h index 7969c4f88fa..cd29178f24f 100644 --- a/searchlib/src/vespa/searchlib/expression/resultvector.h +++ b/searchlib/src/vespa/searchlib/expression/resultvector.h @@ -13,8 +13,7 @@ #include #include -namespace search { -namespace expression { +namespace search::expression { class ResultNodeVector : public ResultNode { @@ -304,6 +303,15 @@ public: }; +class BoolResultNodeVector : public NumericResultNodeVectorT +{ +public: + BoolResultNodeVector() { } + DECLARE_RESULTNODE(BoolResultNodeVector); + + const IntegerBucketResultNode& getNullBucket() const override { return IntegerBucketResultNode::getNull(); } +}; + class Int8ResultNodeVector : public NumericResultNodeVectorT { public: @@ -426,7 +434,4 @@ private: std::vector _v; }; - } -} - -- cgit v1.2.3