mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Merge pull request #44850 from ClickHouse/respect-context-in-projection-optimization
Save context created from projection analysis.
This commit is contained in:
commit
6b1a697b12
@ -6137,6 +6137,7 @@ std::optional<ProjectionCandidate> MergeTreeData::getQueryProcessingStageWithAgg
|
||||
{
|
||||
ProjectionCandidate candidate{};
|
||||
candidate.desc = &projection;
|
||||
candidate.context = select.getContext();
|
||||
|
||||
auto sample_block = projection.sample_block;
|
||||
auto sample_block_for_keys = projection.sample_block_for_keys;
|
||||
|
@ -466,6 +466,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read(
|
||||
fmt::format("MergeTree(with {} projection {})", query_info.projection->desc->type, query_info.projection->desc->name),
|
||||
query_info.storage_limits);
|
||||
plan->addStep(std::move(step));
|
||||
plan->addInterpreterContext(query_info.projection->context);
|
||||
return plan;
|
||||
}
|
||||
|
||||
|
@ -163,6 +163,9 @@ struct ProjectionCandidate
|
||||
SortDescription group_by_elements_order_descr;
|
||||
MergeTreeDataSelectAnalysisResultPtr merge_tree_projection_select_result_ptr;
|
||||
MergeTreeDataSelectAnalysisResultPtr merge_tree_normal_select_result_ptr;
|
||||
|
||||
/// Because projection analysis uses a separate interpreter.
|
||||
ContextPtr context;
|
||||
};
|
||||
|
||||
/** Query along with some additional data,
|
||||
|
@ -0,0 +1,6 @@
|
||||
DROP TABLE IF EXISTS test1__fuzz_37;
|
||||
CREATE TABLE test1__fuzz_37 (`i` Date) ENGINE = MergeTree ORDER BY i;
|
||||
insert into test1__fuzz_37 values ('2020-10-10');
|
||||
SELECT count() FROM test1__fuzz_37 GROUP BY dictHas(NULL, (dictHas(NULL, (('', materialize(NULL)), materialize(NULL))), 'KeyKey')), dictHas('test_dictionary', tuple(materialize('Ke\0'))), tuple(dictHas(NULL, (tuple('Ke\0Ke\0Ke\0Ke\0Ke\0Ke\0\0\0\0Ke\0'), materialize(NULL)))), 'test_dicti\0nary', (('', materialize(NULL)), dictHas(NULL, (dictHas(NULL, tuple(materialize(NULL))), 'KeyKeyKeyKeyKeyKeyKeyKey')), materialize(NULL)); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT count() FROM test1__fuzz_37 GROUP BY dictHas('non_existing_dictionary', materialize('a')); -- { serverError BAD_ARGUMENTS }
|
||||
DROP TABLE test1__fuzz_37;
|
Loading…
Reference in New Issue
Block a user