mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #63200 from litlig/parts_column_ttl
Add column ttl info to system info
This commit is contained in:
commit
8aedecf100
@ -65,6 +65,8 @@ StorageSystemPartsColumns::StorageSystemPartsColumns(const StorageID & table_id_
|
||||
{"column_data_uncompressed_bytes", std::make_shared<DataTypeUInt64>(), "Total size of the decompressed data in the column, in bytes."},
|
||||
{"column_marks_bytes", std::make_shared<DataTypeUInt64>(), "The size of the marks for column, in bytes."},
|
||||
{"column_modification_time", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeDateTime>()), "The last time the column was modified."},
|
||||
{"column_ttl_min", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeDateTime>()), "The minimum value of the calculated TTL expression of the column."},
|
||||
{"column_ttl_max", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeDateTime>()), "The maximum value of the calculated TTL expression of the column."},
|
||||
|
||||
{"serialization_kind", std::make_shared<DataTypeString>(), "Kind of serialization of a column"},
|
||||
{"substreams", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()), "Names of substreams to which column is serialized"},
|
||||
@ -250,6 +252,21 @@ void StorageSystemPartsColumns::processNextStorage(
|
||||
else
|
||||
columns[res_index++]->insertDefault();
|
||||
}
|
||||
bool column_has_ttl = part->ttl_infos.columns_ttl.contains(column.name);
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
if (column_has_ttl)
|
||||
columns[res_index++]->insert(static_cast<UInt32>(part->ttl_infos.columns_ttl[column.name].min));
|
||||
else
|
||||
columns[res_index++]->insertDefault();
|
||||
}
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
if (column_has_ttl)
|
||||
columns[res_index++]->insert(static_cast<UInt32>(part->ttl_infos.columns_ttl[column.name].max));
|
||||
else
|
||||
columns[res_index++]->insertDefault();
|
||||
}
|
||||
|
||||
auto serialization = part->getSerialization(column.name);
|
||||
if (columns_mask[src_index++])
|
||||
|
@ -565,6 +565,8 @@ CREATE TABLE system.parts_columns
|
||||
`column_data_uncompressed_bytes` UInt64,
|
||||
`column_marks_bytes` UInt64,
|
||||
`column_modification_time` Nullable(DateTime),
|
||||
`column_ttl_min` Nullable(DateTime),
|
||||
`column_ttl_max` Nullable(DateTime),
|
||||
`serialization_kind` String,
|
||||
`substreams` Array(String),
|
||||
`filenames` Array(String),
|
||||
|
@ -0,0 +1,4 @@
|
||||
all_1_1_0 timestamp DateTime \N \N
|
||||
all_1_1_0 x UInt32 2100-02-01 00:00:00 2100-02-01 00:00:00
|
||||
all_1_1_0 y String 2100-01-02 00:00:00 2100-01-02 00:00:00
|
||||
all_1_1_0 z String \N \N
|
@ -0,0 +1,25 @@
|
||||
DROP TABLE IF EXISTS test_03143;
|
||||
|
||||
CREATE TABLE test_03143 (
|
||||
timestamp DateTime,
|
||||
x UInt32 TTL timestamp + INTERVAL 1 MONTH,
|
||||
y String TTL timestamp + INTERVAL 1 DAY,
|
||||
z String
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY tuple();
|
||||
|
||||
|
||||
INSERT INTO test_03143 VALUES ('2100-01-01', 123, 'Hello, world!', 'xxx yyy');
|
||||
|
||||
SELECT
|
||||
name,
|
||||
column,
|
||||
type,
|
||||
column_ttl_min,
|
||||
column_ttl_max
|
||||
FROM system.parts_columns
|
||||
WHERE table = 'test_03143' and database = currentDatabase()
|
||||
ORDER BY name, column;
|
||||
|
||||
DROP TABLE IF EXISTS test_03143;
|
Loading…
Reference in New Issue
Block a user