mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Revert "Fix prewhere without columns and without adaptive index granularity (almost w/o anything)"
This commit is contained in:
parent
1cdccd527f
commit
c27513e540
@ -1334,17 +1334,6 @@ void IMergeTreeDataPart::loadRowsCount()
|
||||
auto buf = metadata_manager->read("count.txt");
|
||||
readIntText(rows_count, *buf);
|
||||
assertEOF(*buf);
|
||||
|
||||
if (!index_granularity.empty() && rows_count < index_granularity.getTotalRows() && index_granularity_info.fixed_index_granularity)
|
||||
{
|
||||
/// Adjust last granule size to match the number of rows in the part in case of fixed index_granularity.
|
||||
index_granularity.popMark();
|
||||
index_granularity.appendMark(rows_count % index_granularity_info.fixed_index_granularity);
|
||||
if (rows_count != index_granularity.getTotalRows())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
"Index granularity total rows in part {} does not match rows_count: {}, instead of {}",
|
||||
name, index_granularity.getTotalRows(), rows_count);
|
||||
}
|
||||
};
|
||||
|
||||
if (index_granularity.empty())
|
||||
|
@ -577,10 +577,7 @@ void MergeTreeDataPartWriterWide::validateColumnOfFixedSize(const NameAndTypePai
|
||||
|
||||
if (index_granularity_rows != index_granularity.getMarkRows(mark_num))
|
||||
{
|
||||
/// With fixed granularity we can have last mark with less rows than granularity
|
||||
const bool is_last_mark = (mark_num + 1 == index_granularity.getMarksCount());
|
||||
if (!index_granularity_info.fixed_index_granularity || !is_last_mark)
|
||||
throw Exception(
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR,
|
||||
"Incorrect mark rows for part {} for mark #{}"
|
||||
" (compressed offset {}, decompressed offset {}), in-memory {}, on disk {}, total marks {}",
|
||||
@ -844,14 +841,7 @@ void MergeTreeDataPartWriterWide::adjustLastMarkIfNeedAndFlushToDisk(size_t new_
|
||||
/// Without offset
|
||||
rows_written_in_last_mark = 0;
|
||||
}
|
||||
|
||||
if (compute_granularity)
|
||||
{
|
||||
index_granularity.popMark();
|
||||
index_granularity.appendMark(new_rows_in_last_mark);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
105
|
||||
105
|
@ -1,51 +0,0 @@
|
||||
CREATE TABLE t_02967
|
||||
(
|
||||
`key` Date,
|
||||
`value` UInt16
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY key
|
||||
SETTINGS
|
||||
index_granularity_bytes = 0 --8192 --, min_index_granularity_bytes = 2
|
||||
, index_granularity = 100
|
||||
, min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0
|
||||
--
|
||||
-- , min_bytes_for_wide_part = 2
|
||||
AS SELECT
|
||||
number,
|
||||
repeat(toString(number), 5)
|
||||
FROM numbers(105.);
|
||||
|
||||
|
||||
|
||||
-- Check with newly inserted data part. It's in-memory structured are filled at insert time.
|
||||
SELECT
|
||||
count(ignore(*))
|
||||
FROM t_02967
|
||||
PREWHERE CAST(ignore() + 1 as UInt8)
|
||||
GROUP BY
|
||||
ignore(65535, *),
|
||||
ignore(255, 256, *)
|
||||
SETTINGS
|
||||
--send_logs_level='test',
|
||||
max_threads=1;
|
||||
|
||||
|
||||
|
||||
-- Reload part form disk to check that in-meory structures where properly serilaized-deserialized
|
||||
DETACH TABLE t_02967;
|
||||
ATTACH TABLE t_02967;
|
||||
|
||||
|
||||
SELECT
|
||||
count(ignore(*))
|
||||
FROM t_02967
|
||||
PREWHERE CAST(ignore() + 1 as UInt8)
|
||||
GROUP BY
|
||||
ignore(65535, *),
|
||||
ignore(255, 256, *)
|
||||
SETTINGS
|
||||
--send_logs_level='test',
|
||||
max_threads=1;
|
||||
|
||||
DROP TABLE t_02967;
|
@ -1,2 +0,0 @@
|
||||
1000000
|
||||
1000000
|
@ -1,12 +0,0 @@
|
||||
DROP TABLE IF EXISTS data_02051__fuzz_24;
|
||||
|
||||
CREATE TABLE data_02051__fuzz_24 (`key` Int16, `value` String) ENGINE = MergeTree ORDER BY key SETTINGS index_granularity_bytes = 0, min_rows_for_wide_part = 0, min_bytes_for_wide_part=0 AS SELECT number, repeat(toString(number), 5) FROM numbers(1000000.);
|
||||
|
||||
SELECT count(ignore(*)) FROM data_02051__fuzz_24 PREWHERE materialize(1) GROUP BY ignore(*);
|
||||
|
||||
detach table data_02051__fuzz_24;
|
||||
attach table data_02051__fuzz_24;
|
||||
|
||||
SELECT count(ignore(*)) FROM data_02051__fuzz_24 PREWHERE materialize(1) GROUP BY ignore(*);
|
||||
|
||||
DROP TABLE data_02051__fuzz_24;
|
@ -1,5 +1,5 @@
|
||||
test hits 1 57344 7
|
||||
test hits 1 8832938 1079
|
||||
test hits 1 829354 102
|
||||
test hits 1 8839168 1079
|
||||
test hits 1 835584 102
|
||||
test hits 1 8003584 977
|
||||
test hits 2 581632 71
|
||||
|
Loading…
Reference in New Issue
Block a user