This commit is contained in:
jsc0218 2024-09-08 00:55:10 +00:00
parent 36f62334c4
commit 503e7490d4
4 changed files with 3 additions and 12 deletions

View File

@ -98,7 +98,7 @@ void VirtualRowTransform::work()
ColumnPtr current_column = type_and_name.type->createColumn();
// ordered_columns.push_back(current_column->cloneResized(1));
if (j < index->size() && type_and_name.name == primary_key.column_names[j]
if (j < index->size() && type_and_name.name == primary_key.column_names[j]
&& type_and_name.type == primary_key.data_types[j])
{
auto column = current_column->cloneEmpty();

View File

@ -161,12 +161,6 @@ MergeTreeReadTask::BlockAndProgress MergeTreeReadTask::read(const BlockSizeParam
auto read_result = range_readers.main.read(rows_to_read, mark_ranges);
if (add_virtual_row)
{
/// Now we have the virtual row, which is at most once for each part.
add_virtual_row = false;
}
/// All rows were filtered. Repeat.
if (read_result.num_rows == 0)
read_result.columns.clear();

View File

@ -162,9 +162,6 @@ private:
/// Used to satistfy preferred_block_size_bytes limitation
MergeTreeBlockSizePredictorPtr size_predictor;
/// If true, add once, and then set false.
bool add_virtual_row = false;
};
using MergeTreeReadTaskPtr = std::unique_ptr<MergeTreeReadTask>;

View File

@ -195,14 +195,14 @@ INSERT INTO tab VALUES (201, 'rick c01'), (202, 'mick c02'), (203, 'nick c03');
SELECT name, type FROM system.data_skipping_indices WHERE table == 'tab' AND database = currentDatabase() LIMIT 1;
-- search full_text index
SELECT * FROM tab WHERE s LIKE '%01%' ORDER BY k SETTINGS optimize_read_in_order = 0;
SELECT * FROM tab WHERE s LIKE '%01%' ORDER BY k;
-- check the query only read 3 granules (6 rows total; each granule has 2 rows)
SYSTEM FLUSH LOGS;
SELECT read_rows==6 from system.query_log
WHERE query_kind ='Select'
AND current_database = currentDatabase()
AND endsWith(trimRight(query), 'SELECT * FROM tab WHERE s LIKE \'%01%\' ORDER BY k SETTINGS optimize_read_in_order = 0;')
AND endsWith(trimRight(query), 'SELECT * FROM tab WHERE s LIKE \'%01%\' ORDER BY k;')
AND type='QueryFinish'
AND result_rows==3
LIMIT 1;