mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
in-memory parts: several fixes
This commit is contained in:
parent
d8342e5b12
commit
4769ce7271
@ -1351,7 +1351,7 @@ void MergeTreeData::clearOldWriteAheadLogs()
|
||||
|
||||
auto is_range_on_disk = [&block_numbers_on_disk](Int64 min_block, Int64 max_block)
|
||||
{
|
||||
auto lower = std::upper_bound(block_numbers_on_disk.begin(), block_numbers_on_disk.end(), std::make_pair(min_block, -1L));
|
||||
auto lower = std::lower_bound(block_numbers_on_disk.begin(), block_numbers_on_disk.end(), std::make_pair(min_block, -1L));
|
||||
if (lower != block_numbers_on_disk.end() && min_block >= lower->first && max_block <= lower->second)
|
||||
return true;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
bool isStoredOnDisk() const override { return false; }
|
||||
|
||||
bool hasColumnFiles(const String & /* column_name */, const IDataType & /* type */) const override { return true; }
|
||||
bool hasColumnFiles(const String & column_name, const IDataType & /* type */) const override { return !!getColumnPosition(column_name); }
|
||||
|
||||
String getFileNameForColumn(const NameAndTypePair & /* column */) const override { return ""; }
|
||||
|
||||
|
@ -49,7 +49,7 @@ size_t MergeTreeReaderInMemory::readRows(size_t from_mark, bool /* continue_read
|
||||
if (!part_in_memory->block.has(name))
|
||||
continue;
|
||||
|
||||
const auto block_column = part_in_memory->block.getByName(name).column;
|
||||
const auto & block_column = part_in_memory->block.getByName(name).column;
|
||||
if (total_rows_read == 0 && part_rows <= max_rows_to_read)
|
||||
{
|
||||
res_columns[i] = block_column;
|
||||
|
@ -637,6 +637,8 @@ bool StorageMergeTree::merge(
|
||||
merger_mutator.renameMergedTemporaryPart(new_part, future_part.parts, nullptr);
|
||||
|
||||
DataPartsVector parts_to_remove_immediately;
|
||||
{
|
||||
auto lock = lockParts();
|
||||
for (const auto & part : future_part.parts)
|
||||
{
|
||||
part->notifyMerged();
|
||||
@ -646,6 +648,7 @@ bool StorageMergeTree::merge(
|
||||
parts_to_remove_immediately.push_back(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removePartsFinally(parts_to_remove_immediately);
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
0 bbb_aaa
|
20
tests/queries/0_stateless/01130_in_memory_parts_default.sql
Normal file
20
tests/queries/0_stateless/01130_in_memory_parts_default.sql
Normal file
@ -0,0 +1,20 @@
|
||||
-- Test 01266_default_prewhere_reqq, but with in-memory parts
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE TABLE t1
|
||||
(
|
||||
date Date,
|
||||
s1 String,
|
||||
s2 String
|
||||
) ENGINE = MergeTree() PARTITION BY toYYYYMMDD(date) ORDER BY (date, s1)
|
||||
SETTINGS index_granularity = 8192, min_rows_for_compact_part = 1000, min_rows_for_wide_part = 1000;
|
||||
|
||||
|
||||
set max_threads=1;
|
||||
|
||||
insert into t1 (date, s1,s2) values(today()-1,'aaa','bbb');
|
||||
alter table t1 add column s3 String DEFAULT concat(s2,'_',s1);
|
||||
-- insert into t1 (date, s1,s2) values(today(),'aaa2','bbb2');
|
||||
select ignore(date), s3 from t1 where s2='bbb';
|
||||
|
||||
DROP TABLE t1;
|
Loading…
Reference in New Issue
Block a user