diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-06 14:45:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 14:45:33 +0100 |
commit | e90e27fb65e35b11a42b82b28cd3dbb88683af3f (patch) | |
tree | d37ca2471803602e2c441513e53f3389371f1b4e | |
parent | 1134eb4b8c5a71d94cb9b57b7bfe5baea860fa43 (diff) | |
parent | 22b5d4a3e694200e968b020ec935d5a983aae7d0 (diff) |
Merge pull request #29248 from vespa-engine/balder/no-can-do
Not possible to do safe cast here. Must leav as is and wait until we …
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp index 6e1177d9065..d94b0a4c909 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp @@ -4,7 +4,6 @@ #include "selectcontext.h" #include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/searchlib/attribute/stringbase.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/vespalib/util/exceptions.h> #include <cassert> @@ -38,22 +37,23 @@ AttributeFieldValueNode(const vespalib::string& doctype, std::unique_ptr<document::select::Value> -AttributeFieldValueNode::getValue(const Context &context) const +AttributeFieldValueNode:: +getValue(const Context &context) const { const auto &sc(static_cast<const SelectContext &>(context)); uint32_t docId(sc._docId); assert(docId != 0u); const auto& v = sc.guarded_attribute_at_index(_attr_guard_index); + if (v.isUndefined(docId)) { + return std::make_unique<NullValue>(); + } switch (v.getBasicType()) { case BasicType::STRING: { - const auto & s = static_cast<const search::StringAttribute &>(v); - const char * value = s.get(docId); - if (search::attribute::isUndefined(value)) { - return std::make_unique<NullValue>(); - } else { - return std::make_unique<StringValue>(value); - } + 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: @@ -63,9 +63,6 @@ AttributeFieldValueNode::getValue(const Context &context) const case BasicType::INT32: case BasicType::INT64: { - if (v.isUndefined(docId)) { - return std::make_unique<NullValue>(); - } AttributeContent<IAttributeVector::largeint_t> content; content.fill(v, docId); assert(content.size() == 1u); @@ -74,9 +71,6 @@ AttributeFieldValueNode::getValue(const Context &context) const case BasicType::FLOAT: case BasicType::DOUBLE: { - if (v.isUndefined(docId)) { - return std::make_unique<NullValue>(); - } AttributeContent<double> content; content.fill(v, docId); assert(content.size() == 1u); |