diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index 1196e440b86..703bb6dcb96 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -258,7 +258,8 @@ std::optional getOptimizedQueryProcessingStage(const size_t i = 0; for (auto & expr : exprs) { - if (++i > limit) + ++i; + if (i > limit) break; auto id = expr->template as();