mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
TableJoin: forceHashJoin for dictionary_reader, add tests
This commit is contained in:
parent
a95c4dcfff
commit
3266bbb54c
@ -571,7 +571,7 @@ namespace
|
||||
void HashJoin::initRightBlockStructure(Block & saved_block_sample)
|
||||
{
|
||||
/// We could remove key columns for LEFT | INNER HashJoin but we should keep them for JoinSwitcher (if any).
|
||||
bool save_key_columns = !(table_join->forceHashJoin() || table_join->dictionary_reader) || isRightOrFull(kind);
|
||||
bool save_key_columns = !table_join->forceHashJoin() || isRightOrFull(kind);
|
||||
if (save_key_columns)
|
||||
{
|
||||
saved_block_sample = right_table_keys.cloneEmpty();
|
||||
|
@ -128,7 +128,11 @@ public:
|
||||
bool allowDictJoin(const String & dict_key, const Block & sample_block, Names &, NamesAndTypesList &) const;
|
||||
bool preferMergeJoin() const { return join_algorithm == JoinAlgorithm::PREFER_PARTIAL_MERGE; }
|
||||
bool forceMergeJoin() const { return join_algorithm == JoinAlgorithm::PARTIAL_MERGE; }
|
||||
bool forceHashJoin() const { return join_algorithm == JoinAlgorithm::HASH; }
|
||||
bool forceHashJoin() const
|
||||
{
|
||||
/// HashJoin always used for DictJoin
|
||||
return dictionary_reader || join_algorithm == JoinAlgorithm::HASH;
|
||||
}
|
||||
|
||||
bool forceNullableRight() const { return join_use_nulls && isLeftOrFull(table_join.kind); }
|
||||
bool forceNullableLeft() const { return join_use_nulls && isRightOrFull(table_join.kind); }
|
||||
|
@ -102,8 +102,37 @@ not optimized (smoke)
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
issue 23002
|
||||
-
|
||||
0 0 0 0 0
|
||||
1 1 1 1 1
|
||||
2 2 2 2 2
|
||||
3 3 3 3 3
|
||||
4 0 0 0
|
||||
-
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 0 0
|
||||
-
|
||||
0 0 0 0 0
|
||||
1 1 1 1 1
|
||||
0 2 2 2 2
|
||||
0 3 3 3 3
|
||||
-
|
||||
0 0 0 0 0
|
||||
1 1 1 1 1
|
||||
2 2 2 2 2
|
||||
3 3 3 3 3
|
||||
4 0 0 0
|
||||
-
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 0 0
|
||||
-
|
||||
0 0 0 0 0
|
||||
1 1 1 1 1
|
||||
0 2 2 2 2
|
||||
0 3 3 3 3
|
||||
|
@ -83,9 +83,25 @@ SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(2)) s1 ANTI RIGHT JOIN dict_flat d USING(key) ORDER BY s1.key;
|
||||
|
||||
SET join_use_nulls = 0;
|
||||
SET join_algorithm = 'auto';
|
||||
|
||||
SELECT 'issue 23002';
|
||||
|
||||
SET join_algorithm = 'auto';
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 LEFT JOIN dict_flat d ON s1.key = d.key ORDER BY s1.key;
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 ANY LEFT JOIN dict_flat d USING(key) ORDER BY key;
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(2)) s1 RIGHT JOIN dict_flat d ON s1.key = d.key ORDER BY d.key;
|
||||
|
||||
SET join_algorithm = 'partial_merge';
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 LEFT JOIN dict_flat d ON s1.key = d.key ORDER BY s1.key;
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 ANY LEFT JOIN dict_flat d USING(key) ORDER BY key;
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(2)) s1 RIGHT JOIN dict_flat d ON s1.key = d.key ORDER BY d.key;
|
||||
|
||||
|
||||
DROP DICTIONARY dict_flat;
|
||||
DROP DICTIONARY dict_hashed;
|
||||
|
Loading…
Reference in New Issue
Block a user