Merge pull request #57099 from ClickHouse/analyzer-fuzz-3

Analyzer fuzzer 3 (aggregate_functions_null_for_empty for projections)
This commit is contained in:
Nikolai Kochetov 2023-12-01 16:57:34 +01:00 committed by GitHub
commit 5430ac2c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -291,9 +291,15 @@ void ProjectionDescription::recalculateWithNewColumns(const ColumnsDescription &
Block ProjectionDescription::calculate(const Block & block, ContextPtr context) const
{
auto mut_context = Context::createCopy(context);
/// We ignore aggregate_functions_null_for_empty cause it changes aggregate function types.
/// Now, projections do not support in on SELECT, and (with this change) should ignore on INSERT as well.
mut_context->setSetting("aggregate_functions_null_for_empty", Field(0));
mut_context->setSetting("transform_null_in", Field(0));
auto builder = InterpreterSelectQuery(
query_ast,
context,
mut_context,
Pipe(std::make_shared<SourceFromSingleChunk>(block)),
SelectQueryOptions{
type == ProjectionDescription::Type::Normal ? QueryProcessingStage::FetchColumns

View File

@ -0,0 +1,5 @@
SET aggregate_functions_null_for_empty = 1;
--set allow_experimental_analyzer=1;
create table t_delete_projection (x UInt32, y UInt64, projection p (select sum(y))) engine = MergeTree order by tuple() SETTINGS index_granularity = 8192, index_granularity_bytes = '10Mi';
insert into t_delete_projection select number, toString(number) from numbers(8192 * 10);