aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-11-06 13:16:47 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-11-06 13:16:47 +0000
commit22b5d4a3e694200e968b020ec935d5a983aae7d0 (patch)
tree341754b192662ff8edb0189a323999fcd14db548
parent93eea4d5a70d05c5bf0cf716f1cd51a2e92c6c25 (diff)
Not possible to do safe cast here. Must leav as is and wait until we clean up with proper get interfaces.
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp24
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);