Merge pull request #68644 from linkwk7/fix_full_text_with_multi_col

Fix wrong row id when using full text index with multi column
This commit is contained in:
vdimir 2024-08-28 11:11:37 +00:00 committed by GitHub
commit 31a376953d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View File

@ -128,14 +128,14 @@ void MergeTreeIndexAggregatorFullText::update(const Block & block, size_t * pos,
"Position: {}, Block rows: {}.", *pos, block.rows());
size_t rows_read = std::min(limit, block.rows() - *pos);
auto row_id = store->getNextRowIDRange(rows_read);
auto start_row_id = row_id;
auto start_row_id = store->getNextRowIDRange(rows_read);
for (size_t col = 0; col < index_columns.size(); ++col)
{
const auto & column_with_type = block.getByName(index_columns[col]);
const auto & column = column_with_type.column;
size_t current_position = *pos;
auto row_id = start_row_id;
bool need_to_write = false;
if (isArray(column_with_type.type))

View File

@ -0,0 +1,2 @@
Query column at granularity boundary
0,0 0,1

View File

@ -0,0 +1,18 @@
SET allow_experimental_full_text_index=1;
DROP TABLE IF EXISTS multi_col_ivt;
CREATE TABLE tab (
v0 String,
v1 String,
INDEX idx (v0, v1) TYPE full_text GRANULARITY 1)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 1;
INSERT INTO tab VALUES('0,0', '0,1')('2,2','2,3');
SELECT 'Query column at granularity boundary';
SELECT * FROM tab WHERE hasToken(v1, '1');
DROP TABLE tab;