Merge pull request #49323 from ClickHouse/low-cardinality-fix-progress

Fix progress bar for LowCardinality fields with shared dictionaries
This commit is contained in:
Alexey Milovidov 2023-05-05 23:34:27 +03:00 committed by GitHub
commit 79ad150454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -160,7 +160,9 @@ public:
void reserve(size_t n) override { idx.reserve(n); }
size_t byteSize() const override { return idx.getPositions()->byteSize() + getDictionary().byteSize(); }
/// Don't count the dictionary size as it can be shared between different blocks.
size_t byteSize() const override { return idx.getPositions()->byteSize(); }
size_t byteSizeAt(size_t n) const override { return getDictionary().byteSizeAt(getIndexes().getUInt(n)); }
size_t allocatedBytes() const override { return idx.getPositions()->allocatedBytes() + getDictionary().allocatedBytes(); }

View File

@ -122,11 +122,12 @@ def test_metrics_storage_buffer_size(start_cluster):
)
== "1\n"
)
# By the way, this metric does not count the LowCardinality's dictionary size.
assert (
node1.query(
"SELECT value FROM system.metrics WHERE metric = 'StorageBufferBytes'"
)
== "24\n"
== "1\n"
)
node1.query("INSERT INTO test.buffer_table VALUES('hello');")
@ -140,7 +141,7 @@ def test_metrics_storage_buffer_size(start_cluster):
node1.query(
"SELECT value FROM system.metrics WHERE metric = 'StorageBufferBytes'"
)
== "25\n"
== "2\n"
)
# flush