mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Fix granule size less than row size
This commit is contained in:
parent
3fb494fea1
commit
4ad4fc3f7b
@ -139,6 +139,8 @@ void fillIndexGranularityImpl(
|
||||
index_granularity_for_block = index_granularity_bytes / size_of_row_in_bytes;
|
||||
}
|
||||
}
|
||||
if (index_granularity_for_block == 0) /// very rare case when index granularity bytes less then single row
|
||||
index_granularity_for_block = 1;
|
||||
std::cerr << "GRANULARITY SIZE IN ROWS:"<< index_granularity_for_block << std::endl;
|
||||
|
||||
for (size_t current_row = index_offset; current_row < rows_in_block; current_row += index_granularity_for_block)
|
||||
|
@ -2,3 +2,5 @@
|
||||
8
|
||||
4
|
||||
8
|
||||
4
|
||||
8
|
||||
|
@ -1,3 +1,27 @@
|
||||
DROP TABLE IF EXISTS test.zero_rows_per_granule;
|
||||
|
||||
CREATE TABLE test.zero_rows_per_granule (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20;
|
||||
|
||||
INSERT INTO test.zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.zero_rows_per_granule;
|
||||
|
||||
OPTIMIZE TABLE test.zero_rows_per_granule FINAL;
|
||||
|
||||
|
||||
INSERT INTO test.zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 5, 3000, 4000), ('2018-05-17', 6, 5000, 6000), ('2018-05-19', 7, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.zero_rows_per_granule;
|
||||
|
||||
DROP TABLE IF EXISTS test.zero_rows_per_granule;
|
||||
|
||||
-----
|
||||
|
||||
DROP TABLE IF EXISTS test.two_rows_per_granule;
|
||||
|
||||
CREATE TABLE test.two_rows_per_granule (
|
||||
@ -20,7 +44,9 @@ SELECT COUNT(*) FROM test.two_rows_per_granule;
|
||||
|
||||
DROP TABLE IF EXISTS test.two_rows_per_granule;
|
||||
|
||||
DROP TABLE IF EXISTS test.two_rows_per_granule;
|
||||
------
|
||||
|
||||
DROP TABLE IF EXISTS test.four_rows_per_granule;
|
||||
|
||||
CREATE TABLE test.four_rows_per_granule (
|
||||
p Date,
|
||||
|
Loading…
Reference in New Issue
Block a user