From a0144e115d80712927c0be33d9e075ccafe3575b Mon Sep 17 00:00:00 2001 From: vdimir Date: Tue, 26 Apr 2022 13:51:33 +0000 Subject: [PATCH] full sorting all join --- .../Transforms/MergeJoinTransform.cpp | 318 +- .../Transforms/MergeJoinTransform.h | 38 +- .../02273_full_sort_join.reference | 736 ++++- .../0_stateless/02273_full_sort_join.sql.j2 | 35 +- .../02274_full_sort_join_nodistinct.reference | 2610 ++++++++++++++++- .../02274_full_sort_join_nodistinct.sql.j2 | 22 +- .../02275_full_sort_join_long.reference | 24 + .../02275_full_sort_join_long.sql.j2 | 19 +- 8 files changed, 3387 insertions(+), 415 deletions(-) diff --git a/src/Processors/Transforms/MergeJoinTransform.cpp b/src/Processors/Transforms/MergeJoinTransform.cpp index c2921663e9a..806372cd90a 100644 --- a/src/Processors/Transforms/MergeJoinTransform.cpp +++ b/src/Processors/Transforms/MergeJoinTransform.cpp @@ -5,22 +5,21 @@ #include #include #include -#include + +#include #include -#include -#include -#include +#include #include + +#include #include #include -#include #include +#include +#include +#include #include -#include -#include -#include -#include "Common/Exception.h" -#include "Core/SettingsEnums.h" +#include namespace DB @@ -29,14 +28,11 @@ namespace DB namespace ErrorCodes { extern const int NOT_IMPLEMENTED; - extern const int TOO_MANY_ROWS; extern const int LOGICAL_ERROR; } -constexpr size_t EMPTY_VALUE_IDX = std::numeric_limits::max(); using JoinKind = ASTTableJoin::Kind; - namespace { @@ -49,7 +45,6 @@ FullMergeJoinCursorPtr createCursor(const Block & block, const Names & columns) return std::make_unique(block, desc); } - template int nullableCompareAt(const IColumn & left_column, const IColumn & right_column, size_t lhs_pos, size_t rhs_pos, int null_direction_hint = 1) { @@ -100,16 +95,8 @@ int ALWAYS_INLINE compareCursors(const SortCursorImpl & lhs, size_t lpos, { for (size_t i = 0; i < lhs.sort_columns_size; ++i) { - const auto & desc = lhs.desc[i]; - int direction = desc.direction; - int nulls_direction = desc.nulls_direction; - - int cmp = direction * nullableCompareAt( - *lhs.sort_columns[i], - *rhs.sort_columns[i], - lpos, - rpos, - nulls_direction); + /// TODO(@vdimir): use nullableCompareAt only if there's nullable columns + int cmp = nullableCompareAt(*lhs.sort_columns[i], *rhs.sort_columns[i], lpos, rpos); if (cmp != 0) return cmp; } @@ -246,9 +233,7 @@ MergeJoinAlgorithm::MergeJoinAlgorithm( static ColumnPtr replicateRow(const IColumn & column, size_t pos, size_t num) { MutableColumnPtr res = column.cloneEmpty(); - LOG_DEBUG(&Poco::Logger::get("XXXX"), "{}:{} replicateRow {} | {} | {}", __FILE__, __LINE__, column.dumpStructure(), pos, num); res->insertManyFrom(column, pos, num); - LOG_DEBUG(&Poco::Logger::get("XXXX"), "{}:{} replicateRow >>> {} | {} | {}", __FILE__, __LINE__, res->dumpStructure(), pos, num); return res; } @@ -333,11 +318,6 @@ void MergeJoinAlgorithm::consume(Input & input, size_t source_num) if (input.permutation) throw DB::Exception("permutation is not supported", ErrorCodes::NOT_IMPLEMENTED); - LOG_DEBUG(log, "XXXX: consume from {} chunk: {}", source_num, input.chunk.getNumRows()); - - if (input.chunk.getNumRows() >= EMPTY_VALUE_IDX) - throw Exception("Too many rows in input", ErrorCodes::TOO_MANY_ROWS); - if (input.chunk) { stat.num_blocks[source_num] += 1; @@ -346,8 +326,6 @@ void MergeJoinAlgorithm::consume(Input & input, size_t source_num) prepareChunk(input.chunk); cursors[source_num]->setChunk(std::move(input.chunk)); - - // stat.max_blocks_loaded = std::max(stat.max_blocks_loaded, std::max(cursors[0]->blocksCount(), cursors[1]->blocksCount())); } static Chunk getRowFromChunk(const Chunk & chunk, size_t pos) @@ -429,16 +407,22 @@ struct AllJoinImpl else if (cmp < 0) { size_t num = nextDistinct(left_cursor.cursor); - right_map.resize_fill(right_map.size() + num, right_cursor->rows); - for (size_t i = lpos; i < left_cursor->getRow(); ++i) - left_map.push_back(i); + if constexpr (isLeft(kind)) + { + right_map.resize_fill(right_map.size() + num, right_cursor->rows); + for (size_t i = lpos; i < left_cursor->getRow(); ++i) + left_map.push_back(i); + } } else { size_t num = nextDistinct(right_cursor.cursor); - left_map.resize_fill(left_map.size() + num, left_cursor->rows); - for (size_t i = rpos; i < right_cursor->getRow(); ++i) - right_map.push_back(i); + if constexpr (isRight(kind)) + { + left_map.resize_fill(left_map.size() + num, left_cursor->rows); + for (size_t i = rpos; i < right_cursor->getRow(); ++i) + right_map.push_back(i); + } } } } @@ -461,7 +445,7 @@ void dispatchKind(JoinKind kind, Args && ... args) __builtin_unreachable(); } -MergeJoinAlgorithm::Status MergeJoinAlgorithm::allJoin(JoinKind kind) +std::optional MergeJoinAlgorithm::handleAllJoinState() { if (all_join_state && all_join_state->finished()) { @@ -473,7 +457,7 @@ MergeJoinAlgorithm::Status MergeJoinAlgorithm::allJoin(JoinKind kind) /// Accumulate blocks with same key in all_join_state for (size_t i = 0; i < cursors.size(); ++i) { - if (cursors[i]->cursor.isValid() && all_join_state->left_key.equals(cursors[i]->cursor)) + if (cursors[i]->cursor.isValid() && all_join_state->keys[i].equals(cursors[i]->cursor)) { size_t pos = cursors[i]->cursor.getRow(); size_t num = nextDistinct(cursors[i]->cursor); @@ -490,6 +474,8 @@ MergeJoinAlgorithm::Status MergeJoinAlgorithm::allJoin(JoinKind kind) } /// If current position is valid, then we've found new key, can join accumulated data + stat.max_blocks_loaded = std::max(stat.max_blocks_loaded, all_join_state->blocksStored()); + /// join all rows with current key MutableColumns result_cols; for (size_t i = 0; i < 2; ++i) @@ -521,14 +507,17 @@ MergeJoinAlgorithm::Status MergeJoinAlgorithm::allJoin(JoinKind kind) if (total_rows) return Status(Chunk(std::move(result_cols), total_rows)); } + return {}; +} +MergeJoinAlgorithm::Status MergeJoinAlgorithm::allJoin(JoinKind kind) +{ auto left_map = ColumnUInt64::create(); auto right_map = ColumnUInt64::create(); size_t prev_pos[] = {cursors[0]->cursor.getRow(), cursors[1]->cursor.getRow()}; dispatchKind(kind, *cursors[0], *cursors[1], max_block_size, left_map->getData(), right_map->getData(), all_join_state); - LOG_DEBUG(&Poco::Logger::get("XXXX"), "{}:{} left_map->size({}) == right_map->size({})", - __FILE__, __LINE__, left_map->size(), right_map->size()); + assert(left_map->empty() || right_map->empty() || left_map->size() == right_map->size()); size_t num_result_rows = std::max(left_map->size(), right_map->size()); @@ -540,153 +529,134 @@ MergeJoinAlgorithm::Status MergeJoinAlgorithm::allJoin(JoinKind kind) template -static void anyJoinImpl(FullMergeJoinCursor & left_cursor, FullMergeJoinCursor & right_cursor, - PaddedPODArray & left_map, PaddedPODArray & right_map, - AnyJoinState & state) +struct AnyJoinImpl { - static_assert(kind == JoinKind::Left || kind == JoinKind::Right || kind == JoinKind::Inner, "Invalid join kind"); + constexpr static bool enabled = isInner(kind) || isLeft(kind) || isRight(kind); - size_t num_rows = isLeft(kind) ? left_cursor->rowsLeft() : - isRight(kind) ? right_cursor->rowsLeft() : - std::min(left_cursor->rowsLeft(), right_cursor->rowsLeft()); - - if constexpr (isLeft(kind) || isInner(kind)) - right_map.reserve(num_rows); - - if constexpr (isRight(kind) || isInner(kind)) - left_map.reserve(num_rows); - - size_t rpos = std::numeric_limits::max(); - size_t lpos = std::numeric_limits::max(); - assert(left_cursor->isValid() && right_cursor->isValid()); - int cmp = 0; - while (left_cursor->isValid() && right_cursor->isValid()) + static void join(FullMergeJoinCursor & left_cursor, + FullMergeJoinCursor & right_cursor, + PaddedPODArray & left_map, + PaddedPODArray & right_map, + AnyJoinState & state) { - lpos = left_cursor->getRow(); - rpos = right_cursor->getRow(); + size_t num_rows = isLeft(kind) ? left_cursor->rowsLeft() : + isRight(kind) ? right_cursor->rowsLeft() : + std::min(left_cursor->rowsLeft(), right_cursor->rowsLeft()); - cmp = compareCursors(left_cursor.cursor, right_cursor.cursor); - if (cmp == 0) + if constexpr (isLeft(kind) || isInner(kind)) + right_map.reserve(num_rows); + + if constexpr (isRight(kind) || isInner(kind)) + left_map.reserve(num_rows); + + size_t rpos = std::numeric_limits::max(); + size_t lpos = std::numeric_limits::max(); + assert(left_cursor->isValid() && right_cursor->isValid()); + int cmp = 0; + while (left_cursor->isValid() && right_cursor->isValid()) { - if constexpr (isLeft(kind)) - { - size_t lnum = nextDistinct(left_cursor.cursor); - right_map.resize_fill(right_map.size() + lnum, rpos); - } + lpos = left_cursor->getRow(); + rpos = right_cursor->getRow(); - if constexpr (isRight(kind)) + cmp = compareCursors(left_cursor.cursor, right_cursor.cursor); + if (cmp == 0) { - size_t rnum = nextDistinct(right_cursor.cursor); - left_map.resize_fill(left_map.size() + rnum, lpos); - } + if constexpr (isLeft(kind)) + { + size_t lnum = nextDistinct(left_cursor.cursor); + right_map.resize_fill(right_map.size() + lnum, rpos); + } - if constexpr (isInner(kind)) + if constexpr (isRight(kind)) + { + size_t rnum = nextDistinct(right_cursor.cursor); + left_map.resize_fill(left_map.size() + rnum, lpos); + } + + if constexpr (isInner(kind)) + { + nextDistinct(left_cursor.cursor); + nextDistinct(right_cursor.cursor); + left_map.emplace_back(lpos); + right_map.emplace_back(rpos); + } + } + else if (cmp < 0) { - nextDistinct(left_cursor.cursor); - nextDistinct(right_cursor.cursor); - left_map.emplace_back(lpos); - right_map.emplace_back(rpos); + size_t num = nextDistinct(left_cursor.cursor); + if constexpr (isLeft(kind)) + right_map.resize_fill(right_map.size() + num, right_cursor->rows); + } + else + { + size_t num = nextDistinct(right_cursor.cursor); + if constexpr (isRight(kind)) + left_map.resize_fill(left_map.size() + num, left_cursor->rows); } } - else if (cmp < 0) + + /// Remember index of last joined row to propagate it to next block + + state.setValue({}); + if (!left_cursor->isValid()) { - size_t num = nextDistinct(left_cursor.cursor); - if constexpr (isLeft(kind)) - right_map.resize_fill(right_map.size() + num, right_cursor->rows); + state.set(0, left_cursor.cursor); + if (cmp == 0 && isLeft(kind)) + state.setValue(getRowFromChunk(right_cursor.getCurrent(), rpos)); + } + + if (!right_cursor->isValid()) + { + state.set(1, right_cursor.cursor); + if (cmp == 0 && isRight(kind)) + state.setValue(getRowFromChunk(left_cursor.getCurrent(), lpos)); + } + } +}; + +std::optional MergeJoinAlgorithm::handleAnyJoinState() +{ + if (any_join_state.empty()) + return {}; + + auto kind = table_join->getTableJoin().kind(); + + Chunk result; + + for (size_t source_num = 0; source_num < 2; ++source_num) + { + auto & current = *cursors[source_num]; + auto & state = any_join_state; + if (any_join_state.keys[source_num].equals(current.cursor)) + { + size_t start_pos = current->getRow(); + size_t length = nextDistinct(current.cursor); + if (length && isLeft(kind) && source_num == 0) + result = createBlockWithDefaults(current.getCurrent(), state.value ? state.value : sample_chunks[1 - source_num], start_pos, length); + if (length && isRight(kind) && source_num == 1) + result = createBlockWithDefaults(state.value ? state.value : sample_chunks[1 - source_num], current.getCurrent(), start_pos, length); + + /// We've found row with other key, no need to skip more rows with current key + if (current->isValid()) + { + state.keys[source_num].reset(); + } } else { - size_t num = nextDistinct(right_cursor.cursor); - if constexpr (isRight(kind)) - left_map.resize_fill(left_map.size() + num, left_cursor->rows); + any_join_state.keys[source_num].reset(); } } - /// Remember index of last joined row to propagate it to next block - - state.setValue({}); - if (!left_cursor->isValid()) - { - state.set(0, left_cursor.cursor); - if (cmp == 0 && isLeft(kind)) - state.setValue(getRowFromChunk(right_cursor.getCurrent(), rpos)); - } - - if (!right_cursor->isValid()) - { - state.set(1, right_cursor.cursor); - if (cmp == 0 && isRight(kind)) - state.setValue(getRowFromChunk(left_cursor.getCurrent(), lpos)); - } -} - -static void anyJoinDispatch(JoinKind kind, - FullMergeJoinCursor & left_cursor, - FullMergeJoinCursor & right_cursor, - PaddedPODArray & left_map, - PaddedPODArray & right_map, - AnyJoinState & state) -{ - if (isInner(kind)) - { - return anyJoinImpl(left_cursor, right_cursor, left_map, right_map, state); - } - else if (isLeft(kind)) - { - return anyJoinImpl(left_cursor, right_cursor, left_map, right_map, state); - } - else if (isRight(kind)) - { - return anyJoinImpl(left_cursor, right_cursor, left_map, right_map, state); - } - else - { - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported join kind: \"{}\"", kind); - } - __builtin_unreachable(); -} - -static bool handleAnyJoinState(JoinKind kind, - size_t source_num, - AnyJoinState & state, - FullMergeJoinCursor & current, - const Chunk & sample_chunk, - Chunk & result) -{ - bool has_more = state.keys[source_num].equals(current.cursor); - if (has_more) - { - size_t start_pos = current->getRow(); - size_t length = nextDistinct(current.cursor); - if (length && isLeft(kind) && source_num == 0) - result = createBlockWithDefaults(current.getCurrent(), state.value ? state.value : sample_chunk, start_pos, length); - if (length && isRight(kind) && source_num == 1) - result = createBlockWithDefaults(state.value ? state.value : sample_chunk, current.getCurrent(), start_pos, length); - - /// We've found row with other key, no need to skip more rows with current key - if (current->isValid()) - has_more = false; - } - return !has_more; + if (result) + return Status(std::move(result)); + return {}; } MergeJoinAlgorithm::Status MergeJoinAlgorithm::anyJoin(JoinKind kind) { - if (!any_join_state.empty()) - { - Chunk result; - - bool left_finished = handleAnyJoinState(kind, 0, any_join_state, *cursors[0], sample_chunks[1], result); - if (left_finished) - any_join_state.keys[0].reset(); - - bool right_finished = handleAnyJoinState(kind, 1, any_join_state, *cursors[1], sample_chunks[0], result); - if (right_finished) - any_join_state.keys[1].reset(); - - if (result) - return Status(std::move(result)); - } + if (auto result = handleAnyJoinState()) + return std::move(*result); auto & current_left = cursors[0]->cursor; if (!current_left.isValid()) @@ -700,7 +670,7 @@ MergeJoinAlgorithm::Status MergeJoinAlgorithm::anyJoin(JoinKind kind) auto right_map = ColumnUInt64::create(); size_t prev_pos[] = {current_left.getRow(), current_right.getRow()}; - anyJoinDispatch(kind, *cursors[0], *cursors[1], left_map->getData(), right_map->getData(), any_join_state); + dispatchKind(kind, *cursors[0], *cursors[1], left_map->getData(), right_map->getData(), any_join_state); assert(left_map->empty() || right_map->empty() || left_map->size() == right_map->size()); size_t num_result_rows = std::max(left_map->size(), right_map->size()); @@ -711,19 +681,20 @@ MergeJoinAlgorithm::Status MergeJoinAlgorithm::anyJoin(JoinKind kind) return Status(std::move(result)); } -IMergingAlgorithm::Status MergeJoinAlgorithm::mergeImpl() +IMergingAlgorithm::Status MergeJoinAlgorithm::merge() { auto kind = table_join->getTableJoin().kind(); auto strictness = table_join->getTableJoin().strictness(); - LOG_DEBUG(log, "XXXX: merge, {} {}", kind, strictness); - if (!cursors[0]->cursor.isValid() && !cursors[0]->fullyCompleted()) return Status(0); if (!cursors[1]->cursor.isValid() && !cursors[1]->fullyCompleted()) return Status(1); + if (auto result = handleAllJoinState()) + return std::move(*result); + if (cursors[0]->fullyCompleted() || cursors[1]->fullyCompleted()) { if (!cursors[0]->fullyCompleted() && isLeftOrFull(kind)) @@ -772,7 +743,7 @@ MergeJoinTransform::MergeJoinTransform( : IMergingTransform(input_headers, output_header, true, limit_hint, table_join, input_headers, max_block_size) , log(&Poco::Logger::get("MergeJoinTransform")) { - LOG_TRACE(log, "Will use MergeJoinTransform"); + LOG_TRACE(log, "Use MergeJoinTransform"); } void MergeJoinTransform::onFinish() @@ -780,5 +751,4 @@ void MergeJoinTransform::onFinish() algorithm.onFinish(total_stopwatch.elapsedSeconds()); } - } diff --git a/src/Processors/Transforms/MergeJoinTransform.h b/src/Processors/Transforms/MergeJoinTransform.h index 5283f09009b..eba4291f065 100644 --- a/src/Processors/Transforms/MergeJoinTransform.h +++ b/src/Processors/Transforms/MergeJoinTransform.h @@ -79,8 +79,9 @@ struct JoinKeyRow } }; -struct AnyJoinState : boost::noncopyable +class AnyJoinState : boost::noncopyable { +public: AnyJoinState() = default; void set(size_t source_num, const SortCursorImpl & cursor) @@ -103,8 +104,9 @@ struct AnyJoinState : boost::noncopyable Chunk value; }; -struct AllJoinState : boost::noncopyable +class AllJoinState : boost::noncopyable { +public: struct Range { Range() = default; @@ -127,8 +129,7 @@ struct AllJoinState : boost::noncopyable AllJoinState(const SortCursorImpl & lcursor, size_t lpos, const SortCursorImpl & rcursor, size_t rpos) - : left_key(lcursor, lpos) - , right_key(rcursor, rpos) + : keys{JoinKeyRow(lcursor, lpos), JoinKeyRow(rcursor, rpos)} { } @@ -156,6 +157,14 @@ struct AllJoinState : boost::noncopyable bool finished() const { return lidx >= left.size(); } + size_t blocksStored() const { return left.size() + right.size(); } + const Range & getLeft() const { return left[lidx]; } + const Range & getRight() const { return right[ridx]; } + + /// Left and right types can be different because of nullable + JoinKeyRow keys[2]; + +private: bool nextLeft() { lidx += 1; @@ -179,17 +188,9 @@ struct AllJoinState : boost::noncopyable } return true; } - - const Range & getLeft() const { return left[lidx]; } - const Range & getRight() const { return right[ridx]; } - std::vector left; std::vector right; - /// Left and right types can be different because of nullable - JoinKeyRow left_key; - JoinKeyRow right_key; - size_t lidx = 0; size_t ridx = 0; }; @@ -236,13 +237,7 @@ public: virtual void initialize(Inputs inputs) override; virtual void consume(Input & input, size_t source_num) override; - virtual Status merge() override - { - Status result = mergeImpl(); - LOG_TRACE(log, "XXXX: merge result: chunk: {}, required: {}, finished: {}", - result.chunk.getNumRows(), result.required_source, result.is_finished); - return result ; - } + virtual Status merge() override; void onFinish(double seconds) { @@ -255,9 +250,10 @@ public: } private: - Status mergeImpl(); - + std::optional handleAnyJoinState(); Status anyJoin(ASTTableJoin::Kind kind); + + std::optional handleAllJoinState(); Status allJoin(ASTTableJoin::Kind kind); std::vector cursors; diff --git a/tests/queries/0_stateless/02273_full_sort_join.reference b/tests/queries/0_stateless/02273_full_sort_join.reference index d8680824040..360a1540b8d 100644 --- a/tests/queries/0_stateless/02273_full_sort_join.reference +++ b/tests/queries/0_stateless/02273_full_sort_join.reference @@ -1,11 +1,12 @@ -simple cases, block size = 1 -ANY INNER +ALL INNER | bs = 1 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 1 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -21,7 +22,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 1 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -34,14 +35,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 2 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 2 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 2 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -57,7 +61,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 2 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -70,14 +74,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 3 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 3 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 3 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -93,7 +100,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 3 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -106,14 +113,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 4 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 4 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 4 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -129,7 +139,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 4 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -142,14 +152,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 5 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 5 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 5 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -165,7 +178,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 5 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -178,14 +191,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 6 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 6 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 6 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -201,7 +217,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 6 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -214,14 +230,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 7 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 7 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 7 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -237,7 +256,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 7 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -250,14 +269,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 8 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 8 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 8 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -273,7 +295,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 8 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -286,14 +308,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 9 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 9 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 9 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -309,7 +334,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 9 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -322,14 +347,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 10 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 10 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 10 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -345,7 +373,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 10 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -358,14 +386,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 11 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 11 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 11 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -381,7 +412,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 11 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -394,14 +425,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 12 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 12 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 12 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -417,7 +451,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 12 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -430,14 +464,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 13 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 13 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 13 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -453,7 +490,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 13 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -466,14 +503,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 14 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 14 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 14 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -489,7 +529,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 14 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -502,14 +542,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases, block size = 15 -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | bs = 15 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | bs = 15 1 1 val5 0 2 0 val9 1 3 3 val10 0 @@ -525,7 +568,7 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 0 val6 1 -ANY RIGHT +ALL RIGHT | bs = 15 0 8 1 val2 0 8 1 val4 0 9 1 val5 @@ -538,14 +581,17 @@ ANY RIGHT 7 7 0 val8 13 13 0 val1 14 14 0 val7 -simple cases: join_use_nulls -ANY INNER +14 14 0 val7 +14 14 0 val7 +ALL INNER | join_use_nulls = 1 1 1 0 0 3 3 0 0 7 7 0 0 13 13 0 0 14 14 0 0 -ANY LEFT +14 14 0 0 +14 14 0 0 +ALL LEFT | join_use_nulls = 1 1 1 val5 0 2 \N val9 1 3 3 val10 0 @@ -561,7 +607,569 @@ ANY LEFT 14 14 val13 0 14 14 val4 0 15 \N val6 1 -ANY RIGHT +ALL RIGHT | join_use_nulls = 1 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +14 14 0 val7 +14 14 0 val7 +\N 8 1 val2 +\N 8 1 val4 +\N 9 1 val5 +\N 12 1 val0 +\N 12 1 val11 +\N 12 1 val3 +\N 12 1 val9 +ANY INNER | bs = 1 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 1 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 1 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 2 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 2 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 2 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 3 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 3 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 3 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 4 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 4 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 4 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 5 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 5 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 5 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 6 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 6 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 6 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 7 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 7 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 7 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 8 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 8 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 8 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 9 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 9 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 9 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 10 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 10 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 10 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 11 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 11 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 11 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 12 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 12 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 12 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 13 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 13 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 13 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 14 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 14 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 14 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | bs = 15 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | bs = 15 +1 1 val5 0 +2 \N val9 \N +3 3 val10 0 +4 \N val12 \N +5 \N val11 \N +6 \N val7 \N +7 7 val14 0 +10 \N val3 \N +10 \N val8 \N +11 \N val0 \N +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 \N +ANY RIGHT | bs = 15 +1 1 0 val6 +3 3 0 val10 +7 7 0 val8 +13 13 0 val1 +14 14 0 val7 +\N 8 \N val2 +\N 8 \N val4 +\N 9 \N val5 +\N 12 \N val0 +\N 12 \N val11 +\N 12 \N val3 +\N 12 \N val9 +ANY INNER | join_use_nulls = 1 +1 1 0 0 +3 3 0 0 +7 7 0 0 +13 13 0 0 +14 14 0 0 +ANY LEFT | join_use_nulls = 1 +1 1 val5 0 +2 \N val9 1 +3 3 val10 0 +4 \N val12 1 +5 \N val11 1 +6 \N val7 1 +7 7 val14 0 +10 \N val3 1 +10 \N val8 1 +11 \N val0 1 +13 13 val2 0 +14 14 val1 0 +14 14 val13 0 +14 14 val4 0 +15 \N val6 1 +ANY RIGHT | join_use_nulls = 1 1 1 0 val6 3 3 0 val10 7 7 0 val8 diff --git a/tests/queries/0_stateless/02273_full_sort_join.sql.j2 b/tests/queries/0_stateless/02273_full_sort_join.sql.j2 index 9f4e5f92648..6737cede6cd 100644 --- a/tests/queries/0_stateless/02273_full_sort_join.sql.j2 +++ b/tests/queries/0_stateless/02273_full_sort_join.sql.j2 @@ -18,31 +18,30 @@ INSERT INTO t2 'val' || toString(number) as s FROM numbers_mt({{ table_size - 3 }}); -SET join_algorithm = 'full_sorting_merge'; +-- SET join_algorithm = 'full_sorting_merge'; -{% for block_size in range (1, table_size + 1) -%} +{% for kind in ['ALL', 'ANY'] -%} +{% for block_size in range(1, table_size + 1) -%} SET max_block_size = {{ block_size }}; -SELECT 'simple cases, block size = {{ block_size }}'; - -SELECT 'ANY INNER'; +SELECT '{{ kind }} INNER | bs = {{ block_size }}'; SELECT t1.key, t2.key, empty(t1.s), empty(t2.s) FROM t1 -ANY INNER JOIN t2 +{{ kind }} INNER JOIN t2 ON t1.key == t2.key ORDER BY t1.key, t2.key ; -SELECT 'ANY LEFT'; +SELECT '{{ kind }} LEFT | bs = {{ block_size }}'; SELECT t1.key, t2.key, t1.s, empty(t2.s) FROM t1 -ANY LEFT JOIN t2 +{{ kind }} LEFT JOIN t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t1.s ; -SELECT 'ANY RIGHT'; +SELECT '{{ kind }} RIGHT | bs = {{ block_size }}'; SELECT t1.key, t2.key, empty(t1.s), t2.s FROM t1 -ANY RIGHT JOIN t2 +{{ kind }} RIGHT JOIN t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t2.s ; @@ -51,25 +50,25 @@ ORDER BY t1.key, t2.key, t2.s SET join_use_nulls = 1; -SELECT 'simple cases: join_use_nulls'; - -SELECT 'ANY INNER'; +SELECT '{{ kind }} INNER | join_use_nulls = 1'; SELECT t1.key, t2.key, isNull(t1.s), isNull(t2.s) FROM t1 -ANY INNER JOIN t2 +{{ kind }} INNER JOIN t2 ON t1.key == t2.key ORDER BY t1.key, t2.key ; -SELECT 'ANY LEFT'; +SELECT '{{ kind }} LEFT | join_use_nulls = 1'; SELECT t1.key, t2.key, t1.s, isNull(t2.s) FROM t1 -ANY LEFT JOIN t2 +{{ kind }} LEFT JOIN t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t1.s ; -SELECT 'ANY RIGHT'; +SELECT '{{ kind }} RIGHT | join_use_nulls = 1'; SELECT t1.key, t2.key, isNull(t1.s), t2.s FROM t1 -ANY RIGHT JOIN t2 +{{ kind }} RIGHT JOIN t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t2.s ; + +{% endfor -%} diff --git a/tests/queries/0_stateless/02274_full_sort_join_nodistinct.reference b/tests/queries/0_stateless/02274_full_sort_join_nodistinct.reference index f140d841375..99336d442b2 100644 --- a/tests/queries/0_stateless/02274_full_sort_join_nodistinct.reference +++ b/tests/queries/0_stateless/02274_full_sort_join_nodistinct.reference @@ -1,9 +1,168 @@ block size = 1 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 1 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 1 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 1 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 1 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 1 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -13,7 +172,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 1 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -24,10 +183,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 1 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 1 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -37,7 +198,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 1 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -48,10 +209,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 1 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 1 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 1 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 1 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 1 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -61,7 +248,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 1 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -72,10 +259,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 1 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 1 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 1 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 1 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 1 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -85,7 +298,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 1 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 1 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 1 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 1 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -97,11 +334,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 2 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 2 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 2 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 2 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 2 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 2 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -111,7 +507,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 2 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -122,10 +518,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 2 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 2 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -135,7 +533,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 2 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -146,10 +544,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 2 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 2 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 2 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 2 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 2 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -159,7 +583,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 2 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -170,10 +594,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 2 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 2 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 2 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 2 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 2 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -183,7 +633,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 2 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 2 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 2 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 2 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -195,11 +669,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 3 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 3 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 3 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 3 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 3 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 3 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -209,7 +842,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 3 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -220,10 +853,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 3 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 3 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -233,7 +868,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 3 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -244,10 +879,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 3 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 3 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 3 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 3 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 3 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -257,7 +918,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 3 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -268,10 +929,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 3 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 3 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 3 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 3 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 3 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -281,7 +968,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 3 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 3 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 3 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 3 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -293,11 +1004,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 4 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 4 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 4 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 4 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 4 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 4 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -307,7 +1177,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 4 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -318,10 +1188,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 4 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 4 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -331,7 +1203,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 4 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -342,10 +1214,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 4 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 4 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 4 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 4 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 4 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -355,7 +1253,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 4 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -366,10 +1264,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 4 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 4 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 4 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 4 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 4 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -379,7 +1303,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 4 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 4 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 4 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 4 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -391,11 +1339,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 5 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 5 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 5 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 5 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 5 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 5 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -405,7 +1512,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 5 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -416,10 +1523,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 5 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 5 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -429,7 +1538,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 5 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -440,10 +1549,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 5 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 5 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 5 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 5 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -453,7 +1588,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 5 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -464,10 +1599,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 5 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 5 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 5 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 5 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 5 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -477,7 +1638,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 5 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 5 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 5 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 5 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -489,11 +1674,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 6 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 6 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 6 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 6 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 6 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 6 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -503,7 +1847,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 6 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -514,10 +1858,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 6 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 6 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -527,7 +1873,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 6 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -538,10 +1884,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 6 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 6 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 6 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 6 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 6 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -551,7 +1923,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 6 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -562,10 +1934,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 6 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 6 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 6 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 6 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 6 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -575,7 +1973,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 6 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 6 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 6 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 6 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -587,11 +2009,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 7 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 7 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 7 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 7 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 7 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 7 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -601,7 +2182,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 7 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -612,10 +2193,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 7 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 7 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -625,7 +2208,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 7 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -636,10 +2219,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 7 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 7 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 7 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 7 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 7 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -649,7 +2258,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 7 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -660,10 +2269,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 7 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 7 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 7 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 7 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 7 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -673,7 +2308,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 7 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 7 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 7 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 7 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -685,11 +2344,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 8 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 8 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 8 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 8 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 8 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 8 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -699,7 +2517,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 8 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -710,10 +2528,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 8 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 8 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -723,7 +2543,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 8 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -734,10 +2554,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 8 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 8 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 8 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 8 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 8 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -747,7 +2593,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 8 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -758,10 +2604,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 8 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 8 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 8 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 8 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 8 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -771,7 +2643,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 8 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 8 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 8 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 8 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -783,11 +2679,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 9 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 9 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 9 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 9 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 9 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 9 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -797,7 +2852,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 9 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -808,10 +2863,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 9 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 9 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -821,7 +2878,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 9 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -832,10 +2889,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 9 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 9 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 9 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 9 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 9 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -845,7 +2928,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 9 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -856,10 +2939,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 9 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 9 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 9 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 9 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 9 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -869,7 +2978,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 9 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 9 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 9 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 9 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -881,11 +3014,170 @@ ANY RIGHT \N \N 0 val27 \N \N 0 val28 block size = 10 -ANY INNER +t1 ALL INNER JOIN t2 | bs = 10 +1 1 4 5 +1 1 4 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +2 2 5 5 +3 3 4 4 +t1 ALL LEFT JOIN t2 | bs = 10 +1 1 val1 5 +1 1 val1 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val21 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val22 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val23 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val24 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val25 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val26 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +2 2 val27 5 +3 3 val3 4 +t1 ALL RIGHT JOIN t2 | bs = 10 +1 1 4 val11 +1 1 4 val12 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val22 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val23 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val24 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val25 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val26 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val27 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +2 2 5 val28 +3 3 4 val3 +t1 ANY INNER JOIN t2 | bs = 10 1 1 4 5 2 2 5 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN t2 | bs = 10 1 1 val1 5 2 2 val21 5 2 2 val22 5 @@ -895,7 +3187,7 @@ ANY LEFT 2 2 val26 5 2 2 val27 5 3 3 val3 4 -ANY RIGHT +t1 ANY RIGHT JOIN t2 | bs = 10 1 1 4 val11 1 1 4 val12 2 2 5 val22 @@ -906,10 +3198,12 @@ ANY RIGHT 2 2 5 val27 2 2 5 val28 3 3 4 val3 -ANY INNER +t1 ALL INNER JOIN tn2 | bs = 10 +1 1 4 5 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ALL LEFT JOIN tn2 | bs = 10 +1 1 val1 5 1 1 val1 5 2 \N val21 0 2 \N val22 0 @@ -919,7 +3213,7 @@ ANY LEFT 2 \N val26 0 2 \N val27 0 3 3 val3 4 -ANY RIGHT +t1 ALL RIGHT JOIN tn2 | bs = 10 0 \N 0 val22 0 \N 0 val23 0 \N 0 val24 @@ -930,10 +3224,36 @@ ANY RIGHT 1 1 4 val11 1 1 4 val12 3 3 4 val3 -ANY INNER +t1 ANY INNER JOIN tn2 | bs = 10 1 1 4 5 3 3 4 4 -ANY LEFT +t1 ANY LEFT JOIN tn2 | bs = 10 +1 1 val1 5 +2 \N val21 0 +2 \N val22 0 +2 \N val23 0 +2 \N val24 0 +2 \N val25 0 +2 \N val26 0 +2 \N val27 0 +3 3 val3 4 +t1 ANY RIGHT JOIN tn2 | bs = 10 +0 \N 0 val22 +0 \N 0 val23 +0 \N 0 val24 +0 \N 0 val25 +0 \N 0 val26 +0 \N 0 val27 +0 \N 0 val28 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +tn1 ALL INNER JOIN t2 | bs = 10 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN t2 | bs = 10 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N 0 val21 0 @@ -943,7 +3263,7 @@ ANY LEFT \N 0 val25 0 \N 0 val26 0 \N 0 val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN t2 | bs = 10 1 1 4 val11 1 1 4 val12 3 3 4 val3 @@ -954,10 +3274,36 @@ ANY RIGHT \N 2 0 val26 \N 2 0 val27 \N 2 0 val28 -ANY INNER +tn1 ANY INNER JOIN t2 | bs = 10 1 1 4 5 3 3 4 4 -ANY LEFT +tn1 ANY LEFT JOIN t2 | bs = 10 +1 1 val1 5 +3 3 val3 4 +\N 0 val21 0 +\N 0 val22 0 +\N 0 val23 0 +\N 0 val24 0 +\N 0 val25 0 +\N 0 val26 0 +\N 0 val27 0 +tn1 ANY RIGHT JOIN t2 | bs = 10 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N 2 0 val22 +\N 2 0 val23 +\N 2 0 val24 +\N 2 0 val25 +\N 2 0 val26 +\N 2 0 val27 +\N 2 0 val28 +tn1 ALL INNER JOIN tn2 | bs = 10 +1 1 4 5 +1 1 4 5 +3 3 4 4 +tn1 ALL LEFT JOIN tn2 | bs = 10 +1 1 val1 5 1 1 val1 5 3 3 val3 4 \N \N val21 0 @@ -967,7 +3313,31 @@ ANY LEFT \N \N val25 0 \N \N val26 0 \N \N val27 0 -ANY RIGHT +tn1 ALL RIGHT JOIN tn2 | bs = 10 +1 1 4 val11 +1 1 4 val12 +3 3 4 val3 +\N \N 0 val22 +\N \N 0 val23 +\N \N 0 val24 +\N \N 0 val25 +\N \N 0 val26 +\N \N 0 val27 +\N \N 0 val28 +tn1 ANY INNER JOIN tn2 | bs = 10 +1 1 4 5 +3 3 4 4 +tn1 ANY LEFT JOIN tn2 | bs = 10 +1 1 val1 5 +3 3 val3 4 +\N \N val21 0 +\N \N val22 0 +\N \N val23 0 +\N \N val24 0 +\N \N val25 0 +\N \N val26 0 +\N \N val27 0 +tn1 ANY RIGHT JOIN tn2 | bs = 10 1 1 4 val11 1 1 4 val12 3 3 4 val3 diff --git a/tests/queries/0_stateless/02274_full_sort_join_nodistinct.sql.j2 b/tests/queries/0_stateless/02274_full_sort_join_nodistinct.sql.j2 index bb54f49b754..082464aa081 100644 --- a/tests/queries/0_stateless/02274_full_sort_join_nodistinct.sql.j2 +++ b/tests/queries/0_stateless/02274_full_sort_join_nodistinct.sql.j2 @@ -1,36 +1,38 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS tn1; +DROP TABLE IF EXISTS tn2; CREATE TABLE t1 (key UInt32, s String) engine = TinyLog; CREATE TABLE tn1 (key Nullable(UInt32), s String) engine = TinyLog; CREATE TABLE t2 (key UInt32, s String) engine = TinyLog; CREATE TABLE tn2 (key Nullable(UInt32), s String) engine = TinyLog; -{% set table_size = 10 %} - INSERT INTO t1 VALUES (1, 'val1'), (2, 'val21'), (2, 'val22'), (2, 'val23'), (2, 'val24'), (2, 'val25'), (2, 'val26'), (2, 'val27'), (3, 'val3'); INSERT INTO tn1 VALUES (1, 'val1'), (NULL, 'val21'), (NULL, 'val22'), (NULL, 'val23'), (NULL, 'val24'), (NULL, 'val25'), (NULL, 'val26'), (NULL, 'val27'), (3, 'val3'); INSERT INTO t2 VALUES (1, 'val11'), (1, 'val12'), (2, 'val22'), (2, 'val23'), (2, 'val24'), (2, 'val25'), (2, 'val26'), (2, 'val27'), (2, 'val28'), (3, 'val3'); INSERT INTO tn2 VALUES (1, 'val11'), (1, 'val12'), (NULL, 'val22'), (NULL, 'val23'), (NULL, 'val24'), (NULL, 'val25'), (NULL, 'val26'), (NULL, 'val27'), (NULL, 'val28'), (3, 'val3'); -SET join_algorithm = 'full_sorting_merge'; +-- SET join_algorithm = 'full_sorting_merge'; -{% for block_size in range (1, table_size + 1) -%} +{% for block_size in range(1, 11) -%} SET max_block_size = {{ block_size }}; SELECT 'block size = {{ block_size }}'; {% for t1, t2 in [('t1', 't2'), ('t1', 'tn2'), ('tn1', 't2'), ('tn1', 'tn2')] -%} +{% for kind in ['ALL', 'ANY'] -%} -SELECT 'ANY INNER'; -SELECT t1.key, t2.key, length(t1.s), length(t2.s) FROM {{ t1 }} AS t1 ANY INNER JOIN {{ t2 }} AS t2 ON t1.key == t2.key ORDER BY t1.key, t2.key; +SELECT '{{ t1 }} {{ kind }} INNER JOIN {{ t2 }} | bs = {{ block_size }}'; +SELECT t1.key, t2.key, length(t1.s), length(t2.s) FROM {{ t1 }} AS t1 {{ kind }} INNER JOIN {{ t2 }} AS t2 ON t1.key == t2.key ORDER BY t1.key, t2.key; -SELECT 'ANY LEFT'; -SELECT t1.key, t2.key, t1.s, length(t2.s) FROM {{ t1 }} AS t1 ANY LEFT JOIN {{ t2 }} AS t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t1.s; +SELECT '{{ t1 }} {{ kind }} LEFT JOIN {{ t2 }} | bs = {{ block_size }}'; +SELECT t1.key, t2.key, t1.s, length(t2.s) FROM {{ t1 }} AS t1 {{ kind }} LEFT JOIN {{ t2 }} AS t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t1.s; -SELECT 'ANY RIGHT'; -SELECT t1.key, t2.key, length(t1.s), t2.s FROM {{ t1 }} AS t1 ANY RIGHT JOIN {{ t2 }} AS t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t2.s; +SELECT '{{ t1 }} {{ kind }} RIGHT JOIN {{ t2 }} | bs = {{ block_size }}'; +SELECT t1.key, t2.key, length(t1.s), t2.s FROM {{ t1 }} AS t1 {{ kind }} RIGHT JOIN {{ t2 }} AS t2 ON t1.key == t2.key ORDER BY t1.key, t2.key, t2.s; {% endfor -%} {% endfor -%} +{% endfor -%} diff --git a/tests/queries/0_stateless/02275_full_sort_join_long.reference b/tests/queries/0_stateless/02275_full_sort_join_long.reference index b6972ad7014..91b81d5ab3a 100644 --- a/tests/queries/0_stateless/02275_full_sort_join_long.reference +++ b/tests/queries/0_stateless/02275_full_sort_join_long.reference @@ -1,3 +1,27 @@ +ALL INNER +500353531835 500353531835 1000342 1000342 1000342 +ALL LEFT +50195752660639 500353531835 10369589 10369589 1000342 +ALL RIGHT +500353531835 684008812186 1367170 1000342 1367170 +ALL INNER +500353531835 500353531835 1000342 1000342 1000342 +ALL LEFT +50195752660639 500353531835 10369589 10369589 1000342 +ALL RIGHT +500353531835 684008812186 1367170 1000342 1367170 +ALL INNER +500353531835 500353531835 1000342 1000342 1000342 +ALL LEFT +50195752660639 500353531835 10369589 10369589 1000342 +ALL RIGHT +500353531835 684008812186 1367170 1000342 1367170 +ALL INNER +500353531835 500353531835 1000342 1000342 1000342 +ALL LEFT +50195752660639 500353531835 10369589 10369589 1000342 +ALL RIGHT +500353531835 684008812186 1367170 1000342 1367170 ANY INNER 199622811843 199622811843 399458 399458 399458 ANY LEFT diff --git a/tests/queries/0_stateless/02275_full_sort_join_long.sql.j2 b/tests/queries/0_stateless/02275_full_sort_join_long.sql.j2 index 2a986ea64d8..a326d2635f4 100644 --- a/tests/queries/0_stateless/02275_full_sort_join_long.sql.j2 +++ b/tests/queries/0_stateless/02275_full_sort_join_long.sql.j2 @@ -1,3 +1,4 @@ +-- Tags: long DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -21,28 +22,30 @@ INSERT INTO t2 FROM numbers_mt({{ rtable_size }}) ; -SET join_algorithm = 'full_sorting_merge'; +-- SET join_algorithm = 'full_sorting_merge'; +{% for kind in ['ALL', 'ANY'] -%} {% for block_size in [32001, 65505, 65536, range(32001, 65536) | random] %} SET max_block_size = {{ block_size }}; -SELECT 'ANY INNER'; +SELECT '{{ kind }} INNER'; SELECT sum(t1.key), sum(t2.key), count(), countIf(t1.key != 0), countIf(t2.key != 0) FROM t1 -ANY INNER JOIN t2 +{{ kind }} INNER JOIN t2 ON t1.key == t2.key ; -SELECT 'ANY LEFT'; +SELECT '{{ kind }} LEFT'; SELECT sum(t1.key), sum(t2.key), count(), countIf(t1.key != 0), countIf(t2.key != 0) FROM t1 -ANY LEFT JOIN t2 +{{ kind }} LEFT JOIN t2 ON t1.key == t2.key ; -SELECT 'ANY RIGHT'; +SELECT '{{ kind }} RIGHT'; SELECT sum(t1.key), sum(t2.key), count(), countIf(t1.key != 0), countIf(t2.key != 0) FROM t1 -ANY RIGHT JOIN t2 +{{ kind }} RIGHT JOIN t2 ON t1.key == t2.key ; -{% endfor %} +{% endfor -%} +{% endfor -%}