Merge pull request #59461 from Algunenano/parallel_replicas_cte_fix

Fix problem detected by UBSAN
This commit is contained in:
Raúl Marín 2024-02-01 16:00:33 +01:00 committed by GitHub
commit 1438dc2f2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -267,8 +267,10 @@ private:
/// We don't support WITH cte as (subquery) Select table JOIN cte because we don't do conversion in AST /// We don't support WITH cte as (subquery) Select table JOIN cte because we don't do conversion in AST
bool is_subquery = false; bool is_subquery = false;
if (const auto * ast_table_expr = table_elem.table_expression->as<ASTTableExpression>()) if (const auto * ast_table_expr = table_elem.table_expression->as<ASTTableExpression>())
is_subquery = ast_table_expr->subquery->as<ASTSubquery>() != nullptr {
is_subquery = ast_table_expr->subquery && ast_table_expr->subquery->as<ASTSubquery>() != nullptr
&& ast_table_expr->subquery->as<ASTSubquery>()->cte_name.empty(); && ast_table_expr->subquery->as<ASTSubquery>()->cte_name.empty();
}
else if (table_elem.table_expression->as<ASTSubquery>()) else if (table_elem.table_expression->as<ASTSubquery>())
is_subquery = true; is_subquery = true;

View File

@ -1,2 +1,3 @@
990000 990000
990000 990000
10

View File

@ -19,5 +19,9 @@ WITH filtered_groups AS (SELECT a FROM pr_1 WHERE a >= 10000)
SELECT count() FROM pr_2 INNER JOIN filtered_groups ON pr_2.a = filtered_groups.a SELECT count() FROM pr_2 INNER JOIN filtered_groups ON pr_2.a = filtered_groups.a
SETTINGS allow_experimental_analyzer = 0, allow_experimental_parallel_reading_from_replicas = 2, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_two_shards', max_parallel_replicas = 3; -- { serverError SUPPORT_IS_DISABLED } SETTINGS allow_experimental_analyzer = 0, allow_experimental_parallel_reading_from_replicas = 2, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_two_shards', max_parallel_replicas = 3; -- { serverError SUPPORT_IS_DISABLED }
-- Sanitizer
SELECT count() FROM pr_2 JOIN numbers(10) as pr_1 ON pr_2.a = pr_1.number
SETTINGS allow_experimental_parallel_reading_from_replicas = 1, parallel_replicas_for_non_replicated_merge_tree = 1, cluster_for_parallel_replicas = 'test_cluster_two_shards', max_parallel_replicas = 3;
DROP TABLE IF EXISTS pr_1; DROP TABLE IF EXISTS pr_1;
DROP TABLE IF EXISTS pr_2; DROP TABLE IF EXISTS pr_2;