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

Method NestedLoopJoin

src/Interpreters/NestedLoopJoin.cpp:46–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46NestedLoopJoin::NestedLoopJoin(std::shared_ptr<TableJoin> table_join_, const Block & right_sample_block_, const ContextPtr & context_)
47 : table_join(table_join_)
48 , right_sample_block(right_sample_block_)
49 , size_limits(table_join->sizeLimits())
50 , nullable_right_side(table_join->forceNullableRight())
51 , is_any_join(isAny(table_join->strictness()))
52 , is_left(isLeft(table_join->kind()))
53 , max_rows_in_right_block(table_join->maxRowsInRightBlock())
54 , context(context_)
55{
56 if (!isLeft(table_join->kind()) && !isInner(table_join->kind()))
57 throw Exception("NestedLoop join supported for LEFT and INNER JOINs only", ErrorCodes::NOT_IMPLEMENTED);
58
59 if (is_any_join)
60 throw Exception("NestedLoop join is not supported for any join", ErrorCodes::NOT_IMPLEMENTED);
61
62 if (!max_rows_in_right_block)
63 throw Exception("partial_nested_loop_join_rows_in_right_blocks cannot be zero", ErrorCodes::PARAMETER_OUT_OF_BOUND);
64
65 if (!size_limits.hasLimits())
66 {
67 size_limits.max_bytes = table_join->defaultMaxBytes();
68 if (!size_limits.max_bytes)
69 throw Exception(
70 "No limit for NestedLoop join (max_rows_in_join, max_bytes_in_join or default_max_bytes_in_join have to be set)",
71 ErrorCodes::PARAMETER_OUT_OF_BOUND);
72 }
73 table_join->splitAdditionalColumns(right_sample_block, right_table_keys, right_columns_to_add);
74 JoinCommon::removeLowCardinalityInplace(right_columns_to_add);
75 JoinCommon::createMissedColumns(right_columns_to_add);
76
77 const NameSet required_right_keys = table_join->requiredRightKeys();
78 for (const auto & column : right_table_keys)
79 if (required_right_keys.count(column.name))
80 right_columns_to_add.insert(ColumnWithTypeAndName{nullptr, column.type, column.name});
81 JoinCommon::createMissedColumns(right_columns_to_add);
82
83 if (nullable_right_side)
84 JoinCommon::convertColumnsToNullable(right_columns_to_add);
85}
86
87void NestedLoopJoin::setTotals(const Block & totals_block)
88{

Callers

nothing calls this directly

Calls 15

isAnyFunction · 0.85
isLeftFunction · 0.85
isInnerFunction · 0.85
createMissedColumnsFunction · 0.85
convertColumnsToNullableFunction · 0.85
forceNullableRightMethod · 0.80
strictnessMethod · 0.80
kindMethod · 0.80
maxRowsInRightBlockMethod · 0.80
hasLimitsMethod · 0.80
defaultMaxBytesMethod · 0.80

Tested by

no test coverage detected