mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Fix _block_number column with non-default serializations and mutation
This commit is contained in:
parent
661d4a827b
commit
7022ca9ece
@ -21,6 +21,7 @@
|
||||
#include <Storages/MutationCommands.h>
|
||||
#include <Storages/MergeTree/MergeTreeDataMergerMutator.h>
|
||||
#include <Storages/MergeTree/MergeTreeIndexInverted.h>
|
||||
#include <Storages/BlockNumberColumn.h>
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <Common/ProfileEventsScope.h>
|
||||
@ -308,6 +309,15 @@ getColumnsForNewDataPart(
|
||||
}
|
||||
}
|
||||
|
||||
if (!storage_columns_set.contains(BlockNumberColumn::name))
|
||||
{
|
||||
if (source_part->tryGetSerialization(BlockNumberColumn::name) != nullptr)
|
||||
{
|
||||
storage_columns.push_back({BlockNumberColumn::name, BlockNumberColumn::type});
|
||||
storage_columns_set.insert(BlockNumberColumn::name);
|
||||
}
|
||||
}
|
||||
|
||||
SerializationInfoByName new_serialization_infos;
|
||||
for (const auto & [name, old_info] : serialization_infos)
|
||||
{
|
||||
|
@ -0,0 +1,39 @@
|
||||
-- Tags: zookeeper
|
||||
|
||||
-- we need exact block-numbers
|
||||
SET insert_keeper_fault_injection_probability=0;
|
||||
|
||||
DROP TABLE IF EXISTS table_with_some_columns;
|
||||
|
||||
CREATE TABLE table_with_some_columns(
|
||||
key UInt64,
|
||||
value0 UInt8
|
||||
)
|
||||
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/table_with_some_columns', '1')
|
||||
ORDER BY key
|
||||
SETTINGS allow_experimental_block_number_column=1,
|
||||
ratio_of_defaults_for_sparse_serialization=0.0001,
|
||||
min_bytes_for_wide_part = 0,
|
||||
replace_long_file_name_to_hash=0; -- simpler to debug
|
||||
|
||||
INSERT INTO table_with_some_columns SELECT rand(), number + 10 from numbers(100000);
|
||||
|
||||
INSERT INTO table_with_some_columns SELECT rand(), number + 10 from numbers(1);
|
||||
|
||||
OPTIMIZE TABLE table_with_some_columns FINAL;
|
||||
|
||||
INSERT INTO table_with_some_columns SELECT rand(), number+222222222 from numbers(1);
|
||||
|
||||
OPTIMIZE TABLE table_with_some_columns FINAL;
|
||||
|
||||
set alter_sync = 2;
|
||||
|
||||
ALTER TABLE table_with_some_columns DROP COLUMN value0;
|
||||
|
||||
INSERT INTO table_with_some_columns SELECT rand() from numbers(1);
|
||||
|
||||
OPTIMIZE TABLE table_with_some_columns FINAL;
|
||||
|
||||
SELECT *, _block_number FROM table_with_some_columns where not ignore(*) Format Null;
|
||||
|
||||
DROP TABLE IF EXISTS table_with_some_columns;
|
Loading…
Reference in New Issue
Block a user