Skip to content

Commit b5a43fc

Browse files
committed
allow to set unlimited rows for max_rows_per_postings_list
1 parent 218a756 commit b5a43fc

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/Storages/MergeTree/MergeTreeIndexGin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ void ginIndexValidator(const IndexDescription & index, bool /*attach*/)
860860

861861
/// Check that max_rows_per_postings_list is valid (if present)
862862
UInt64 max_rows_per_postings_list = getOption<UInt64>(options, ARGUMENT_MAX_ROWS).value_or(DEFAULT_MAX_ROWS_PER_POSTINGS_LIST);
863-
if (max_rows_per_postings_list < MIN_ROWS_PER_POSTINGS_LIST)
863+
if (max_rows_per_postings_list != UNLIMITED_ROWS_PER_POSTINGS_LIST && max_rows_per_postings_list < MIN_ROWS_PER_POSTINGS_LIST)
864864
throw Exception(
865865
ErrorCodes::INCORRECT_QUERY,
866866
"GIN index '{}' should not be less than {}", ARGUMENT_MAX_ROWS, MIN_ROWS_PER_POSTINGS_LIST);

tests/queries/0_stateless/02346_gin_index_creation.reference

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Test single tokenizer argument.
44
Test ngram_size argument.
55
-- ngram size must be between 2 and 8.
66
Test max_rows_per_postings_list argument.
7+
-- max_rows_per_posting_list is set to unlimited rows.
78
-- max_rows_per_posting_list should be at least 8192.
89
Parameters are shuffled.
910
Types are incorrect.

tests/queries/0_stateless/02346_gin_index_creation.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ ENGINE = MergeTree
9090
ORDER BY tuple();
9191
DROP TABLE tab;
9292

93+
SELECT '-- max_rows_per_posting_list is set to unlimited rows.';
94+
95+
CREATE TABLE tab
96+
(
97+
str String,
98+
INDEX idx str TYPE gin(tokenizer = 'default', max_rows_per_postings_list = 0)
99+
)
100+
ENGINE = MergeTree
101+
ORDER BY tuple();
102+
DROP TABLE tab;
103+
93104
SELECT '-- max_rows_per_posting_list should be at least 8192.';
94105

95106
CREATE TABLE tab

0 commit comments

Comments
 (0)