diff --git a/docs/en/engines/table-engines/mergetree-family/annindexes.md b/docs/en/engines/table-engines/mergetree-family/annindexes.md index c651ee16c4f..ef8623d243b 100644 --- a/docs/en/engines/table-engines/mergetree-family/annindexes.md +++ b/docs/en/engines/table-engines/mergetree-family/annindexes.md @@ -102,7 +102,7 @@ ENGINE = MergeTree ORDER BY id; ``` !!! note "Note" - Table with array field will work faster, but all arrays **must** have same length. + Table with array field will work faster, but all arrays **must** have same length. Use [CONSTRAINT](../../../sql-reference/statements/create/table.md#constraints) to avoid errors. For example `CONSTRAINT constraint_name_1 CHECK length(number) = 256` Parameter `T` is the number of trees which algorithm will create. The bigger it is, the slower (approximately linear) it works (in both `CREATE` and `SELECT` requests), but the better accuracy you get (adjusted for randomness). diff --git a/src/Storages/MergeTree/CommonANNIndexes.cpp b/src/Storages/MergeTree/CommonANNIndexes.cpp index b48d9726c98..4639437d3e3 100644 --- a/src/Storages/MergeTree/CommonANNIndexes.cpp +++ b/src/Storages/MergeTree/CommonANNIndexes.cpp @@ -229,7 +229,9 @@ bool ANNCondition::checkQueryStructure(const SelectQueryInfo & query) query_information = std::move(order_by_info); } - query_information->limit = limit; + if (query_information) + query_information->limit = limit; + return query_information.has_value(); }