mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 20:12:02 +00:00
filter for columns in projection
This commit is contained in:
parent
af361a73ff
commit
e74ab64b0c
@ -818,6 +818,11 @@ bool MergeTask::MergeProjectionsStage::mergeMinMaxIndexAndPrepareProjections() c
|
||||
// projection_future_part->path = global_ctx->future_part->path + "/" + projection.name + ".proj/";
|
||||
projection_future_part->part_info = {"all", 0, 0, 0};
|
||||
|
||||
Names deduplicate_by_columns;
|
||||
for (const auto & column : global_ctx->deduplicate_by_columns)
|
||||
if (projection.metadata->getColumns().has(column))
|
||||
deduplicate_by_columns.emplace_back(column);
|
||||
|
||||
MergeTreeData::MergingParams projection_merging_params;
|
||||
projection_merging_params.mode = MergeTreeData::MergingParams::Ordinary;
|
||||
if (projection.type == ProjectionDescription::Type::Aggregate)
|
||||
@ -832,7 +837,7 @@ bool MergeTask::MergeProjectionsStage::mergeMinMaxIndexAndPrepareProjections() c
|
||||
global_ctx->context,
|
||||
global_ctx->space_reservation,
|
||||
global_ctx->deduplicate,
|
||||
global_ctx->deduplicate_by_columns,
|
||||
deduplicate_by_columns,
|
||||
global_ctx->cleanup,
|
||||
projection_merging_params,
|
||||
global_ctx->need_prefix,
|
||||
|
@ -0,0 +1 @@
|
||||
1 one
|
24
tests/queries/0_stateless/03174_projection_deduplicate.sql
Normal file
24
tests/queries/0_stateless/03174_projection_deduplicate.sql
Normal file
@ -0,0 +1,24 @@
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/65548
|
||||
DROP TABLE IF EXISTS test_projection_deduplicate;
|
||||
|
||||
CREATE TABLE test_projection_deduplicate
|
||||
(
|
||||
`id` Int32,
|
||||
`string` String,
|
||||
PROJECTION test_projection
|
||||
(
|
||||
SELECT id
|
||||
GROUP BY id
|
||||
)
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
PRIMARY KEY id;
|
||||
|
||||
INSERT INTO test_projection_deduplicate VALUES (1, 'one');
|
||||
INSERT INTO test_projection_deduplicate VALUES (1, 'one');
|
||||
|
||||
OPTIMIZE TABLE test_projection_deduplicate DEDUPLICATE;
|
||||
|
||||
SELECT * FROM test_projection_deduplicate;
|
||||
|
||||
DROP TABLE test_projection_deduplicate;
|
Loading…
Reference in New Issue
Block a user