@@ -2824,14 +2824,15 @@ ExecutionNode* AsyncNode::clone(ExecutionPlan* plan, bool withDependencies,
2824
2824
}
2825
2825
2826
2826
namespace {
2827
- const char * MATERIALIZE_NODE_IN_NM_COL_PARAM = " inNmColPtr " ;
2828
- const char * MATERIALIZE_NODE_IN_NM_DOC_PARAM = " inNmDocId " ;
2829
- const char * MATERIALIZE_NODE_OUT_VARIABLE_PARAM = " outVariable " ;
2827
+ constexpr std::string_view MATERIALIZE_NODE_IN_NM_DOC_PARAM = " inNmDocId " ;
2828
+ constexpr std::string_view MATERIALIZE_NODE_OUT_VARIABLE_PARAM = " outVariable " ;
2829
+ constexpr std::string_view MATERIALIZE_NODE_MULTI_NODE_PARAM = " multiNode " ;
2830
2830
} // namespace
2831
2831
2832
2832
MaterializeNode* materialize::createMaterializeNode (
2833
- ExecutionPlan* plan, arangodb::velocypack::Slice const & base) {
2834
- if (base.hasKey (MATERIALIZE_NODE_IN_NM_COL_PARAM)) {
2833
+ ExecutionPlan* plan, arangodb::velocypack::Slice const base) {
2834
+ auto isMulti = base.get (MATERIALIZE_NODE_MULTI_NODE_PARAM);
2835
+ if (isMulti.isBoolean () && isMulti.getBoolean ()) {
2835
2836
return new MaterializeMultiNode (plan, base);
2836
2837
}
2837
2838
return new MaterializeSingleNode (plan, base);
@@ -2861,6 +2862,14 @@ void MaterializeNode::doToVelocyPack(velocypack::Builder& nodes,
2861
2862
_outVariable->toVelocyPack (nodes);
2862
2863
}
2863
2864
2865
+ auto MaterializeNode::getReadableInputRegisters (
2866
+ RegisterId const inNmDocId) const -> RegIdSet {
2867
+ // TODO (Dronplane) for index exectutor here we possibly will
2868
+ // return additional SearchDoc register. So will keep this function for time
2869
+ // being.
2870
+ return RegIdSet{inNmDocId};
2871
+ }
2872
+
2864
2873
CostEstimate MaterializeNode::estimateCost () const {
2865
2874
if (_dependencies.empty ()) {
2866
2875
// we should always have dependency as we need input for materializing
@@ -2883,25 +2892,19 @@ std::vector<Variable const*> MaterializeNode::getVariablesSetHere() const {
2883
2892
2884
2893
MaterializeMultiNode::MaterializeMultiNode (ExecutionPlan* plan,
2885
2894
ExecutionNodeId id,
2886
- aql::Variable const & inColPtr,
2887
2895
aql::Variable const & inDocId,
2888
2896
aql::Variable const & outVariable)
2889
- : MaterializeNode(plan, id, inDocId, outVariable),
2890
- _inNonMaterializedColPtr(&inColPtr) {}
2897
+ : MaterializeNode(plan, id, inDocId, outVariable) {}
2891
2898
2892
2899
MaterializeMultiNode::MaterializeMultiNode (
2893
2900
ExecutionPlan* plan, arangodb::velocypack::Slice const & base)
2894
- : MaterializeNode(plan, base),
2895
- _inNonMaterializedColPtr(aql::Variable::varFromVPack(
2896
- plan->getAst (), base, MATERIALIZE_NODE_IN_NM_COL_PARAM, true)) {}
2901
+ : MaterializeNode(plan, base) {}
2897
2902
2898
2903
void MaterializeMultiNode::doToVelocyPack (velocypack::Builder& nodes,
2899
2904
unsigned flags) const {
2900
2905
// call base class method
2901
2906
MaterializeNode::doToVelocyPack (nodes, flags);
2902
-
2903
- nodes.add (VPackValue (MATERIALIZE_NODE_IN_NM_COL_PARAM));
2904
- _inNonMaterializedColPtr->toVelocyPack (nodes);
2907
+ nodes.add (MATERIALIZE_NODE_MULTI_NODE_PARAM, velocypack::Value (true ));
2905
2908
}
2906
2909
2907
2910
std::unique_ptr<ExecutionBlock> MaterializeMultiNode::createBlock (
@@ -2910,12 +2913,6 @@ std::unique_ptr<ExecutionBlock> MaterializeMultiNode::createBlock(
2910
2913
ExecutionNode const * previousNode = getFirstDependency ();
2911
2914
TRI_ASSERT (previousNode != nullptr );
2912
2915
2913
- RegisterId inNmColPtrRegId;
2914
- {
2915
- auto it = getRegisterPlan ()->varInfo .find (_inNonMaterializedColPtr->id );
2916
- TRI_ASSERT (it != getRegisterPlan ()->varInfo .end ());
2917
- inNmColPtrRegId = it->second .registerId ;
2918
- }
2919
2916
RegisterId inNmDocIdRegId;
2920
2917
{
2921
2918
auto it = getRegisterPlan ()->varInfo .find (_inNonMaterializedDocId->id );
@@ -2929,18 +2926,16 @@ std::unique_ptr<ExecutionBlock> MaterializeMultiNode::createBlock(
2929
2926
outDocumentRegId = it->second .registerId ;
2930
2927
}
2931
2928
2932
- auto readableInputRegisters =
2933
- getReadableInputRegisters (inNmColPtrRegId, inNmDocIdRegId);
2929
+ auto readableInputRegisters = getReadableInputRegisters (inNmDocIdRegId);
2934
2930
auto writableOutputRegisters = RegIdSet{outDocumentRegId};
2935
2931
2936
2932
auto registerInfos = createRegisterInfos (std::move (readableInputRegisters),
2937
2933
std::move (writableOutputRegisters));
2938
2934
2939
- auto executorInfos = MaterializerExecutorInfos (
2940
- inNmColPtrRegId, inNmDocIdRegId, outDocumentRegId, engine.getQuery ());
2935
+ auto executorInfos = MaterializerExecutorInfos< void > (
2936
+ inNmDocIdRegId, outDocumentRegId, engine.getQuery ());
2941
2937
2942
- return std::make_unique<
2943
- ExecutionBlockImpl<MaterializeExecutor<decltype (inNmColPtrRegId)>>>(
2938
+ return std::make_unique<ExecutionBlockImpl<MaterializeExecutor<void >>>(
2944
2939
&engine, this , std::move (registerInfos), std::move (executorInfos));
2945
2940
}
2946
2941
@@ -2951,29 +2946,18 @@ ExecutionNode* MaterializeMultiNode::clone(ExecutionPlan* plan,
2951
2946
2952
2947
auto * outVariable = _outVariable;
2953
2948
auto * inNonMaterializedDocId = _inNonMaterializedDocId;
2954
- auto * inNonMaterializedColId = _inNonMaterializedColPtr;
2955
2949
2956
2950
if (withProperties) {
2957
2951
outVariable = plan->getAst ()->variables ()->createVariable (outVariable);
2958
2952
inNonMaterializedDocId =
2959
2953
plan->getAst ()->variables ()->createVariable (inNonMaterializedDocId);
2960
- inNonMaterializedColId =
2961
- plan->getAst ()->variables ()->createVariable (inNonMaterializedColId);
2962
2954
}
2963
2955
2964
2956
auto c = std::make_unique<MaterializeMultiNode>(
2965
- plan, _id, *inNonMaterializedColId, *inNonMaterializedDocId,
2966
- *outVariable);
2957
+ plan, _id, *inNonMaterializedDocId, *outVariable);
2967
2958
return cloneHelper (std::move (c), withDependencies, withProperties);
2968
2959
}
2969
2960
2970
- void MaterializeMultiNode::getVariablesUsedHere (VarSet& vars) const {
2971
- // call base class method
2972
- MaterializeNode::getVariablesUsedHere (vars);
2973
-
2974
- vars.emplace (_inNonMaterializedColPtr);
2975
- }
2976
-
2977
2961
MaterializeSingleNode::MaterializeSingleNode (ExecutionPlan* plan,
2978
2962
ExecutionNodeId id,
2979
2963
aql::Collection const * collection,
@@ -3014,14 +2998,14 @@ std::unique_ptr<ExecutionBlock> MaterializeSingleNode::createBlock(
3014
2998
}
3015
2999
auto const & name = collection ()->name ();
3016
3000
3017
- auto readableInputRegisters = getReadableInputRegisters (name, inNmDocIdRegId);
3001
+ auto readableInputRegisters = getReadableInputRegisters (inNmDocIdRegId);
3018
3002
auto writableOutputRegisters = RegIdSet{outDocumentRegId};
3019
3003
3020
3004
auto registerInfos = createRegisterInfos (std::move (readableInputRegisters),
3021
3005
std::move (writableOutputRegisters));
3022
3006
3023
3007
auto executorInfos = MaterializerExecutorInfos<decltype (name)>(
3024
- name, inNmDocIdRegId, outDocumentRegId, engine.getQuery ());
3008
+ inNmDocIdRegId, outDocumentRegId, engine.getQuery (), name );
3025
3009
return std::make_unique<
3026
3010
ExecutionBlockImpl<MaterializeExecutor<decltype (name)>>>(
3027
3011
&engine, this , std::move (registerInfos), std::move (executorInfos));
0 commit comments