summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-06-06 19:38:18 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-06-07 09:50:23 +0200
commita9ba7645226f200148de44a19aff204dd0841493 (patch)
treec270f3117048fc8b2ef08c4470232731932f4d05 /searchcore
parentece112cf6aadbf135c92f1d5ddada739b290a118 (diff)
Hide BucketDistribution
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/common/selectpruner_test.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp11
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h32
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/selectpruner.h127
6 files changed, 55 insertions, 124 deletions
diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp
index 29ef6ef016c..0a181de39ec 100644
--- a/searchcore/src/tests/proton/common/selectpruner_test.cpp
+++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchcore/proton/common/selectpruner.h>
#include <vespa/document/select/parser.h>
#include <vespa/document/select/cloningvisitor.h>
+#include <vespa/document/fieldvalue/document.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/test/mock_attribute_manager.h>
diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp
index d15eddb3ac4..10c2adfd1f2 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp
@@ -3,6 +3,8 @@
#include "attributefieldvaluenode.h"
#include "selectcontext.h"
#include <vespa/searchcommon/attribute/attributecontent.h>
+#include <vespa/searchlib/attribute/attributevector.h>
+
namespace proton {
@@ -20,11 +22,10 @@ using search::attribute::BasicType;
using search::attribute::CollectionType;
using search::attribute::IAttributeVector;
-
AttributeFieldValueNode::
AttributeFieldValueNode(const vespalib::string& doctype,
const vespalib::string& field,
- const search::AttributeVector::SP &attribute)
+ const std::shared_ptr<search::AttributeVector> &attribute)
: FieldValueNode(doctype, field),
_attribute(attribute)
{
@@ -94,5 +95,11 @@ AttributeFieldValueNode::traceValue(const Context &context,
}
+document::select::ValueNode::UP
+AttributeFieldValueNode::clone() const
+{
+ return wrapParens(new AttributeFieldValueNode(getDocType(), getFieldName(), _attribute));
+}
+
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h
index 38e532053d4..c0ffbaea987 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h
+++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h
@@ -1,38 +1,24 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/document/select/valuenode.h>
-#include <vespa/searchlib/attribute/attributevector.h>
-
-namespace proton
-{
+#include <vespa/document/select/valuenodes.h>
+namespace search { class AttributeVector; }
+namespace proton {
class AttributeFieldValueNode : public document::select::FieldValueNode
{
- search::AttributeVector::SP _attribute;
+ using Context = document::select::Context;
+ std::shared_ptr<search::AttributeVector> _attribute;
public:
AttributeFieldValueNode(const vespalib::string& doctype,
const vespalib::string& field,
- const search::AttributeVector::SP &attribute);
-
- virtual std::unique_ptr<document::select::Value>
- getValue(const document::select::Context &context) const override;
+ const std::shared_ptr<search::AttributeVector> &attribute);
- virtual std::unique_ptr<document::select::Value>
- traceValue(const document::select::Context &context,
- std::ostream& out) const override;
-
- document::select::ValueNode::UP
- clone() const override
- {
- return wrapParens(new AttributeFieldValueNode(getDocType(),
- getFieldName(),
- _attribute));
- }
+ std::unique_ptr<document::select::Value> getValue(const Context &context) const override;
+ std::unique_ptr<document::select::Value> traceValue(const Context &context, std::ostream& out) const override;
+ document::select::ValueNode::UP clone() const override;
};
} // namespace proton
-
-
diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp
index 861131642e4..9a15c257dcc 100644
--- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp
@@ -1,12 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "cachedselect.h"
-#include <vespa/document/select/valuenode.h>
-#include <vespa/document/select/cloningvisitor.h>
#include "attributefieldvaluenode.h"
+#include "selectpruner.h"
#include <vespa/searchlib/attribute/iattributemanager.h>
+#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/document/select/parser.h>
-#include "selectpruner.h"
#include <vespa/log/log.h>
LOG_SETUP(".proton.common.cachedselect");
@@ -85,7 +84,7 @@ AttrVisitor::visitFieldValueNode(const FieldValueNode &expr)
_valueNode = expr.clone();
return;
}
- AttributeVector::SP av(ag->getSP());
+ std::shared_ptr<search::AttributeVector> av(ag->getSP());
if (av->getCollectionType() == CollectionType::SINGLE) {
++_svAttrs;
AttrMap::iterator it(_amap.find(name));
diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
index 001eb7d16f3..7e92be7507e 100644
--- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
@@ -9,6 +9,7 @@
#include <vespa/document/select/branch.h>
#include <vespa/document/select/doctype.h>
#include <vespa/document/select/invalidconstant.h>
+#include <vespa/document/select/valuenodes.h>
#include <vespa/searchlib/attribute/iattributemanager.h>
using document::select::And;
diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.h b/searchcore/src/vespa/searchcore/proton/common/selectpruner.h
index 5d4bbc038b9..7b6c9954124 100644
--- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.h
+++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.h
@@ -9,8 +9,9 @@
namespace search { class IAttributeManager; }
-namespace proton
-{
+namespace document { class DocumentTypeRepo; }
+
+namespace proton {
class SelectPrunerBase
{
@@ -50,100 +51,36 @@ public:
bool hasFields);
SelectPruner(const SelectPruner *rhs);
-
- virtual
- ~SelectPruner();
-
- uint32_t
- getFieldNodes() const
- {
- return _fieldNodes;
- }
-
- uint32_t
- getAttrFieldNodes() const
- {
- return _attrFieldNodes;
- }
-
- const document::select::ResultSet &
- getResultSet() const
- {
- return _resultSet;
- }
-
- bool
- isFalse() const;
-
- bool
- isTrue() const;
-
- bool
- isInvalid() const;
-
- bool
- isConst() const;
-
- void
- trace(std::ostream &t);
-
- void
- process(const document::select::Node &node);
+ virtual ~SelectPruner();
+
+ uint32_t getFieldNodes() const { return _fieldNodes; }
+ uint32_t getAttrFieldNodes() const { return _attrFieldNodes; }
+ const document::select::ResultSet & getResultSet() const { return _resultSet; }
+ bool isFalse() const;
+ bool isTrue() const;
+ bool isInvalid() const;
+ bool isConst() const;
+ void trace(std::ostream &t);
+ void process(const document::select::Node &node);
private:
- virtual void
- visitAndBranch(const document::select::And &expr) override;
-
- virtual void
- visitComparison(const document::select::Compare &expr) override;
-
- virtual void
- visitDocumentType(const document::select::DocType &expr) override;
-
- virtual void
- visitNotBranch(const document::select::Not &expr) override;
-
- virtual void
- visitOrBranch(const document::select::Or &expr) override;
-
- virtual void
- visitArithmeticValueNode(const document::select::ArithmeticValueNode &expr) override;
-
- virtual void
- visitFunctionValueNode(const document::select::FunctionValueNode &expr) override;
-
- virtual void
- visitFieldValueNode(const document::select::FieldValueNode &expr) override;
-
- void
- invertNode();
-
- const document::select::Operator &
- getOperator(const document::select::Operator &op);
-
- void
- addNodeCount(const SelectPruner &rhs);
-
- void
- setInvalidVal();
-
- void
- setInvalidConst();
-
- void
- setTernaryConst(bool val);
-
- void
- resolveTernaryConst(bool wantInverted);
-
- bool
- isInvalidVal() const;
-
- bool
- isNullVal() const;
-
- void
- swap(SelectPruner &rhs);
+ void visitAndBranch(const document::select::And &expr) override;
+ void visitComparison(const document::select::Compare &expr) override;
+ void visitDocumentType(const document::select::DocType &expr) override;
+ void visitNotBranch(const document::select::Not &expr) override;
+ void visitOrBranch(const document::select::Or &expr) override;
+ void visitArithmeticValueNode(const document::select::ArithmeticValueNode &expr) override;
+ void visitFunctionValueNode(const document::select::FunctionValueNode &expr) override;
+ void visitFieldValueNode(const document::select::FieldValueNode &expr) override;
+ void invertNode();
+ const document::select::Operator &getOperator(const document::select::Operator &op);
+ void addNodeCount(const SelectPruner &rhs);
+ void setInvalidVal();
+ void setInvalidConst();
+ void setTernaryConst(bool val);
+ void resolveTernaryConst(bool wantInverted);
+ bool isInvalidVal() const;
+ bool isNullVal() const;
+ void swap(SelectPruner &rhs);
};
} // namespace proton
-