mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 21:12:28 +00:00
optimize deduplicate for tables with projections is not supported
This commit is contained in:
parent
e74ab64b0c
commit
1402a00c8c
@ -818,11 +818,6 @@ bool MergeTask::MergeProjectionsStage::mergeMinMaxIndexAndPrepareProjections() c
|
|||||||
// projection_future_part->path = global_ctx->future_part->path + "/" + projection.name + ".proj/";
|
// projection_future_part->path = global_ctx->future_part->path + "/" + projection.name + ".proj/";
|
||||||
projection_future_part->part_info = {"all", 0, 0, 0};
|
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;
|
MergeTreeData::MergingParams projection_merging_params;
|
||||||
projection_merging_params.mode = MergeTreeData::MergingParams::Ordinary;
|
projection_merging_params.mode = MergeTreeData::MergingParams::Ordinary;
|
||||||
if (projection.type == ProjectionDescription::Type::Aggregate)
|
if (projection.type == ProjectionDescription::Type::Aggregate)
|
||||||
@ -837,7 +832,7 @@ bool MergeTask::MergeProjectionsStage::mergeMinMaxIndexAndPrepareProjections() c
|
|||||||
global_ctx->context,
|
global_ctx->context,
|
||||||
global_ctx->space_reservation,
|
global_ctx->space_reservation,
|
||||||
global_ctx->deduplicate,
|
global_ctx->deduplicate,
|
||||||
deduplicate_by_columns,
|
global_ctx->deduplicate_by_columns,
|
||||||
global_ctx->cleanup,
|
global_ctx->cleanup,
|
||||||
projection_merging_params,
|
projection_merging_params,
|
||||||
global_ctx->need_prefix,
|
global_ctx->need_prefix,
|
||||||
|
@ -1549,6 +1549,12 @@ bool StorageMergeTree::optimize(
|
|||||||
{
|
{
|
||||||
assertNotReadonly();
|
assertNotReadonly();
|
||||||
|
|
||||||
|
if (deduplicate && getInMemoryMetadataPtr()->hasProjections())
|
||||||
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
|
||||||
|
"OPTIMIZE DEDUPLICATE query is not supported for table {} as it has projections. "
|
||||||
|
"User should drop all the projections manually before running the query",
|
||||||
|
getStorageID().getTableName());
|
||||||
|
|
||||||
if (deduplicate)
|
if (deduplicate)
|
||||||
{
|
{
|
||||||
if (deduplicate_by_columns.empty())
|
if (deduplicate_by_columns.empty())
|
||||||
|
@ -5746,6 +5746,12 @@ bool StorageReplicatedMergeTree::optimize(
|
|||||||
if (!is_leader)
|
if (!is_leader)
|
||||||
throw Exception(ErrorCodes::NOT_A_LEADER, "OPTIMIZE cannot be done on this replica because it is not a leader");
|
throw Exception(ErrorCodes::NOT_A_LEADER, "OPTIMIZE cannot be done on this replica because it is not a leader");
|
||||||
|
|
||||||
|
if (deduplicate && getInMemoryMetadataPtr()->hasProjections())
|
||||||
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
|
||||||
|
"OPTIMIZE DEDUPLICATE query is not supported for table {} as it has projections. "
|
||||||
|
"User should drop all the projections manually before running the query",
|
||||||
|
getStorageID().getTableName());
|
||||||
|
|
||||||
if (cleanup)
|
if (cleanup)
|
||||||
{
|
{
|
||||||
if (!getSettings()->allow_experimental_replacing_merge_with_cleanup)
|
if (!getSettings()->allow_experimental_replacing_merge_with_cleanup)
|
||||||
|
@ -1 +1,2 @@
|
|||||||
1 one
|
1 one
|
||||||
|
1 one
|
||||||
|
@ -17,7 +17,7 @@ PRIMARY KEY id;
|
|||||||
INSERT INTO test_projection_deduplicate VALUES (1, 'one');
|
INSERT INTO test_projection_deduplicate VALUES (1, 'one');
|
||||||
INSERT INTO test_projection_deduplicate VALUES (1, 'one');
|
INSERT INTO test_projection_deduplicate VALUES (1, 'one');
|
||||||
|
|
||||||
OPTIMIZE TABLE test_projection_deduplicate DEDUPLICATE;
|
OPTIMIZE TABLE test_projection_deduplicate DEDUPLICATE; -- { serverError NOT_IMPLEMENTED }
|
||||||
|
|
||||||
SELECT * FROM test_projection_deduplicate;
|
SELECT * FROM test_projection_deduplicate;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user