MCPcopy Create free account
hub / github.com/ByConity/ByConity / updatePipeline

Method updatePipeline

src/QueryPlan/JoinStep.cpp:316–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316QueryPipelinePtr JoinStep::updatePipeline(QueryPipelines pipelines, const BuildQueryPipelineSettings & settings)
317{
318 if (pipelines.size() != 2)
319 throw Exception(ErrorCodes::LOGICAL_ERROR, "JoinStep expect two input steps");
320
321 bool need_build_runtime_filter = false;
322
323 ExpressionActionsPtr filter_action;
324 if (!join)
325 {
326 if (filter && !PredicateUtils::isTruePredicate(filter))
327 {
328 Names output;
329
330 bool has_outer_join_semantic = settings.context->getSettingsRef().join_use_nulls &&
331 (isAny(getStrictness()) || isAll(getStrictness()) || getStrictness() == ASTTableJoin::Strictness::RightAny || isAsof(getStrictness()));
332 bool make_nullable_for_left = has_outer_join_semantic && isRightOrFull(getKind());
333 bool make_nullable_for_right = has_outer_join_semantic && isLeftOrFull(getKind());
334
335 Block header;
336 for (const auto & col : input_streams[0].header)
337 {
338 if (make_nullable_for_left && JoinCommon::canBecomeNullable(col.type))
339 {
340 header.insert(ColumnWithTypeAndName{col.column, JoinCommon::convertTypeToNullable(col.type), col.name});
341 }
342 else
343 {
344 header.insert(col);
345 }
346 }
347 for (const auto & col : input_streams[1].header)
348 {
349 if (make_nullable_for_right && JoinCommon::canBecomeNullable(col.type))
350 {
351 header.insert(ColumnWithTypeAndName{col.column, JoinCommon::convertTypeToNullable(col.type), col.name});
352 }
353 else
354 {
355 header.insert(col);
356 }
357 }
358 for (const auto & item : header)
359 output.emplace_back(item.name);
360 output.emplace_back(filter->getColumnName());
361
362 auto actions_dag = createExpressionActions(settings.context, header.getNamesAndTypesList(), output, filter->clone());
363 filter_action = std::make_shared<ExpressionActions>(actions_dag, settings.getActionsSettings());
364 }
365
366 if (!runtime_filter_builders.empty() && settings.distributed_settings.is_distributed)
367 {
368 auto builder = createRuntimeFilterBuilder(settings.context);
369 std::shared_ptr<RuntimeFilterConsumer> consumer = std::make_shared<RuntimeFilterConsumer>(
370 builder,
371 settings.context->getInitialQueryId(),
372 1, /// for normal HashJoin only one right table, parallel or concurrent hash join will change it to num_streams
373 settings.distributed_settings.parallel_size,

Callers

nothing calls this directly

Calls 15

isAnyFunction · 0.85
isAllFunction · 0.85
isAsofFunction · 0.85
isRightOrFullFunction · 0.85
isLeftOrFullFunction · 0.85
canBecomeNullableFunction · 0.85
convertTypeToNullableFunction · 0.85
makeJoinFunction · 0.85
projectionFunction · 0.85
getInitialQueryIdMethod · 0.80
getNumStreamsMethod · 0.80

Tested by

no test coverage detected