@@ -260,30 +260,30 @@ CostEstimate ScatterNode::estimateCost() const {
260
260
estimate.estimatedCost += estimate.estimatedNrItems * _clients.size ();
261
261
return estimate;
262
262
}
263
+
264
+ DistributeNode::DistributeNode (ExecutionPlan* plan, ExecutionNodeId id,
265
+ ScatterNode::ScatterType type, Collection const * collection,
266
+ Variable const * variable, ExecutionNodeId targetNodeId)
267
+ : ScatterNode(plan, id, type),
268
+ CollectionAccessingNode(collection),
269
+ _variable(variable),
270
+ _targetNodeId(targetNodeId) {}
263
271
264
272
// / @brief construct a distribute node
265
273
DistributeNode::DistributeNode (ExecutionPlan* plan, arangodb::velocypack::Slice const & base)
266
274
: ScatterNode(plan, base),
267
275
CollectionAccessingNode(plan, base),
268
- _variable(nullptr ),
269
- _alternativeVariable(nullptr ),
270
- _createKeys(base.get(" createKeys" ).getBoolean()),
271
- _allowKeyConversionToObject(base.get(" allowKeyConversionToObject" ).getBoolean()),
272
- _allowSpecifiedKeys(false ),
273
- _fixupGraphInput(false ) {
274
- if (base.hasKey (" variable" ) && base.hasKey (" alternativeVariable" )) {
275
- _variable = Variable::varFromVPack (plan->getAst (), base, " variable" );
276
- _alternativeVariable =
277
- Variable::varFromVPack (plan->getAst (), base, " alternativeVariable" );
278
- } else {
279
- _variable = plan->getAst ()->variables ()->getVariable (
280
- base.get (" varId" ).getNumericValue <VariableId>());
281
- _alternativeVariable = plan->getAst ()->variables ()->getVariable (
282
- base.get (" alternativeVarId" ).getNumericValue <VariableId>());
283
- }
284
- _fixupGraphInput = VelocyPackHelper::getBooleanValue (base, " fixupGraphInput" , false );
285
- // if we fixupGraphInput, we are disallowed to create keys: _fixupGraphInput -> !_createKeys
286
- TRI_ASSERT (!_fixupGraphInput || !_createKeys);
276
+ _variable(Variable::varFromVPack(plan->getAst (), base, "variable")) {}
277
+
278
+ // / @brief clone ExecutionNode recursively
279
+ ExecutionNode* DistributeNode::clone (ExecutionPlan* plan, bool withDependencies,
280
+ bool withProperties) const {
281
+ auto c = std::make_unique<DistributeNode>(plan, _id, getScatterType (),
282
+ collection (), _variable, _targetNodeId);
283
+ c->copyClients (clients ());
284
+ CollectionAccessingNode::cloneInto (*c);
285
+
286
+ return cloneHelper (std::move (c), withDependencies, withProperties);
287
287
}
288
288
289
289
// / @brief creates corresponding ExecutionBlock
@@ -292,40 +292,20 @@ std::unique_ptr<ExecutionBlock> DistributeNode::createBlock(
292
292
ExecutionNode const * previousNode = getFirstDependency ();
293
293
TRI_ASSERT (previousNode != nullptr );
294
294
295
- RegisterId regId;
296
- RegisterId alternativeRegId = RegisterPlan::MaxRegisterId;
297
-
298
- { // set regId and alternativeRegId:
299
-
300
- // get the variable to inspect . . .
301
- VariableId varId = _variable->id ;
295
+ // get the variable to inspect . . .
296
+ VariableId varId = _variable->id ;
302
297
303
- // get the register id of the variable to inspect . . .
304
- auto it = getRegisterPlan ()->varInfo .find (varId);
305
- TRI_ASSERT (it != getRegisterPlan ()->varInfo .end ());
306
- regId = (*it).second .registerId ;
298
+ // get the register id of the variable to inspect . . .
299
+ auto it = getRegisterPlan ()->varInfo .find (varId);
300
+ TRI_ASSERT (it != getRegisterPlan ()->varInfo .end ());
301
+ RegisterId regId = (*it).second .registerId ;
307
302
308
- TRI_ASSERT (regId < RegisterPlan::MaxRegisterId);
303
+ TRI_ASSERT (regId < RegisterPlan::MaxRegisterId);
309
304
310
- if (_alternativeVariable != _variable) {
311
- // use second variable
312
- auto it = getRegisterPlan ()->varInfo .find (_alternativeVariable->id );
313
- TRI_ASSERT (it != getRegisterPlan ()->varInfo .end ());
314
- alternativeRegId = (*it).second .registerId ;
315
-
316
- TRI_ASSERT (alternativeRegId < RegisterPlan::MaxRegisterId);
317
- } else {
318
- TRI_ASSERT (alternativeRegId == RegisterPlan::MaxRegisterId);
319
- }
320
- }
321
- auto inAndOutRegs = RegIdSet{regId};
322
- if (alternativeRegId != RegisterPlan::MaxRegisterId) {
323
- inAndOutRegs.emplace (alternativeRegId);
324
- }
325
- auto registerInfos = createRegisterInfos (inAndOutRegs, inAndOutRegs);
326
- auto infos = DistributeExecutorInfos (clients (), collection (), regId, alternativeRegId,
327
- _allowSpecifiedKeys, _allowKeyConversionToObject,
328
- _createKeys, _fixupGraphInput, getScatterType ());
305
+ auto inRegs = RegIdSet{regId};
306
+ auto registerInfos = createRegisterInfos (inRegs, {});
307
+ auto infos = DistributeExecutorInfos (clients (), collection (),
308
+ regId, getScatterType ());
329
309
10000
330
310
return std::make_unique<ExecutionBlockImpl<DistributeExecutor>>(&engine, this ,
331
311
std::move (registerInfos),
@@ -344,13 +324,8 @@ void DistributeNode::toVelocyPackHelper(VPackBuilder& builder, unsigned flags,
344
324
// serialize clients
345
325
writeClientsToVelocyPack (builder);
346
326
347
- builder.add (" createKeys" , VPackValue (_createKeys));
348
- builder.add (" allowKeyConversionToObject" , VPackValue (_allowKeyConversionToObject));
349
- builder.add (" fixupGraphInput" , VPackValue (_fixupGraphInput));
350
327
builder.add (VPackValue (" variable" ));
351
- _variable->toVelocyPack (builder);
352
- builder.add (VPackValue (" alternativeVariable" ));
353
- _alternativeVariable->toVelocyPack (builder);
328
+ _variable->toVelocyPack (builder);;
354
329
355
330
// And close it:
356
331
builder.close ();
@@ -359,7 +334,6 @@ void DistributeNode::toVelocyPackHelper(VPackBuilder& builder, unsigned flags,
359
334
// / @brief getVariablesUsedHere, modifying the set in-place
360
335
void DistributeNode::getVariablesUsedHere (VarSet& vars) const {
361
336
vars.emplace (_variable);
362
- vars.emplace (_alternativeVariable);
363
337
}
364
338
365
339
// / @brief estimateCost
0 commit comments