diff --git a/dbms/programs/obfuscator/Obfuscator.cpp b/dbms/programs/obfuscator/Obfuscator.cpp index 48b6d482703..a6fd5bdaff8 100644 --- a/dbms/programs/obfuscator/Obfuscator.cpp +++ b/dbms/programs/obfuscator/Obfuscator.cpp @@ -1037,7 +1037,7 @@ try Obfuscator obfuscator(header, seed, markov_model_params); - size_t max_block_size = 8192; + UInt64 max_block_size = 8192; /// Train step { diff --git a/dbms/programs/odbc-bridge/MainHandler.cpp b/dbms/programs/odbc-bridge/MainHandler.cpp index a187225f4f0..8ffedc5a25a 100644 --- a/dbms/programs/odbc-bridge/MainHandler.cpp +++ b/dbms/programs/odbc-bridge/MainHandler.cpp @@ -75,7 +75,7 @@ void ODBCHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Ne return; } - size_t max_block_size = DEFAULT_BLOCK_SIZE; + UInt64 max_block_size = DEFAULT_BLOCK_SIZE; if (params.has("max_block_size")) { std::string max_block_size_str = params.get("max_block_size", ""); diff --git a/dbms/src/Columns/ColumnAggregateFunction.cpp b/dbms/src/Columns/ColumnAggregateFunction.cpp index 7d3e001998a..75d8f9fea00 100644 --- a/dbms/src/Columns/ColumnAggregateFunction.cpp +++ b/dbms/src/Columns/ColumnAggregateFunction.cpp @@ -182,7 +182,7 @@ ColumnPtr ColumnAggregateFunction::filter(const Filter & filter, ssize_t result_ } -ColumnPtr ColumnAggregateFunction::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnAggregateFunction::permute(const Permutation & perm, UInt64 limit) const { size_t size = data.size(); @@ -203,13 +203,13 @@ ColumnPtr ColumnAggregateFunction::permute(const Permutation & perm, size_t limi return res; } -ColumnPtr ColumnAggregateFunction::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnAggregateFunction::index(const IColumn & indexes, UInt64 limit) const { return selectIndexImpl(*this, indexes, limit); } template -ColumnPtr ColumnAggregateFunction::indexImpl(const PaddedPODArray & indexes, size_t limit) const +ColumnPtr ColumnAggregateFunction::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const { auto res = createView(); diff --git a/dbms/src/Columns/ColumnAggregateFunction.h b/dbms/src/Columns/ColumnAggregateFunction.h index cd352007095..e44689d992e 100644 --- a/dbms/src/Columns/ColumnAggregateFunction.h +++ b/dbms/src/Columns/ColumnAggregateFunction.h @@ -161,12 +161,12 @@ public: ColumnPtr filter(const Filter & filter, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; template - ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const; + ColumnPtr indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; ColumnPtr replicate(const Offsets & offsets) const override; @@ -179,7 +179,7 @@ public: return 0; } - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; /** More efficient manipulation methods */ Container & getData() diff --git a/dbms/src/Columns/ColumnArray.cpp b/dbms/src/Columns/ColumnArray.cpp index 0b7e2903b93..6b7ee958441 100644 --- a/dbms/src/Columns/ColumnArray.cpp +++ b/dbms/src/Columns/ColumnArray.cpp @@ -589,7 +589,7 @@ ColumnPtr ColumnArray::filterTuple(const Filter & filt, ssize_t result_size_hint } -ColumnPtr ColumnArray::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnArray::permute(const Permutation & perm, UInt64 limit) const { size_t size = getOffsets().size(); @@ -626,13 +626,13 @@ ColumnPtr ColumnArray::permute(const Permutation & perm, size_t limit) const return res; } -ColumnPtr ColumnArray::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnArray::index(const IColumn & indexes, UInt64 limit) const { return selectIndexImpl(*this, indexes, limit); } template -ColumnPtr ColumnArray::indexImpl(const PaddedPODArray & indexes, size_t limit) const +ColumnPtr ColumnArray::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const { if (limit == 0) return ColumnArray::create(data); @@ -664,7 +664,7 @@ ColumnPtr ColumnArray::indexImpl(const PaddedPODArray & indexes, size_t limit INSTANTIATE_INDEX_IMPL(ColumnArray) -void ColumnArray::getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const +void ColumnArray::getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const { size_t s = size(); if (limit >= s) diff --git a/dbms/src/Columns/ColumnArray.h b/dbms/src/Columns/ColumnArray.h index 3e1b586e755..51385f0bb40 100644 --- a/dbms/src/Columns/ColumnArray.h +++ b/dbms/src/Columns/ColumnArray.h @@ -70,11 +70,11 @@ public: void insertDefault() override; void popBack(size_t n) override; ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; - template ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; + template ColumnPtr indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override; - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; void reserve(size_t n) override; size_t byteSize() const override; size_t allocatedBytes() const override; diff --git a/dbms/src/Columns/ColumnConst.cpp b/dbms/src/Columns/ColumnConst.cpp index 3703d24f1cb..24610877736 100644 --- a/dbms/src/Columns/ColumnConst.cpp +++ b/dbms/src/Columns/ColumnConst.cpp @@ -54,7 +54,7 @@ ColumnPtr ColumnConst::replicate(const Offsets & offsets) const return ColumnConst::create(data, replicated_size); } -ColumnPtr ColumnConst::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnConst::permute(const Permutation & perm, UInt64 limit) const { if (limit == 0) limit = s; @@ -68,7 +68,7 @@ ColumnPtr ColumnConst::permute(const Permutation & perm, size_t limit) const return ColumnConst::create(data, limit); } -ColumnPtr ColumnConst::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnConst::index(const IColumn & indexes, UInt64 limit) const { if (limit == 0) limit = indexes.size(); diff --git a/dbms/src/Columns/ColumnConst.h b/dbms/src/Columns/ColumnConst.h index 248bb04a186..a8af6cf4e23 100644 --- a/dbms/src/Columns/ColumnConst.h +++ b/dbms/src/Columns/ColumnConst.h @@ -154,9 +154,9 @@ public: ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override; ColumnPtr replicate(const Offsets & offsets) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; size_t byteSize() const override { diff --git a/dbms/src/Columns/ColumnDecimal.cpp b/dbms/src/Columns/ColumnDecimal.cpp index 3663981b632..a366fcfff0b 100644 --- a/dbms/src/Columns/ColumnDecimal.cpp +++ b/dbms/src/Columns/ColumnDecimal.cpp @@ -63,7 +63,7 @@ void ColumnDecimal::updateHashWithValue(size_t n, SipHash & hash) const } template -void ColumnDecimal::getPermutation(bool reverse, size_t limit, int , IColumn::Permutation & res) const +void ColumnDecimal::getPermutation(bool reverse, UInt64 limit, int , IColumn::Permutation & res) const { #if 1 /// TODO: perf test if (data.size() <= std::numeric_limits::max()) @@ -82,7 +82,7 @@ void ColumnDecimal::getPermutation(bool reverse, size_t limit, int , IColumn: } template -ColumnPtr ColumnDecimal::permute(const IColumn::Permutation & perm, size_t limit) const +ColumnPtr ColumnDecimal::permute(const IColumn::Permutation & perm, UInt64 limit) const { size_t size = limit ? std::min(data.size(), limit) : data.size(); if (perm.size() < size) @@ -173,7 +173,7 @@ ColumnPtr ColumnDecimal::filter(const IColumn::Filter & filt, ssize_t result_ } template -ColumnPtr ColumnDecimal::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnDecimal::index(const IColumn & indexes, UInt64 limit) const { return selectIndexImpl(*this, indexes, limit); } diff --git a/dbms/src/Columns/ColumnDecimal.h b/dbms/src/Columns/ColumnDecimal.h index 50a6d9d67fb..2bdaaf8d536 100644 --- a/dbms/src/Columns/ColumnDecimal.h +++ b/dbms/src/Columns/ColumnDecimal.h @@ -101,7 +101,7 @@ public: const char * deserializeAndInsertFromArena(const char * pos) override; void updateHashWithValue(size_t n, SipHash & hash) const override; int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override; - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, IColumn::Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, IColumn::Permutation & res) const override; MutableColumnPtr cloneResized(size_t size) const override; @@ -116,11 +116,11 @@ public: bool isDefaultAt(size_t n) const override { return data[n] == 0; } ColumnPtr filter(const IColumn::Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const IColumn::Permutation & perm, size_t limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr permute(const IColumn::Permutation & perm, UInt64 limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; template - ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const; + ColumnPtr indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; ColumnPtr replicate(const IColumn::Offsets & offsets) const override; void getExtremes(Field & min, Field & max) const override; @@ -144,7 +144,7 @@ protected: UInt32 scale; template - void permutation(bool reverse, size_t limit, PaddedPODArray & res) const + void permutation(bool reverse, UInt64 limit, PaddedPODArray & res) const { size_t s = data.size(); res.resize(s); @@ -164,7 +164,7 @@ protected: template template -ColumnPtr ColumnDecimal::indexImpl(const PaddedPODArray & indexes, size_t limit) const +ColumnPtr ColumnDecimal::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const { size_t size = indexes.size(); diff --git a/dbms/src/Columns/ColumnFixedString.cpp b/dbms/src/Columns/ColumnFixedString.cpp index 955af04ee25..00e8fbae71f 100644 --- a/dbms/src/Columns/ColumnFixedString.cpp +++ b/dbms/src/Columns/ColumnFixedString.cpp @@ -112,7 +112,7 @@ struct ColumnFixedString::less } }; -void ColumnFixedString::getPermutation(bool reverse, size_t limit, int /*nan_direction_hint*/, Permutation & res) const +void ColumnFixedString::getPermutation(bool reverse, UInt64 limit, int /*nan_direction_hint*/, Permutation & res) const { size_t s = size(); res.resize(s); @@ -231,7 +231,7 @@ ColumnPtr ColumnFixedString::filter(const IColumn::Filter & filt, ssize_t result return res; } -ColumnPtr ColumnFixedString::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnFixedString::permute(const Permutation & perm, UInt64 limit) const { size_t col_size = size(); @@ -260,14 +260,14 @@ ColumnPtr ColumnFixedString::permute(const Permutation & perm, size_t limit) con } -ColumnPtr ColumnFixedString::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnFixedString::index(const IColumn & indexes, UInt64 limit) const { return selectIndexImpl(*this, indexes, limit); } template -ColumnPtr ColumnFixedString::indexImpl(const PaddedPODArray & indexes, size_t limit) const +ColumnPtr ColumnFixedString::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const { if (limit == 0) return ColumnFixedString::create(n); diff --git a/dbms/src/Columns/ColumnFixedString.h b/dbms/src/Columns/ColumnFixedString.h index 96f9b05189c..5ec0e754850 100644 --- a/dbms/src/Columns/ColumnFixedString.h +++ b/dbms/src/Columns/ColumnFixedString.h @@ -101,18 +101,18 @@ public: return memcmp(&chars[p1 * n], &rhs.chars[p2 * n], n); } - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; void insertRangeFrom(const IColumn & src, size_t start, size_t length) override; ColumnPtr filter(const IColumn::Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; template - ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const; + ColumnPtr indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; ColumnPtr replicate(const Offsets & offsets) const override; diff --git a/dbms/src/Columns/ColumnFunction.cpp b/dbms/src/Columns/ColumnFunction.cpp index 8bc239eb657..2da4fd6cc04 100644 --- a/dbms/src/Columns/ColumnFunction.cpp +++ b/dbms/src/Columns/ColumnFunction.cpp @@ -70,7 +70,7 @@ ColumnPtr ColumnFunction::filter(const Filter & filt, ssize_t result_size_hint) return ColumnFunction::create(filtered_size, function, capture); } -ColumnPtr ColumnFunction::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnFunction::permute(const Permutation & perm, UInt64 limit) const { if (limit == 0) limit = size_; @@ -88,7 +88,7 @@ ColumnPtr ColumnFunction::permute(const Permutation & perm, size_t limit) const return ColumnFunction::create(limit, function, capture); } -ColumnPtr ColumnFunction::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnFunction::index(const IColumn & indexes, UInt64 limit) const { ColumnsWithTypeAndName capture = captured_columns; for (auto & column : capture) diff --git a/dbms/src/Columns/ColumnFunction.h b/dbms/src/Columns/ColumnFunction.h index 458167ffefe..7236081ee83 100644 --- a/dbms/src/Columns/ColumnFunction.h +++ b/dbms/src/Columns/ColumnFunction.h @@ -32,8 +32,8 @@ public: ColumnPtr cut(size_t start, size_t length) const override; ColumnPtr replicate(const Offsets & offsets) const override; ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; void insertDefault() override; void popBack(size_t n) override; std::vector scatter(IColumn::ColumnIndex num_columns, diff --git a/dbms/src/Columns/ColumnLowCardinality.cpp b/dbms/src/Columns/ColumnLowCardinality.cpp index 49a0ca7da67..ce6cecdba9e 100644 --- a/dbms/src/Columns/ColumnLowCardinality.cpp +++ b/dbms/src/Columns/ColumnLowCardinality.cpp @@ -250,7 +250,7 @@ int ColumnLowCardinality::compareAt(size_t n, size_t m, const IColumn & rhs, int return getDictionary().compareAt(n_index, m_index, low_cardinality_column.getDictionary(), nan_direction_hint); } -void ColumnLowCardinality::getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const +void ColumnLowCardinality::getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const { if (limit == 0) limit = size(); @@ -343,7 +343,7 @@ void ColumnLowCardinality::compactIfSharedDictionary() ColumnLowCardinality::DictionaryEncodedColumn -ColumnLowCardinality::getMinimalDictionaryEncodedColumn(size_t offset, size_t limit) const +ColumnLowCardinality::getMinimalDictionaryEncodedColumn(UInt64 offset, UInt64 limit) const { MutableColumnPtr sub_indexes = (*std::move(idx.getPositions()->cut(offset, limit))).mutate(); auto indexes_map = mapUniqueIndex(*sub_indexes); @@ -527,7 +527,7 @@ void ColumnLowCardinality::Index::insertPosition(UInt64 position) checkSizeOfType(); } -void ColumnLowCardinality::Index::insertPositionsRange(const IColumn & column, size_t offset, size_t limit) +void ColumnLowCardinality::Index::insertPositionsRange(const IColumn & column, UInt64 offset, UInt64 limit) { auto insertForType = [&](auto type) { @@ -550,10 +550,10 @@ void ColumnLowCardinality::Index::insertPositionsRange(const IColumn & column, s auto & positions_data = getPositionsData(); const auto & column_data = column_ptr->getData(); - size_t size = positions_data.size(); + UInt64 size = positions_data.size(); positions_data.resize(size + limit); - for (size_t i = 0; i < limit; ++i) + for (UInt64 i = 0; i < limit; ++i) positions_data[size + i] = column_data[offset + i]; }; diff --git a/dbms/src/Columns/ColumnLowCardinality.h b/dbms/src/Columns/ColumnLowCardinality.h index 34a3db8589e..24599722885 100644 --- a/dbms/src/Columns/ColumnLowCardinality.h +++ b/dbms/src/Columns/ColumnLowCardinality.h @@ -90,19 +90,19 @@ public: return ColumnLowCardinality::create(dictionary.getColumnUniquePtr(), getIndexes().filter(filt, result_size_hint)); } - ColumnPtr permute(const Permutation & perm, size_t limit) const override + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override { return ColumnLowCardinality::create(dictionary.getColumnUniquePtr(), getIndexes().permute(perm, limit)); } - ColumnPtr index(const IColumn & indexes_, size_t limit) const override + ColumnPtr index(const IColumn & indexes_, UInt64 limit) const override { return ColumnLowCardinality::create(dictionary.getColumnUniquePtr(), getIndexes().index(indexes_, limit)); } int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override; - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; ColumnPtr replicate(const Offsets & offsets) const override { @@ -180,7 +180,7 @@ public: ColumnPtr indexes; }; - DictionaryEncodedColumn getMinimalDictionaryEncodedColumn(size_t offset, size_t limit) const; + DictionaryEncodedColumn getMinimalDictionaryEncodedColumn(UInt64 offset, UInt64 limit) const; ColumnPtr countKeys() const; @@ -196,7 +196,7 @@ public: ColumnPtr & getPositionsPtr() { return positions; } size_t getPositionAt(size_t row) const; void insertPosition(UInt64 position); - void insertPositionsRange(const IColumn & column, size_t offset, size_t limit); + void insertPositionsRange(const IColumn & column, UInt64 offset, UInt64 limit); void popBack(size_t n) { positions->assumeMutableRef().popBack(n); } void reserve(size_t n) { positions->assumeMutableRef().reserve(n); } diff --git a/dbms/src/Columns/ColumnNullable.cpp b/dbms/src/Columns/ColumnNullable.cpp index b88cf60581b..b075ae241a9 100644 --- a/dbms/src/Columns/ColumnNullable.cpp +++ b/dbms/src/Columns/ColumnNullable.cpp @@ -158,14 +158,14 @@ ColumnPtr ColumnNullable::filter(const Filter & filt, ssize_t result_size_hint) return ColumnNullable::create(filtered_data, filtered_null_map); } -ColumnPtr ColumnNullable::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnNullable::permute(const Permutation & perm, UInt64 limit) const { ColumnPtr permuted_data = getNestedColumn().permute(perm, limit); ColumnPtr permuted_null_map = getNullMapColumn().permute(perm, limit); return ColumnNullable::create(permuted_data, permuted_null_map); } -ColumnPtr ColumnNullable::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnNullable::index(const IColumn & indexes, UInt64 limit) const { ColumnPtr indexed_data = getNestedColumn().index(indexes, limit); ColumnPtr indexed_null_map = getNullMapColumn().index(indexes, limit); @@ -197,7 +197,7 @@ int ColumnNullable::compareAt(size_t n, size_t m, const IColumn & rhs_, int null return getNestedColumn().compareAt(n, m, nested_rhs, null_direction_hint); } -void ColumnNullable::getPermutation(bool reverse, size_t limit, int null_direction_hint, Permutation & res) const +void ColumnNullable::getPermutation(bool reverse, UInt64 limit, int null_direction_hint, Permutation & res) const { /// Cannot pass limit because of unknown amount of NULLs. getNestedColumn().getPermutation(reverse, 0, null_direction_hint, res); diff --git a/dbms/src/Columns/ColumnNullable.h b/dbms/src/Columns/ColumnNullable.h index c8453a29689..5bb72617eb3 100644 --- a/dbms/src/Columns/ColumnNullable.h +++ b/dbms/src/Columns/ColumnNullable.h @@ -64,10 +64,10 @@ public: void popBack(size_t n) override; ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; int compareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const override; - void getPermutation(bool reverse, size_t limit, int null_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int null_direction_hint, Permutation & res) const override; void reserve(size_t n) override; size_t byteSize() const override; size_t allocatedBytes() const override; diff --git a/dbms/src/Columns/ColumnString.cpp b/dbms/src/Columns/ColumnString.cpp index 86521e3dfb5..b7cb13ea617 100644 --- a/dbms/src/Columns/ColumnString.cpp +++ b/dbms/src/Columns/ColumnString.cpp @@ -111,7 +111,7 @@ ColumnPtr ColumnString::filter(const Filter & filt, ssize_t result_size_hint) co } -ColumnPtr ColumnString::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnString::permute(const Permutation & perm, UInt64 limit) const { size_t size = offsets.size(); @@ -191,13 +191,13 @@ const char * ColumnString::deserializeAndInsertFromArena(const char * pos) } -ColumnPtr ColumnString::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnString::index(const IColumn & indexes, UInt64 limit) const { return selectIndexImpl(*this, indexes, limit); } template -ColumnPtr ColumnString::indexImpl(const PaddedPODArray & indexes, size_t limit) const +ColumnPtr ColumnString::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const { if (limit == 0) return ColumnString::create(); @@ -251,7 +251,7 @@ struct ColumnString::less } }; -void ColumnString::getPermutation(bool reverse, size_t limit, int /*nan_direction_hint*/, Permutation & res) const +void ColumnString::getPermutation(bool reverse, UInt64 limit, int /*nan_direction_hint*/, Permutation & res) const { size_t s = offsets.size(); res.resize(s); @@ -389,7 +389,7 @@ struct ColumnString::lessWithCollation } }; -void ColumnString::getPermutationWithCollation(const Collator & collator, bool reverse, size_t limit, Permutation & res) const +void ColumnString::getPermutationWithCollation(const Collator & collator, bool reverse, UInt64 limit, Permutation & res) const { size_t s = offsets.size(); res.resize(s); diff --git a/dbms/src/Columns/ColumnString.h b/dbms/src/Columns/ColumnString.h index 6b2e58d54d1..6bcfed61993 100644 --- a/dbms/src/Columns/ColumnString.h +++ b/dbms/src/Columns/ColumnString.h @@ -194,12 +194,12 @@ public: ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; template - ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const; + ColumnPtr indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; void insertDefault() override { @@ -225,10 +225,10 @@ public: /// Variant of compareAt for string comparison with respect of collation. int compareAtWithCollation(size_t n, size_t m, const IColumn & rhs_, const Collator & collator) const; - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; /// Sorting with respect of collation. - void getPermutationWithCollation(const Collator & collator, bool reverse, size_t limit, Permutation & res) const; + void getPermutationWithCollation(const Collator & collator, bool reverse, UInt64 limit, Permutation & res) const; ColumnPtr replicate(const Offsets & replicate_offsets) const override; diff --git a/dbms/src/Columns/ColumnTuple.cpp b/dbms/src/Columns/ColumnTuple.cpp index c235cd07c31..4c6bce482ae 100644 --- a/dbms/src/Columns/ColumnTuple.cpp +++ b/dbms/src/Columns/ColumnTuple.cpp @@ -170,7 +170,7 @@ ColumnPtr ColumnTuple::filter(const Filter & filt, ssize_t result_size_hint) con return ColumnTuple::create(new_columns); } -ColumnPtr ColumnTuple::permute(const Permutation & perm, size_t limit) const +ColumnPtr ColumnTuple::permute(const Permutation & perm, UInt64 limit) const { const size_t tuple_size = columns.size(); Columns new_columns(tuple_size); @@ -181,7 +181,7 @@ ColumnPtr ColumnTuple::permute(const Permutation & perm, size_t limit) const return ColumnTuple::create(new_columns); } -ColumnPtr ColumnTuple::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnTuple::index(const IColumn & indexes, UInt64 limit) const { const size_t tuple_size = columns.size(); Columns new_columns(tuple_size); @@ -261,7 +261,7 @@ struct ColumnTuple::Less } }; -void ColumnTuple::getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const +void ColumnTuple::getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const { size_t rows = size(); res.resize(rows); diff --git a/dbms/src/Columns/ColumnTuple.h b/dbms/src/Columns/ColumnTuple.h index d146c8bff6c..45a04c02c35 100644 --- a/dbms/src/Columns/ColumnTuple.h +++ b/dbms/src/Columns/ColumnTuple.h @@ -60,14 +60,14 @@ public: void updateHashWithValue(size_t n, SipHash & hash) const override; void insertRangeFrom(const IColumn & src, size_t start, size_t length) override; ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const Permutation & perm, size_t limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; ColumnPtr replicate(const Offsets & offsets) const override; MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override; void gather(ColumnGathererStream & gatherer_stream) override; int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override; void getExtremes(Field & min, Field & max) const override; - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const override; void reserve(size_t n) override; size_t byteSize() const override; size_t allocatedBytes() const override; diff --git a/dbms/src/Columns/ColumnVector.cpp b/dbms/src/Columns/ColumnVector.cpp index 78241f4f4a0..8a071bf6d1b 100644 --- a/dbms/src/Columns/ColumnVector.cpp +++ b/dbms/src/Columns/ColumnVector.cpp @@ -71,7 +71,7 @@ struct ColumnVector::greater }; template -void ColumnVector::getPermutation(bool reverse, size_t limit, int nan_direction_hint, IColumn::Permutation & res) const +void ColumnVector::getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, IColumn::Permutation & res) const { size_t s = data.size(); res.resize(s); @@ -211,7 +211,7 @@ ColumnPtr ColumnVector::filter(const IColumn::Filter & filt, ssize_t result_s } template -ColumnPtr ColumnVector::permute(const IColumn::Permutation & perm, size_t limit) const +ColumnPtr ColumnVector::permute(const IColumn::Permutation & perm, UInt64 limit) const { size_t size = data.size(); @@ -232,7 +232,7 @@ ColumnPtr ColumnVector::permute(const IColumn::Permutation & perm, size_t lim } template -ColumnPtr ColumnVector::index(const IColumn & indexes, size_t limit) const +ColumnPtr ColumnVector::index(const IColumn & indexes, UInt64 limit) const { return selectIndexImpl(*this, indexes, limit); } diff --git a/dbms/src/Columns/ColumnVector.h b/dbms/src/Columns/ColumnVector.h index 1c5a45ef6ad..7159c25aa59 100644 --- a/dbms/src/Columns/ColumnVector.h +++ b/dbms/src/Columns/ColumnVector.h @@ -174,7 +174,7 @@ public: return CompareHelper::compare(data[n], static_cast(rhs_).data[m], nan_direction_hint); } - void getPermutation(bool reverse, size_t limit, int nan_direction_hint, IColumn::Permutation & res) const override; + void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, IColumn::Permutation & res) const override; void reserve(size_t n) override { @@ -221,12 +221,12 @@ public: ColumnPtr filter(const IColumn::Filter & filt, ssize_t result_size_hint) const override; - ColumnPtr permute(const IColumn::Permutation & perm, size_t limit) const override; + ColumnPtr permute(const IColumn::Permutation & perm, UInt64 limit) const override; - ColumnPtr index(const IColumn & indexes, size_t limit) const override; + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override; template - ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const; + ColumnPtr indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; ColumnPtr replicate(const IColumn::Offsets & offsets) const override; @@ -273,7 +273,7 @@ protected: template template -ColumnPtr ColumnVector::indexImpl(const PaddedPODArray & indexes, size_t limit) const +ColumnPtr ColumnVector::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const { size_t size = indexes.size(); diff --git a/dbms/src/Columns/ColumnsCommon.h b/dbms/src/Columns/ColumnsCommon.h index 1902774529b..355145bf391 100644 --- a/dbms/src/Columns/ColumnsCommon.h +++ b/dbms/src/Columns/ColumnsCommon.h @@ -44,9 +44,9 @@ namespace detail const PaddedPODArray * getIndexesData(const IColumn & indexes); } -/// Check limit <= indexes->size() and call column.indexImpl(const PaddedPodArray & indexes, size_t limit). +/// Check limit <= indexes->size() and call column.indexImpl(const PaddedPodArray & indexes, UInt64 limit). template -ColumnPtr selectIndexImpl(const Column & column, const IColumn & indexes, size_t limit) +ColumnPtr selectIndexImpl(const Column & column, const IColumn & indexes, UInt64 limit) { if (limit == 0) limit = indexes.size(); @@ -68,8 +68,8 @@ ColumnPtr selectIndexImpl(const Column & column, const IColumn & indexes, size_t } #define INSTANTIATE_INDEX_IMPL(Column) \ - template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, size_t limit) const; \ - template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, size_t limit) const; \ - template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, size_t limit) const; \ - template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, size_t limit) const; + template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; \ + template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; \ + template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; \ + template ColumnPtr Column::indexImpl(const PaddedPODArray & indexes, UInt64 limit) const; } diff --git a/dbms/src/Columns/IColumn.h b/dbms/src/Columns/IColumn.h index 2560b9639ad..55cf1e77e35 100644 --- a/dbms/src/Columns/IColumn.h +++ b/dbms/src/Columns/IColumn.h @@ -184,11 +184,11 @@ public: /// Permutes elements using specified permutation. Is used in sortings. /// limit - if it isn't 0, puts only first limit elements in the result. using Permutation = PaddedPODArray; - virtual Ptr permute(const Permutation & perm, size_t limit) const = 0; + virtual Ptr permute(const Permutation & perm, UInt64 limit) const = 0; /// Creates new column with values column[indexes[:limit]]. If limit is 0, all indexes are used. /// Indexes must be one of the ColumnUInt. For default implementation, see selectIndexImpl from ColumnsCommon.h - virtual Ptr index(const IColumn & indexes, size_t limit) const = 0; + virtual Ptr index(const IColumn & indexes, UInt64 limit) const = 0; /** Compares (*this)[n] and rhs[m]. Column rhs should have the same type. * Returns negative number, 0, or positive number (*this)[n] is less, equal, greater than rhs[m] respectively. @@ -209,7 +209,7 @@ public: * limit - if isn't 0, then only first limit elements of the result column could be sorted. * nan_direction_hint - see above. */ - virtual void getPermutation(bool reverse, size_t limit, int nan_direction_hint, Permutation & res) const = 0; + virtual void getPermutation(bool reverse, UInt64 limit, int nan_direction_hint, Permutation & res) const = 0; /** Copies each element according offsets parameter. * (i-th element should be copied offsets[i] - offsets[i - 1] times.) diff --git a/dbms/src/Columns/IColumnDummy.h b/dbms/src/Columns/IColumnDummy.h index beb0d101122..0bc2693ce45 100644 --- a/dbms/src/Columns/IColumnDummy.h +++ b/dbms/src/Columns/IColumnDummy.h @@ -79,7 +79,7 @@ public: return cloneDummy(countBytesInFilter(filt)); } - ColumnPtr permute(const Permutation & perm, size_t limit) const override + ColumnPtr permute(const Permutation & perm, UInt64 limit) const override { if (s != perm.size()) throw Exception("Size of permutation doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH); @@ -87,7 +87,7 @@ public: return cloneDummy(limit ? std::min(s, limit) : s); } - ColumnPtr index(const IColumn & indexes, size_t limit) const override + ColumnPtr index(const IColumn & indexes, UInt64 limit) const override { if (indexes.size() < limit) throw Exception("Size of indexes is less than required.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH); diff --git a/dbms/src/Common/ErrorCodes.cpp b/dbms/src/Common/ErrorCodes.cpp index 5a89283e624..d56f90108c0 100644 --- a/dbms/src/Common/ErrorCodes.cpp +++ b/dbms/src/Common/ErrorCodes.cpp @@ -414,7 +414,8 @@ namespace ErrorCodes extern const int PROTOBUF_FIELD_NOT_REPEATED = 437; extern const int DATA_TYPE_CANNOT_BE_PROMOTED = 438; extern const int CANNOT_SCHEDULE_TASK = 439; - extern const int CANNOT_PARSE_DOMAIN_VALUE_FROM_STRING = 440; + extern const int INVALID_LIMIT_EXPRESSION = 440; + extern const int CANNOT_PARSE_DOMAIN_VALUE_FROM_STRING = 441; extern const int KEEPER_EXCEPTION = 999; extern const int POCO_EXCEPTION = 1000; diff --git a/dbms/src/Common/Throttler.h b/dbms/src/Common/Throttler.h index 9c7b446dd96..456794b2811 100644 --- a/dbms/src/Common/Throttler.h +++ b/dbms/src/Common/Throttler.h @@ -108,7 +108,7 @@ public: private: size_t count = 0; const size_t max_speed = 0; - const size_t limit = 0; /// 0 - not limited. + const UInt64 limit = 0; /// 0 - not limited. const char * limit_exceeded_exception_message = nullptr; Stopwatch watch {CLOCK_MONOTONIC_COARSE}; std::mutex mutex; diff --git a/dbms/src/Common/XDBCBridgeHelper.h b/dbms/src/Common/XDBCBridgeHelper.h index c820075add3..9b4cb96b468 100644 --- a/dbms/src/Common/XDBCBridgeHelper.h +++ b/dbms/src/Common/XDBCBridgeHelper.h @@ -33,7 +33,7 @@ class IXDBCBridgeHelper public: static constexpr inline auto DEFAULT_FORMAT = "RowBinary"; - virtual std::vector> getURLParams(const std::string & cols, size_t max_block_size) const = 0; + virtual std::vector> getURLParams(const std::string & cols, UInt64 max_block_size) const = 0; virtual void startBridgeSync() const = 0; virtual Poco::URI getMainURI() const = 0; virtual Poco::URI getColumnsInfoURI() const = 0; @@ -127,7 +127,7 @@ public: /** * @todo leaky abstraction - used by external API's */ - std::vector> getURLParams(const std::string & cols, size_t max_block_size) const override + std::vector> getURLParams(const std::string & cols, UInt64 max_block_size) const override { std::vector> result; diff --git a/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp b/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp index 0697ec8167c..1176619cd91 100644 --- a/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp @@ -13,7 +13,7 @@ namespace ErrorCodes AggregatingSortedBlockInputStream::AggregatingSortedBlockInputStream( - const BlockInputStreams & inputs_, const SortDescription & description_, size_t max_block_size_) + const BlockInputStreams & inputs_, const SortDescription & description_, UInt64 max_block_size_) : MergingSortedBlockInputStream(inputs_, description_, max_block_size_) { /// Fill in the column numbers that need to be aggregated. diff --git a/dbms/src/DataStreams/AggregatingSortedBlockInputStream.h b/dbms/src/DataStreams/AggregatingSortedBlockInputStream.h index 522b54aeaec..15cf58a1910 100644 --- a/dbms/src/DataStreams/AggregatingSortedBlockInputStream.h +++ b/dbms/src/DataStreams/AggregatingSortedBlockInputStream.h @@ -22,7 +22,7 @@ class AggregatingSortedBlockInputStream : public MergingSortedBlockInputStream { public: AggregatingSortedBlockInputStream( - const BlockInputStreams & inputs_, const SortDescription & description_, size_t max_block_size_); + const BlockInputStreams & inputs_, const SortDescription & description_, UInt64 max_block_size_); String getName() const override { return "AggregatingSorted"; } diff --git a/dbms/src/DataStreams/CollapsingSortedBlockInputStream.h b/dbms/src/DataStreams/CollapsingSortedBlockInputStream.h index 776b39c76d0..bd1a33436e0 100644 --- a/dbms/src/DataStreams/CollapsingSortedBlockInputStream.h +++ b/dbms/src/DataStreams/CollapsingSortedBlockInputStream.h @@ -25,7 +25,7 @@ class CollapsingSortedBlockInputStream : public MergingSortedBlockInputStream public: CollapsingSortedBlockInputStream( BlockInputStreams inputs_, const SortDescription & description_, - const String & sign_column, size_t max_block_size_, WriteBuffer * out_row_sources_buf_ = nullptr) + const String & sign_column, UInt64 max_block_size_, WriteBuffer * out_row_sources_buf_ = nullptr) : MergingSortedBlockInputStream(inputs_, description_, max_block_size_, 0, out_row_sources_buf_) { sign_column_number = header.getPositionByName(sign_column); diff --git a/dbms/src/DataStreams/DistinctBlockInputStream.cpp b/dbms/src/DataStreams/DistinctBlockInputStream.cpp index 2b9bcc490b2..644d8fef89b 100644 --- a/dbms/src/DataStreams/DistinctBlockInputStream.cpp +++ b/dbms/src/DataStreams/DistinctBlockInputStream.cpp @@ -8,7 +8,7 @@ namespace ErrorCodes extern const int SET_SIZE_LIMIT_EXCEEDED; } -DistinctBlockInputStream::DistinctBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, size_t limit_hint_, const Names & columns) +DistinctBlockInputStream::DistinctBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, UInt64 limit_hint_, const Names & columns) : columns_names(columns) , limit_hint(limit_hint_) , set_size_limits(set_size_limits) diff --git a/dbms/src/DataStreams/DistinctBlockInputStream.h b/dbms/src/DataStreams/DistinctBlockInputStream.h index ca55c7e7ac4..3eb7c5ffcb0 100644 --- a/dbms/src/DataStreams/DistinctBlockInputStream.h +++ b/dbms/src/DataStreams/DistinctBlockInputStream.h @@ -17,7 +17,7 @@ class DistinctBlockInputStream : public IBlockInputStream { public: /// Empty columns_ means all collumns. - DistinctBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, size_t limit_hint_, const Names & columns); + DistinctBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, UInt64 limit_hint_, const Names & columns); String getName() const override { return "Distinct"; } @@ -41,7 +41,7 @@ private: Names columns_names; SetVariants data; Sizes key_sizes; - size_t limit_hint; + UInt64 limit_hint; bool no_more_rows = false; diff --git a/dbms/src/DataStreams/DistinctSortedBlockInputStream.cpp b/dbms/src/DataStreams/DistinctSortedBlockInputStream.cpp index ed52f63dc86..ca38637ff1d 100644 --- a/dbms/src/DataStreams/DistinctSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/DistinctSortedBlockInputStream.cpp @@ -9,7 +9,7 @@ namespace ErrorCodes } DistinctSortedBlockInputStream::DistinctSortedBlockInputStream( - const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, size_t limit_hint_, const Names & columns) + const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, UInt64 limit_hint_, const Names & columns) : description(input->getSortDescription()) , columns_names(columns) , limit_hint(limit_hint_) diff --git a/dbms/src/DataStreams/DistinctSortedBlockInputStream.h b/dbms/src/DataStreams/DistinctSortedBlockInputStream.h index 661a2897ff5..9ecc053feb5 100644 --- a/dbms/src/DataStreams/DistinctSortedBlockInputStream.h +++ b/dbms/src/DataStreams/DistinctSortedBlockInputStream.h @@ -21,7 +21,7 @@ class DistinctSortedBlockInputStream : public IBlockInputStream { public: /// Empty columns_ means all collumns. - DistinctSortedBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, size_t limit_hint_, const Names & columns); + DistinctSortedBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits, UInt64 limit_hint_, const Names & columns); String getName() const override { return "DistinctSorted"; } @@ -59,7 +59,7 @@ private: Names columns_names; ClearableSetVariants data; Sizes key_sizes; - size_t limit_hint; + UInt64 limit_hint; /// Restrictions on the maximum size of the output data. SizeLimits set_size_limits; diff --git a/dbms/src/DataStreams/FinishSortingBlockInputStream.cpp b/dbms/src/DataStreams/FinishSortingBlockInputStream.cpp index ed3552f7f00..c0a45fc544e 100644 --- a/dbms/src/DataStreams/FinishSortingBlockInputStream.cpp +++ b/dbms/src/DataStreams/FinishSortingBlockInputStream.cpp @@ -26,7 +26,7 @@ static bool isPrefix(const SortDescription & pref_descr, const SortDescription & FinishSortingBlockInputStream::FinishSortingBlockInputStream( const BlockInputStreamPtr & input, const SortDescription & description_sorted_, const SortDescription & description_to_sort_, - size_t max_merged_block_size_, size_t limit_) + size_t max_merged_block_size_, UInt64 limit_) : description_sorted(description_sorted_), description_to_sort(description_to_sort_), max_merged_block_size(max_merged_block_size_), limit(limit_) { diff --git a/dbms/src/DataStreams/FinishSortingBlockInputStream.h b/dbms/src/DataStreams/FinishSortingBlockInputStream.h index b03eb24028b..c73dd2d4b85 100644 --- a/dbms/src/DataStreams/FinishSortingBlockInputStream.h +++ b/dbms/src/DataStreams/FinishSortingBlockInputStream.h @@ -17,7 +17,7 @@ public: /// limit - if not 0, allowed to return just first 'limit' rows in sorted order. FinishSortingBlockInputStream(const BlockInputStreamPtr & input, const SortDescription & description_sorted_, const SortDescription & description_to_sort_, - size_t max_merged_block_size_, size_t limit_); + size_t max_merged_block_size_, UInt64 limit_); String getName() const override { return "FinishSorting"; } @@ -33,7 +33,7 @@ private: SortDescription description_sorted; SortDescription description_to_sort; size_t max_merged_block_size; - size_t limit; + UInt64 limit; Block tail_block; Blocks blocks; diff --git a/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.cpp b/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.cpp index dc30a3e7a07..260deb858a3 100644 --- a/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.cpp @@ -13,7 +13,7 @@ namespace ErrorCodes GraphiteRollupSortedBlockInputStream::GraphiteRollupSortedBlockInputStream( - const BlockInputStreams & inputs_, const SortDescription & description_, size_t max_block_size_, + const BlockInputStreams & inputs_, const SortDescription & description_, UInt64 max_block_size_, const Graphite::Params & params, time_t time_of_merge) : MergingSortedBlockInputStream(inputs_, description_, max_block_size_), params(params), time_of_merge(time_of_merge) diff --git a/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.h b/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.h index e18522d6d25..85b7a064da4 100644 --- a/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.h +++ b/dbms/src/DataStreams/GraphiteRollupSortedBlockInputStream.h @@ -127,7 +127,7 @@ class GraphiteRollupSortedBlockInputStream : public MergingSortedBlockInputStrea { public: GraphiteRollupSortedBlockInputStream( - const BlockInputStreams & inputs_, const SortDescription & description_, size_t max_block_size_, + const BlockInputStreams & inputs_, const SortDescription & description_, UInt64 max_block_size_, const Graphite::Params & params, time_t time_of_merge); String getName() const override { return "GraphiteRollupSorted"; } diff --git a/dbms/src/DataStreams/LimitBlockInputStream.cpp b/dbms/src/DataStreams/LimitBlockInputStream.cpp index 298ea28e883..c0ac474fb60 100644 --- a/dbms/src/DataStreams/LimitBlockInputStream.cpp +++ b/dbms/src/DataStreams/LimitBlockInputStream.cpp @@ -6,7 +6,7 @@ namespace DB { -LimitBlockInputStream::LimitBlockInputStream(const BlockInputStreamPtr & input, size_t limit_, size_t offset_, bool always_read_till_end_) +LimitBlockInputStream::LimitBlockInputStream(const BlockInputStreamPtr & input, UInt64 limit_, UInt64 offset_, bool always_read_till_end_) : limit(limit_), offset(offset_), always_read_till_end(always_read_till_end_) { children.push_back(input); @@ -16,7 +16,7 @@ LimitBlockInputStream::LimitBlockInputStream(const BlockInputStreamPtr & input, Block LimitBlockInputStream::readImpl() { Block res; - size_t rows = 0; + UInt64 rows = 0; /// pos - how many lines were read, including the last read block @@ -46,11 +46,11 @@ Block LimitBlockInputStream::readImpl() return res; /// give away a piece of the block - size_t start = std::max( + UInt64 start = std::max( static_cast(0), static_cast(offset) - static_cast(pos) + static_cast(rows)); - size_t length = std::min( + UInt64 length = std::min( static_cast(limit), std::min( static_cast(pos) - static_cast(offset), static_cast(limit) + static_cast(offset) - static_cast(pos) + static_cast(rows))); diff --git a/dbms/src/DataStreams/LimitBlockInputStream.h b/dbms/src/DataStreams/LimitBlockInputStream.h index a9dea35dd21..6e77c5a2f6a 100644 --- a/dbms/src/DataStreams/LimitBlockInputStream.h +++ b/dbms/src/DataStreams/LimitBlockInputStream.h @@ -17,7 +17,7 @@ public: * If always_read_till_end = true - reads all the data to the end, but ignores them. This is necessary in rare cases: * when otherwise, due to the cancellation of the request, we would not have received the data for GROUP BY WITH TOTALS from the remote server. */ - LimitBlockInputStream(const BlockInputStreamPtr & input, size_t limit_, size_t offset_, bool always_read_till_end_ = false); + LimitBlockInputStream(const BlockInputStreamPtr & input, UInt64 limit_, UInt64 offset_, bool always_read_till_end_ = false); String getName() const override { return "Limit"; } @@ -27,9 +27,9 @@ protected: Block readImpl() override; private: - size_t limit; - size_t offset; - size_t pos = 0; + UInt64 limit; + UInt64 offset; + UInt64 pos = 0; bool always_read_till_end; }; diff --git a/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp b/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp index 12ad34b6433..e30dd4ae1de 100644 --- a/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp +++ b/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp @@ -20,7 +20,7 @@ namespace DB MergeSortingBlockInputStream::MergeSortingBlockInputStream( const BlockInputStreamPtr & input, SortDescription & description_, - size_t max_merged_block_size_, size_t limit_, size_t max_bytes_before_remerge_, + size_t max_merged_block_size_, UInt64 limit_, size_t max_bytes_before_remerge_, size_t max_bytes_before_external_sort_, const std::string & tmp_path_) : description(description_), max_merged_block_size(max_merged_block_size_), limit(limit_), max_bytes_before_remerge(max_bytes_before_remerge_), @@ -134,7 +134,7 @@ Block MergeSortingBlockInputStream::readImpl() MergeSortingBlocksBlockInputStream::MergeSortingBlocksBlockInputStream( - Blocks & blocks_, SortDescription & description_, size_t max_merged_block_size_, size_t limit_) + Blocks & blocks_, SortDescription & description_, size_t max_merged_block_size_, UInt64 limit_) : blocks(blocks_), header(blocks.at(0).cloneEmpty()), description(description_), max_merged_block_size(max_merged_block_size_), limit(limit_) { Blocks nonempty_blocks; diff --git a/dbms/src/DataStreams/MergeSortingBlockInputStream.h b/dbms/src/DataStreams/MergeSortingBlockInputStream.h index c9335208cb4..e256e575a8e 100644 --- a/dbms/src/DataStreams/MergeSortingBlockInputStream.h +++ b/dbms/src/DataStreams/MergeSortingBlockInputStream.h @@ -30,7 +30,7 @@ class MergeSortingBlocksBlockInputStream : public IBlockInputStream public: /// limit - if not 0, allowed to return just first 'limit' rows in sorted order. MergeSortingBlocksBlockInputStream(Blocks & blocks_, SortDescription & description_, - size_t max_merged_block_size_, size_t limit_ = 0); + size_t max_merged_block_size_, UInt64 limit_ = 0); String getName() const override { return "MergeSortingBlocks"; } @@ -47,7 +47,7 @@ private: Block header; SortDescription description; size_t max_merged_block_size; - size_t limit; + UInt64 limit; size_t total_merged_rows = 0; using CursorImpls = std::vector; @@ -71,7 +71,7 @@ class MergeSortingBlockInputStream : public IBlockInputStream public: /// limit - if not 0, allowed to return just first 'limit' rows in sorted order. MergeSortingBlockInputStream(const BlockInputStreamPtr & input, SortDescription & description_, - size_t max_merged_block_size_, size_t limit_, + size_t max_merged_block_size_, UInt64 limit_, size_t max_bytes_before_remerge_, size_t max_bytes_before_external_sort_, const std::string & tmp_path_); @@ -88,7 +88,7 @@ protected: private: SortDescription description; size_t max_merged_block_size; - size_t limit; + UInt64 limit; size_t max_bytes_before_remerge; size_t max_bytes_before_external_sort; diff --git a/dbms/src/DataStreams/MergingSortedBlockInputStream.cpp b/dbms/src/DataStreams/MergingSortedBlockInputStream.cpp index f1a1a02084f..a65a4195dfd 100644 --- a/dbms/src/DataStreams/MergingSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/MergingSortedBlockInputStream.cpp @@ -17,7 +17,7 @@ namespace ErrorCodes MergingSortedBlockInputStream::MergingSortedBlockInputStream( const BlockInputStreams & inputs_, const SortDescription & description_, - size_t max_block_size_, size_t limit_, WriteBuffer * out_row_sources_buf_, bool quiet_) + UInt64 max_block_size_, UInt64 limit_, WriteBuffer * out_row_sources_buf_, bool quiet_) : description(description_), max_block_size(max_block_size_), limit(limit_), quiet(quiet_) , source_blocks(inputs_.size()), cursors(inputs_.size()), out_row_sources_buf(out_row_sources_buf_) { diff --git a/dbms/src/DataStreams/MergingSortedBlockInputStream.h b/dbms/src/DataStreams/MergingSortedBlockInputStream.h index 63d0ee9b2cc..00a1011d78c 100644 --- a/dbms/src/DataStreams/MergingSortedBlockInputStream.h +++ b/dbms/src/DataStreams/MergingSortedBlockInputStream.h @@ -68,8 +68,8 @@ public: * quiet - don't log profiling info */ MergingSortedBlockInputStream( - const BlockInputStreams & inputs_, const SortDescription & description_, size_t max_block_size_, - size_t limit_ = 0, WriteBuffer * out_row_sources_buf_ = nullptr, bool quiet_ = false); + const BlockInputStreams & inputs_, const SortDescription & description_, UInt64 max_block_size_, + UInt64 limit_ = 0, WriteBuffer * out_row_sources_buf_ = nullptr, bool quiet_ = false); String getName() const override { return "MergingSorted"; } @@ -133,8 +133,8 @@ protected: Block header; const SortDescription description; - const size_t max_block_size; - size_t limit; + const UInt64 max_block_size; + UInt64 limit; size_t total_merged_rows = 0; bool first = true; diff --git a/dbms/src/DataStreams/NativeBlockOutputStream.cpp b/dbms/src/DataStreams/NativeBlockOutputStream.cpp index 11c3944afbb..c17d0dacc49 100644 --- a/dbms/src/DataStreams/NativeBlockOutputStream.cpp +++ b/dbms/src/DataStreams/NativeBlockOutputStream.cpp @@ -41,7 +41,7 @@ void NativeBlockOutputStream::flush() } -void NativeBlockOutputStream::writeData(const IDataType & type, const ColumnPtr & column, WriteBuffer & ostr, size_t offset, size_t limit) +void NativeBlockOutputStream::writeData(const IDataType & type, const ColumnPtr & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) { /** If there are columns-constants - then we materialize them. * (Since the data type does not know how to serialize / deserialize constants.) diff --git a/dbms/src/DataStreams/NativeBlockOutputStream.h b/dbms/src/DataStreams/NativeBlockOutputStream.h index 9834b90ef2a..720a779ec5e 100644 --- a/dbms/src/DataStreams/NativeBlockOutputStream.h +++ b/dbms/src/DataStreams/NativeBlockOutputStream.h @@ -30,7 +30,7 @@ public: void write(const Block & block) override; void flush() override; - static void writeData(const IDataType & type, const ColumnPtr & column, WriteBuffer & ostr, size_t offset, size_t limit); + static void writeData(const IDataType & type, const ColumnPtr & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit); String getContentType() const override { return "application/octet-stream"; } diff --git a/dbms/src/DataStreams/PartialSortingBlockInputStream.h b/dbms/src/DataStreams/PartialSortingBlockInputStream.h index b0f57f7564d..0c98b98385b 100644 --- a/dbms/src/DataStreams/PartialSortingBlockInputStream.h +++ b/dbms/src/DataStreams/PartialSortingBlockInputStream.h @@ -15,7 +15,7 @@ class PartialSortingBlockInputStream : public IBlockInputStream { public: /// limit - if not 0, then you can sort each block not completely, but only `limit` first rows by order. - PartialSortingBlockInputStream(const BlockInputStreamPtr & input_, SortDescription & description_, size_t limit_ = 0) + PartialSortingBlockInputStream(const BlockInputStreamPtr & input_, SortDescription & description_, UInt64 limit_ = 0) : description(description_), limit(limit_) { children.push_back(input_); @@ -29,7 +29,7 @@ protected: private: SortDescription description; - size_t limit; + UInt64 limit; }; } diff --git a/dbms/src/DataStreams/ReplacingSortedBlockInputStream.h b/dbms/src/DataStreams/ReplacingSortedBlockInputStream.h index d0a7594c69a..fa1e9d4428c 100644 --- a/dbms/src/DataStreams/ReplacingSortedBlockInputStream.h +++ b/dbms/src/DataStreams/ReplacingSortedBlockInputStream.h @@ -17,7 +17,7 @@ class ReplacingSortedBlockInputStream : public MergingSortedBlockInputStream public: ReplacingSortedBlockInputStream( const BlockInputStreams & inputs_, const SortDescription & description_, - const String & version_column, size_t max_block_size_, WriteBuffer * out_row_sources_buf_ = nullptr) + const String & version_column, UInt64 max_block_size_, WriteBuffer * out_row_sources_buf_ = nullptr) : MergingSortedBlockInputStream(inputs_, description_, max_block_size_, 0, out_row_sources_buf_) { if (!version_column.empty()) diff --git a/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp b/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp index cda13a29fd2..630ecf9c523 100644 --- a/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/SummingSortedBlockInputStream.cpp @@ -44,7 +44,7 @@ SummingSortedBlockInputStream::SummingSortedBlockInputStream( const SortDescription & description_, /// List of columns to be summed. If empty, all numeric columns that are not in the description are taken. const Names & column_names_to_sum, - size_t max_block_size_) + UInt64 max_block_size_) : MergingSortedBlockInputStream(inputs_, description_, max_block_size_) { current_row.resize(num_columns); diff --git a/dbms/src/DataStreams/SummingSortedBlockInputStream.h b/dbms/src/DataStreams/SummingSortedBlockInputStream.h index 96f417eb113..9368353c42a 100644 --- a/dbms/src/DataStreams/SummingSortedBlockInputStream.h +++ b/dbms/src/DataStreams/SummingSortedBlockInputStream.h @@ -30,7 +30,7 @@ public: const SortDescription & description_, /// List of columns to be summed. If empty, all numeric columns that are not in the description are taken. const Names & column_names_to_sum_, - size_t max_block_size_); + UInt64 max_block_size_); String getName() const override { return "SummingSorted"; } diff --git a/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.cpp b/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.cpp index fc24bef60bc..96ad83fcb64 100644 --- a/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.cpp +++ b/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.cpp @@ -15,7 +15,7 @@ namespace ErrorCodes VersionedCollapsingSortedBlockInputStream::VersionedCollapsingSortedBlockInputStream( const BlockInputStreams & inputs_, const SortDescription & description_, - const String & sign_column_, size_t max_block_size_, + const String & sign_column_, UInt64 max_block_size_, WriteBuffer * out_row_sources_buf_) : MergingSortedBlockInputStream(inputs_, description_, max_block_size_, 0, out_row_sources_buf_) , max_rows_in_queue(std::min(std::max(3, max_block_size_), MAX_ROWS_IN_MULTIVERSION_QUEUE) - 2) diff --git a/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.h b/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.h index 5e84284d2ee..2222ba9d93b 100644 --- a/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.h +++ b/dbms/src/DataStreams/VersionedCollapsingSortedBlockInputStream.h @@ -176,7 +176,7 @@ public: /// max_rows_in_queue should be about max_block_size_ if we won't store a lot of extra blocks (RowRef holds SharedBlockPtr). VersionedCollapsingSortedBlockInputStream( const BlockInputStreams & inputs_, const SortDescription & description_, - const String & sign_column_, size_t max_block_size_, + const String & sign_column_, UInt64 max_block_size_, WriteBuffer * out_row_sources_buf_ = nullptr); String getName() const override { return "VersionedCollapsingSorted"; } diff --git a/dbms/src/DataTypes/DataTypeAggregateFunction.cpp b/dbms/src/DataTypes/DataTypeAggregateFunction.cpp index 108bd70112c..33c6ba6a84f 100644 --- a/dbms/src/DataTypes/DataTypeAggregateFunction.cpp +++ b/dbms/src/DataTypes/DataTypeAggregateFunction.cpp @@ -100,7 +100,7 @@ void DataTypeAggregateFunction::deserializeBinary(IColumn & column, ReadBuffer & column_concrete.getData().push_back(place); } -void DataTypeAggregateFunction::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const +void DataTypeAggregateFunction::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const { const ColumnAggregateFunction & real_column = typeid_cast(column); const ColumnAggregateFunction::Container & vec = real_column.getData(); @@ -115,7 +115,7 @@ void DataTypeAggregateFunction::serializeBinaryBulk(const IColumn & column, Writ function->serialize(*it, ostr); } -void DataTypeAggregateFunction::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double /*avg_value_size_hint*/) const +void DataTypeAggregateFunction::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double /*avg_value_size_hint*/) const { ColumnAggregateFunction & real_column = typeid_cast(column); ColumnAggregateFunction::Container & vec = real_column.getData(); diff --git a/dbms/src/DataTypes/DataTypeAggregateFunction.h b/dbms/src/DataTypes/DataTypeAggregateFunction.h index 1bd5269ffe0..398bb8fb709 100644 --- a/dbms/src/DataTypes/DataTypeAggregateFunction.h +++ b/dbms/src/DataTypes/DataTypeAggregateFunction.h @@ -44,8 +44,8 @@ public: void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override; void deserializeBinary(IColumn & column, ReadBuffer & istr) const override; - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const override; void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; void deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override; diff --git a/dbms/src/DataTypes/DataTypeArray.cpp b/dbms/src/DataTypes/DataTypeArray.cpp index 2325b692cab..747d9fd5441 100644 --- a/dbms/src/DataTypes/DataTypeArray.cpp +++ b/dbms/src/DataTypes/DataTypeArray.cpp @@ -100,7 +100,7 @@ void DataTypeArray::deserializeBinary(IColumn & column, ReadBuffer & istr) const namespace { - void serializeArraySizesPositionIndependent(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) + void serializeArraySizesPositionIndependent(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) { const ColumnArray & column_array = typeid_cast(column); const ColumnArray::Offsets & offset_values = column_array.getOffsets(); @@ -122,7 +122,7 @@ namespace } } - void deserializeArraySizesPositionIndependent(IColumn & column, ReadBuffer & istr, size_t limit) + void deserializeArraySizesPositionIndependent(IColumn & column, ReadBuffer & istr, UInt64 limit) { ColumnArray & column_array = typeid_cast(column); ColumnArray::Offsets & offset_values = column_array.getOffsets(); @@ -188,7 +188,7 @@ void DataTypeArray::deserializeBinaryBulkStatePrefix( void DataTypeArray::serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const { @@ -234,7 +234,7 @@ void DataTypeArray::serializeBinaryBulkWithMultipleStreams( void DataTypeArray::deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const { diff --git a/dbms/src/DataTypes/DataTypeArray.h b/dbms/src/DataTypes/DataTypeArray.h index 802f5922342..9fb74218d26 100644 --- a/dbms/src/DataTypes/DataTypeArray.h +++ b/dbms/src/DataTypes/DataTypeArray.h @@ -74,13 +74,13 @@ public: void serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const override; void deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const override; diff --git a/dbms/src/DataTypes/DataTypeEnum.cpp b/dbms/src/DataTypes/DataTypeEnum.cpp index f6566ad9040..12748dacbf3 100644 --- a/dbms/src/DataTypes/DataTypeEnum.cpp +++ b/dbms/src/DataTypes/DataTypeEnum.cpp @@ -201,7 +201,7 @@ void DataTypeEnum::deserializeTextCSV(IColumn & column, ReadBuffer & istr, template void DataTypeEnum::serializeBinaryBulk( - const IColumn & column, WriteBuffer & ostr, const size_t offset, size_t limit) const + const IColumn & column, WriteBuffer & ostr, const UInt64 offset, UInt64 limit) const { const auto & x = typeid_cast(column).getData(); const auto size = x.size(); @@ -214,7 +214,7 @@ void DataTypeEnum::serializeBinaryBulk( template void DataTypeEnum::deserializeBinaryBulk( - IColumn & column, ReadBuffer & istr, const size_t limit, const double /*avg_value_size_hint*/) const + IColumn & column, ReadBuffer & istr, const UInt64 limit, const double /*avg_value_size_hint*/) const { auto & x = typeid_cast(column).getData(); const auto initial_size = x.size(); diff --git a/dbms/src/DataTypes/DataTypeEnum.h b/dbms/src/DataTypes/DataTypeEnum.h index 61104e70505..e72e70ac435 100644 --- a/dbms/src/DataTypes/DataTypeEnum.h +++ b/dbms/src/DataTypes/DataTypeEnum.h @@ -102,8 +102,8 @@ public: void serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; void deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override; - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, const size_t offset, size_t limit) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, const size_t limit, const double avg_value_size_hint) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, const UInt64 offset, UInt64 limit) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, const UInt64 limit, const double avg_value_size_hint) const override; void serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf) const override; diff --git a/dbms/src/DataTypes/DataTypeFixedString.cpp b/dbms/src/DataTypes/DataTypeFixedString.cpp index 6edb9d2af4c..fc8f1242a0a 100644 --- a/dbms/src/DataTypes/DataTypeFixedString.cpp +++ b/dbms/src/DataTypes/DataTypeFixedString.cpp @@ -80,7 +80,7 @@ void DataTypeFixedString::deserializeBinary(IColumn & column, ReadBuffer & istr) } -void DataTypeFixedString::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const +void DataTypeFixedString::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const { const ColumnFixedString::Chars & data = typeid_cast(column).getChars(); @@ -94,7 +94,7 @@ void DataTypeFixedString::serializeBinaryBulk(const IColumn & column, WriteBuffe } -void DataTypeFixedString::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double /*avg_value_size_hint*/) const +void DataTypeFixedString::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double /*avg_value_size_hint*/) const { ColumnFixedString::Chars & data = typeid_cast(column).getChars(); diff --git a/dbms/src/DataTypes/DataTypeFixedString.h b/dbms/src/DataTypes/DataTypeFixedString.h index f929e09a7ee..f4cb46f0f8a 100644 --- a/dbms/src/DataTypes/DataTypeFixedString.h +++ b/dbms/src/DataTypes/DataTypeFixedString.h @@ -45,8 +45,8 @@ public: void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override; void deserializeBinary(IColumn & column, ReadBuffer & istr) const override; - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const override; void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; diff --git a/dbms/src/DataTypes/DataTypeLowCardinality.cpp b/dbms/src/DataTypes/DataTypeLowCardinality.cpp index 8d6c457646d..529713ad99d 100644 --- a/dbms/src/DataTypes/DataTypeLowCardinality.cpp +++ b/dbms/src/DataTypes/DataTypeLowCardinality.cpp @@ -476,7 +476,7 @@ namespace void DataTypeLowCardinality::serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const { @@ -572,7 +572,7 @@ void DataTypeLowCardinality::serializeBinaryBulkWithMultipleStreams( void DataTypeLowCardinality::deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const { diff --git a/dbms/src/DataTypes/DataTypeLowCardinality.h b/dbms/src/DataTypes/DataTypeLowCardinality.h index 8ba2a4d1c4d..e616ab681b3 100644 --- a/dbms/src/DataTypes/DataTypeLowCardinality.h +++ b/dbms/src/DataTypes/DataTypeLowCardinality.h @@ -39,13 +39,13 @@ public: void serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const override; void deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const override; diff --git a/dbms/src/DataTypes/DataTypeNothing.cpp b/dbms/src/DataTypes/DataTypeNothing.cpp index 94a7fd75071..4240055e98e 100644 --- a/dbms/src/DataTypes/DataTypeNothing.cpp +++ b/dbms/src/DataTypes/DataTypeNothing.cpp @@ -14,7 +14,7 @@ MutableColumnPtr DataTypeNothing::createColumn() const return ColumnNothing::create(0); } -void DataTypeNothing::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const +void DataTypeNothing::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const { size_t size = column.size(); @@ -25,7 +25,7 @@ void DataTypeNothing::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr.write('0'); } -void DataTypeNothing::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double /*avg_value_size_hint*/) const +void DataTypeNothing::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double /*avg_value_size_hint*/) const { typeid_cast(column).addSize(istr.tryIgnore(limit)); } diff --git a/dbms/src/DataTypes/DataTypeNothing.h b/dbms/src/DataTypes/DataTypeNothing.h index e9421fb15e8..60060c35d11 100644 --- a/dbms/src/DataTypes/DataTypeNothing.h +++ b/dbms/src/DataTypes/DataTypeNothing.h @@ -21,8 +21,8 @@ public: MutableColumnPtr createColumn() const override; /// These methods read and write zero bytes just to allow to figure out size of column. - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const override; bool equals(const IDataType & rhs) const override; diff --git a/dbms/src/DataTypes/DataTypeNullable.cpp b/dbms/src/DataTypes/DataTypeNullable.cpp index 3cf798724ac..aaeb0effbe6 100644 --- a/dbms/src/DataTypes/DataTypeNullable.cpp +++ b/dbms/src/DataTypes/DataTypeNullable.cpp @@ -80,7 +80,7 @@ void DataTypeNullable::deserializeBinaryBulkStatePrefix( void DataTypeNullable::serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const { @@ -101,7 +101,7 @@ void DataTypeNullable::serializeBinaryBulkWithMultipleStreams( void DataTypeNullable::deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const { diff --git a/dbms/src/DataTypes/DataTypeNullable.h b/dbms/src/DataTypes/DataTypeNullable.h index 20a6b195c84..d678a18c3ce 100644 --- a/dbms/src/DataTypes/DataTypeNullable.h +++ b/dbms/src/DataTypes/DataTypeNullable.h @@ -35,13 +35,13 @@ public: void serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const override; void deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const override; diff --git a/dbms/src/DataTypes/DataTypeNumberBase.cpp b/dbms/src/DataTypes/DataTypeNumberBase.cpp index 94eb5618f3f..b0dfdf935fe 100644 --- a/dbms/src/DataTypes/DataTypeNumberBase.cpp +++ b/dbms/src/DataTypes/DataTypeNumberBase.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -179,7 +179,7 @@ void DataTypeNumberBase::deserializeBinary(IColumn & column, ReadBuffer & ist } template -void DataTypeNumberBase::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const +void DataTypeNumberBase::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const { const typename ColumnVector::Container & x = typeid_cast &>(column).getData(); @@ -193,7 +193,7 @@ void DataTypeNumberBase::serializeBinaryBulk(const IColumn & column, WriteBuf } template -void DataTypeNumberBase::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double /*avg_value_size_hint*/) const +void DataTypeNumberBase::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double /*avg_value_size_hint*/) const { typename ColumnVector::Container & x = typeid_cast &>(column).getData(); size_t initial_size = x.size(); diff --git a/dbms/src/DataTypes/DataTypeNumberBase.h b/dbms/src/DataTypes/DataTypeNumberBase.h index 2728d32a6a9..4c6d2d5e7c0 100644 --- a/dbms/src/DataTypes/DataTypeNumberBase.h +++ b/dbms/src/DataTypes/DataTypeNumberBase.h @@ -33,8 +33,8 @@ public: void deserializeBinary(Field & field, ReadBuffer & istr) const override; void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override; void deserializeBinary(IColumn & column, ReadBuffer & istr) const override; - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const override; void serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf) const override; diff --git a/dbms/src/DataTypes/DataTypeString.cpp b/dbms/src/DataTypes/DataTypeString.cpp index 34077e4bbe7..06b2191538c 100644 --- a/dbms/src/DataTypes/DataTypeString.cpp +++ b/dbms/src/DataTypes/DataTypeString.cpp @@ -78,7 +78,7 @@ void DataTypeString::deserializeBinary(IColumn & column, ReadBuffer & istr) cons } -void DataTypeString::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const +void DataTypeString::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const { const ColumnString & column_string = typeid_cast(column); const ColumnString::Chars & data = column_string.getChars(); @@ -111,7 +111,7 @@ void DataTypeString::serializeBinaryBulk(const IColumn & column, WriteBuffer & o template -static NO_INLINE void deserializeBinarySSE2(ColumnString::Chars & data, ColumnString::Offsets & offsets, ReadBuffer & istr, size_t limit) +static NO_INLINE void deserializeBinarySSE2(ColumnString::Chars & data, ColumnString::Offsets & offsets, ReadBuffer & istr, UInt64 limit) { size_t offset = data.size(); for (size_t i = 0; i < limit; ++i) @@ -171,7 +171,7 @@ static NO_INLINE void deserializeBinarySSE2(ColumnString::Chars & data, ColumnSt } -void DataTypeString::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const +void DataTypeString::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const { ColumnString & column_string = typeid_cast(column); ColumnString::Chars & data = column_string.getChars(); diff --git a/dbms/src/DataTypes/DataTypeString.h b/dbms/src/DataTypes/DataTypeString.h index 202c8374c27..9196642bfcb 100644 --- a/dbms/src/DataTypes/DataTypeString.h +++ b/dbms/src/DataTypes/DataTypeString.h @@ -26,8 +26,8 @@ public: void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override; void deserializeBinary(IColumn & column, ReadBuffer & istr) const override; - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const override; void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; diff --git a/dbms/src/DataTypes/DataTypeTuple.cpp b/dbms/src/DataTypes/DataTypeTuple.cpp index 1940c44134f..a5e4fd0bce7 100644 --- a/dbms/src/DataTypes/DataTypeTuple.cpp +++ b/dbms/src/DataTypes/DataTypeTuple.cpp @@ -372,7 +372,7 @@ void DataTypeTuple::deserializeBinaryBulkStatePrefix( void DataTypeTuple::serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const { @@ -390,7 +390,7 @@ void DataTypeTuple::serializeBinaryBulkWithMultipleStreams( void DataTypeTuple::deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const { diff --git a/dbms/src/DataTypes/DataTypeTuple.h b/dbms/src/DataTypes/DataTypeTuple.h index d489ae4ba7f..11e1b2aa736 100644 --- a/dbms/src/DataTypes/DataTypeTuple.h +++ b/dbms/src/DataTypes/DataTypeTuple.h @@ -67,13 +67,13 @@ public: void serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & state) const override; void deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & state) const override; diff --git a/dbms/src/DataTypes/DataTypesDecimal.cpp b/dbms/src/DataTypes/DataTypesDecimal.cpp index b9ccb41af3d..6dfa6f504da 100644 --- a/dbms/src/DataTypes/DataTypesDecimal.cpp +++ b/dbms/src/DataTypes/DataTypesDecimal.cpp @@ -94,7 +94,7 @@ void DataTypeDecimal::serializeBinary(const IColumn & column, size_t row_num, } template -void DataTypeDecimal::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const +void DataTypeDecimal::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const { const typename ColumnType::Container & x = typeid_cast(column).getData(); @@ -124,7 +124,7 @@ void DataTypeDecimal::deserializeBinary(IColumn & column, ReadBuffer & istr) } template -void DataTypeDecimal::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double) const +void DataTypeDecimal::deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double) const { typename ColumnType::Container & x = typeid_cast(column).getData(); size_t initial_size = x.size(); diff --git a/dbms/src/DataTypes/DataTypesDecimal.h b/dbms/src/DataTypes/DataTypesDecimal.h index 89841b762c1..a518d2b8a73 100644 --- a/dbms/src/DataTypes/DataTypesDecimal.h +++ b/dbms/src/DataTypes/DataTypesDecimal.h @@ -94,11 +94,11 @@ public: void serializeBinary(const Field & field, WriteBuffer & ostr) const override; void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override; - void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override; + void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const override; void deserializeBinary(Field & field, ReadBuffer & istr) const override; void deserializeBinary(IColumn & column, ReadBuffer & istr) const override; - void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override; + void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const override; void serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf) const override; diff --git a/dbms/src/DataTypes/IDataType.h b/dbms/src/DataTypes/IDataType.h index 6bb59106d10..0cf4a99ea67 100644 --- a/dbms/src/DataTypes/IDataType.h +++ b/dbms/src/DataTypes/IDataType.h @@ -173,7 +173,7 @@ public: virtual void serializeBinaryBulkWithMultipleStreams( const IColumn & column, size_t offset, - size_t limit, + UInt64 limit, SerializeBinaryBulkSettings & settings, SerializeBinaryBulkStatePtr & /*state*/) const { @@ -184,7 +184,7 @@ public: /// Read no more than limit values and append them into column. virtual void deserializeBinaryBulkWithMultipleStreams( IColumn & column, - size_t limit, + UInt64 limit, DeserializeBinaryBulkSettings & settings, DeserializeBinaryBulkStatePtr & /*state*/) const { @@ -194,8 +194,8 @@ public: /** Override these methods for data types that require just single stream (most of data types). */ - virtual void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const; - virtual void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const; + virtual void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, UInt64 offset, UInt64 limit) const; + virtual void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, UInt64 limit, double avg_value_size_hint) const; /** Serialization/deserialization of individual values. * diff --git a/dbms/src/Dictionaries/CacheDictionary.cpp b/dbms/src/Dictionaries/CacheDictionary.cpp index 752752fae59..60a32ff3ab3 100644 --- a/dbms/src/Dictionaries/CacheDictionary.cpp +++ b/dbms/src/Dictionaries/CacheDictionary.cpp @@ -575,7 +575,7 @@ PaddedPODArray CacheDictionary::getCachedIds() const return array; } -BlockInputStreamPtr CacheDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr CacheDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { using BlockInputStreamType = DictionaryBlockInputStream; return std::make_shared(shared_from_this(), max_block_size, getCachedIds(), column_names); diff --git a/dbms/src/Dictionaries/CacheDictionary.h b/dbms/src/Dictionaries/CacheDictionary.h index 7a08ad5c3ab..e7f8a3b8e9a 100644 --- a/dbms/src/Dictionaries/CacheDictionary.h +++ b/dbms/src/Dictionaries/CacheDictionary.h @@ -149,7 +149,7 @@ public: void has(const PaddedPODArray & ids, PaddedPODArray & out) const override; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; private: template diff --git a/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp b/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp index 42aa0c943c7..54e193acd91 100644 --- a/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp +++ b/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp @@ -383,7 +383,7 @@ bool ComplexKeyCacheDictionary::isEmptyCell(const UInt64 idx) const && (idx != zero_cell_idx || cells[idx].data == ext::safe_bit_cast(CellMetadata::time_point_t()))); } -BlockInputStreamPtr ComplexKeyCacheDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr ComplexKeyCacheDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { std::vector keys; { diff --git a/dbms/src/Dictionaries/ComplexKeyCacheDictionary.h b/dbms/src/Dictionaries/ComplexKeyCacheDictionary.h index 92666158015..189ae9e7118 100644 --- a/dbms/src/Dictionaries/ComplexKeyCacheDictionary.h +++ b/dbms/src/Dictionaries/ComplexKeyCacheDictionary.h @@ -180,7 +180,7 @@ public: void has(const Columns & key_columns, const DataTypes & key_types, PaddedPODArray & out) const; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; private: template diff --git a/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp b/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp index a36b225680d..c0e9c3b2976 100644 --- a/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp +++ b/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp @@ -784,7 +784,7 @@ std::vector ComplexKeyHashedDictionary::getKeys(const Attribute & att return keys; } -BlockInputStreamPtr ComplexKeyHashedDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr ComplexKeyHashedDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { using BlockInputStreamType = DictionaryBlockInputStream; return std::make_shared(shared_from_this(), max_block_size, getKeys(), column_names); diff --git a/dbms/src/Dictionaries/ComplexKeyHashedDictionary.h b/dbms/src/Dictionaries/ComplexKeyHashedDictionary.h index fc1fc709388..a8782a0eab8 100644 --- a/dbms/src/Dictionaries/ComplexKeyHashedDictionary.h +++ b/dbms/src/Dictionaries/ComplexKeyHashedDictionary.h @@ -153,7 +153,7 @@ public: void has(const Columns & key_columns, const DataTypes & key_types, PaddedPODArray & out) const; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; private: template diff --git a/dbms/src/Dictionaries/DictionaryBlockInputStream.h b/dbms/src/Dictionaries/DictionaryBlockInputStream.h index c05ebc3b935..b5af6e3b912 100644 --- a/dbms/src/Dictionaries/DictionaryBlockInputStream.h +++ b/dbms/src/Dictionaries/DictionaryBlockInputStream.h @@ -32,11 +32,11 @@ public: using DictionaryPtr = std::shared_ptr; DictionaryBlockInputStream( - std::shared_ptr dictionary, size_t max_block_size, PaddedPODArray && ids, const Names & column_names); + std::shared_ptr dictionary, UInt64 max_block_size, PaddedPODArray && ids, const Names & column_names); DictionaryBlockInputStream( std::shared_ptr dictionary, - size_t max_block_size, + UInt64 max_block_size, const std::vector & keys, const Names & column_names); @@ -48,7 +48,7 @@ public: // Now used in trie dictionary, where columns are stored as ip and mask, and are showed as string DictionaryBlockInputStream( std::shared_ptr dictionary, - size_t max_block_size, + UInt64 max_block_size, const Columns & data_columns, const Names & column_names, GetColumnsFunction && get_key_columns_function, @@ -202,7 +202,7 @@ private: template DictionaryBlockInputStream::DictionaryBlockInputStream( - std::shared_ptr dictionary, size_t max_block_size, PaddedPODArray && ids, const Names & column_names) + std::shared_ptr dictionary, UInt64 max_block_size, PaddedPODArray && ids, const Names & column_names) : DictionaryBlockInputStreamBase(ids.size(), max_block_size) , dictionary(std::static_pointer_cast(dictionary)) , column_names(column_names) @@ -217,7 +217,7 @@ DictionaryBlockInputStream::DictionaryBlockInputStream( template DictionaryBlockInputStream::DictionaryBlockInputStream( std::shared_ptr dictionary, - size_t max_block_size, + UInt64 max_block_size, const std::vector & keys, const Names & column_names) : DictionaryBlockInputStreamBase(keys.size(), max_block_size) @@ -234,7 +234,7 @@ DictionaryBlockInputStream::DictionaryBlockInputStream( template DictionaryBlockInputStream::DictionaryBlockInputStream( std::shared_ptr dictionary, - size_t max_block_size, + UInt64 max_block_size, const Columns & data_columns, const Names & column_names, GetColumnsFunction && get_key_columns_function, diff --git a/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.cpp b/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.cpp index ad6e3e1fc71..ff5bb782ff0 100644 --- a/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.cpp +++ b/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.cpp @@ -2,7 +2,7 @@ namespace DB { -DictionaryBlockInputStreamBase::DictionaryBlockInputStreamBase(size_t rows_count, size_t max_block_size) +DictionaryBlockInputStreamBase::DictionaryBlockInputStreamBase(size_t rows_count, UInt64 max_block_size) : rows_count(rows_count), max_block_size(max_block_size) { } diff --git a/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.h b/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.h index 571a0da3b50..9b8d5dae8f1 100644 --- a/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.h +++ b/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.h @@ -7,7 +7,7 @@ namespace DB class DictionaryBlockInputStreamBase : public IBlockInputStream { protected: - DictionaryBlockInputStreamBase(size_t rows_count, size_t max_block_size); + DictionaryBlockInputStreamBase(size_t rows_count, UInt64 max_block_size); virtual Block getBlock(size_t start, size_t length) const = 0; @@ -15,7 +15,7 @@ protected: private: const size_t rows_count; - const size_t max_block_size; + const UInt64 max_block_size; size_t next_row = 0; Block readImpl() override; diff --git a/dbms/src/Dictionaries/ExecutableDictionarySource.cpp b/dbms/src/Dictionaries/ExecutableDictionarySource.cpp index 4fc733c84af..8f6ae2912f4 100644 --- a/dbms/src/Dictionaries/ExecutableDictionarySource.cpp +++ b/dbms/src/Dictionaries/ExecutableDictionarySource.cpp @@ -15,7 +15,7 @@ namespace DB { -static const size_t max_block_size = 8192; +static const UInt64 max_block_size = 8192; namespace diff --git a/dbms/src/Dictionaries/FileDictionarySource.cpp b/dbms/src/Dictionaries/FileDictionarySource.cpp index 793ee3bf77e..2ac580d7bb3 100644 --- a/dbms/src/Dictionaries/FileDictionarySource.cpp +++ b/dbms/src/Dictionaries/FileDictionarySource.cpp @@ -9,7 +9,7 @@ namespace DB { -static const size_t max_block_size = 8192; +static const UInt64 max_block_size = 8192; FileDictionarySource::FileDictionarySource( diff --git a/dbms/src/Dictionaries/FlatDictionary.cpp b/dbms/src/Dictionaries/FlatDictionary.cpp index 26640972014..0ec6d19bdb4 100644 --- a/dbms/src/Dictionaries/FlatDictionary.cpp +++ b/dbms/src/Dictionaries/FlatDictionary.cpp @@ -749,7 +749,7 @@ PaddedPODArray FlatDictionary::getIds() const return ids; } -BlockInputStreamPtr FlatDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr FlatDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { using BlockInputStreamType = DictionaryBlockInputStream; return std::make_shared(shared_from_this(), max_block_size, getIds(), column_names); diff --git a/dbms/src/Dictionaries/FlatDictionary.h b/dbms/src/Dictionaries/FlatDictionary.h index ccdf522162e..be3cba2c69e 100644 --- a/dbms/src/Dictionaries/FlatDictionary.h +++ b/dbms/src/Dictionaries/FlatDictionary.h @@ -144,7 +144,7 @@ public: void has(const PaddedPODArray & ids, PaddedPODArray & out) const override; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; private: template diff --git a/dbms/src/Dictionaries/HTTPDictionarySource.cpp b/dbms/src/Dictionaries/HTTPDictionarySource.cpp index bf0cb23dfdc..46c1764d44e 100644 --- a/dbms/src/Dictionaries/HTTPDictionarySource.cpp +++ b/dbms/src/Dictionaries/HTTPDictionarySource.cpp @@ -15,7 +15,7 @@ namespace DB { -static const size_t max_block_size = 8192; +static const UInt64 max_block_size = 8192; HTTPDictionarySource::HTTPDictionarySource( diff --git a/dbms/src/Dictionaries/HashedDictionary.cpp b/dbms/src/Dictionaries/HashedDictionary.cpp index 6154b9243ff..7ce87aeb15e 100644 --- a/dbms/src/Dictionaries/HashedDictionary.cpp +++ b/dbms/src/Dictionaries/HashedDictionary.cpp @@ -753,7 +753,7 @@ PaddedPODArray HashedDictionary::getIds() const return PaddedPODArray(); } -BlockInputStreamPtr HashedDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr HashedDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { using BlockInputStreamType = DictionaryBlockInputStream; return std::make_shared(shared_from_this(), max_block_size, getIds(), column_names); diff --git a/dbms/src/Dictionaries/HashedDictionary.h b/dbms/src/Dictionaries/HashedDictionary.h index 0ced0726b99..e28e96d22da 100644 --- a/dbms/src/Dictionaries/HashedDictionary.h +++ b/dbms/src/Dictionaries/HashedDictionary.h @@ -144,7 +144,7 @@ public: void isInVectorConstant(const PaddedPODArray & child_ids, const Key ancestor_id, PaddedPODArray & out) const override; void isInConstantVector(const Key child_id, const PaddedPODArray & ancestor_ids, PaddedPODArray & out) const override; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; private: template diff --git a/dbms/src/Dictionaries/IDictionary.h b/dbms/src/Dictionaries/IDictionary.h index 105f00e123c..340646c4ff9 100644 --- a/dbms/src/Dictionaries/IDictionary.h +++ b/dbms/src/Dictionaries/IDictionary.h @@ -46,7 +46,7 @@ struct IDictionaryBase : public IExternalLoadable virtual bool isInjective(const std::string & attribute_name) const = 0; - virtual BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const = 0; + virtual BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const = 0; bool supportUpdates() const override { return !isCached(); } diff --git a/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp b/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp index 0c57830544c..fe2e11ac3ba 100644 --- a/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp +++ b/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp @@ -33,7 +33,7 @@ MongoDBBlockInputStream::MongoDBBlockInputStream( std::shared_ptr & connection_, std::unique_ptr cursor_, const Block & sample_block, - const size_t max_block_size) + const UInt64 max_block_size) : connection(connection_), cursor{std::move(cursor_)}, max_block_size{max_block_size} { description.init(sample_block); diff --git a/dbms/src/Dictionaries/MongoDBBlockInputStream.h b/dbms/src/Dictionaries/MongoDBBlockInputStream.h index f042b7a2dff..6fbc21ae7b2 100644 --- a/dbms/src/Dictionaries/MongoDBBlockInputStream.h +++ b/dbms/src/Dictionaries/MongoDBBlockInputStream.h @@ -25,7 +25,7 @@ public: std::shared_ptr & connection_, std::unique_ptr cursor_, const Block & sample_block, - const size_t max_block_size); + const UInt64 max_block_size); ~MongoDBBlockInputStream() override; @@ -38,7 +38,7 @@ private: std::shared_ptr connection; std::unique_ptr cursor; - const size_t max_block_size; + const UInt64 max_block_size; ExternalResultDescription description; bool all_read = false; }; diff --git a/dbms/src/Dictionaries/MongoDBDictionarySource.cpp b/dbms/src/Dictionaries/MongoDBDictionarySource.cpp index b7b4850194b..ec7ddc033f5 100644 --- a/dbms/src/Dictionaries/MongoDBDictionarySource.cpp +++ b/dbms/src/Dictionaries/MongoDBDictionarySource.cpp @@ -63,7 +63,7 @@ namespace ErrorCodes } -static const size_t max_block_size = 8192; +static const UInt64 max_block_size = 8192; # if POCO_VERSION < 0x01070800 diff --git a/dbms/src/Dictionaries/MySQLBlockInputStream.cpp b/dbms/src/Dictionaries/MySQLBlockInputStream.cpp index 17ed0bf0059..e11a36728a4 100644 --- a/dbms/src/Dictionaries/MySQLBlockInputStream.cpp +++ b/dbms/src/Dictionaries/MySQLBlockInputStream.cpp @@ -20,7 +20,7 @@ namespace ErrorCodes MySQLBlockInputStream::MySQLBlockInputStream( - const mysqlxx::PoolWithFailover::Entry & entry, const std::string & query_str, const Block & sample_block, const size_t max_block_size) + const mysqlxx::PoolWithFailover::Entry & entry, const std::string & query_str, const Block & sample_block, const UInt64 max_block_size) : entry{entry}, query{this->entry->query(query_str)}, result{query.use()}, max_block_size{max_block_size} { if (sample_block.columns() != result.getNumFields()) diff --git a/dbms/src/Dictionaries/MySQLBlockInputStream.h b/dbms/src/Dictionaries/MySQLBlockInputStream.h index 01aff1732a2..f48dc7f3818 100644 --- a/dbms/src/Dictionaries/MySQLBlockInputStream.h +++ b/dbms/src/Dictionaries/MySQLBlockInputStream.h @@ -18,7 +18,7 @@ public: const mysqlxx::PoolWithFailover::Entry & entry, const std::string & query_str, const Block & sample_block, - const size_t max_block_size); + const UInt64 max_block_size); String getName() const override { return "MySQL"; } @@ -30,7 +30,7 @@ private: mysqlxx::PoolWithFailover::Entry entry; mysqlxx::Query query; mysqlxx::UseQueryResult result; - const size_t max_block_size; + const UInt64 max_block_size; ExternalResultDescription description; }; diff --git a/dbms/src/Dictionaries/MySQLDictionarySource.cpp b/dbms/src/Dictionaries/MySQLDictionarySource.cpp index 6d482330fb9..94d69019942 100644 --- a/dbms/src/Dictionaries/MySQLDictionarySource.cpp +++ b/dbms/src/Dictionaries/MySQLDictionarySource.cpp @@ -50,7 +50,7 @@ void registerDictionarySourceMysql(DictionarySourceFactory & factory) namespace DB { -static const size_t max_block_size = 8192; +static const UInt64 max_block_size = 8192; MySQLDictionarySource::MySQLDictionarySource( diff --git a/dbms/src/Dictionaries/ODBCBlockInputStream.cpp b/dbms/src/Dictionaries/ODBCBlockInputStream.cpp index ddfb241e501..dcedac47f42 100644 --- a/dbms/src/Dictionaries/ODBCBlockInputStream.cpp +++ b/dbms/src/Dictionaries/ODBCBlockInputStream.cpp @@ -18,7 +18,7 @@ namespace ErrorCodes ODBCBlockInputStream::ODBCBlockInputStream( - Poco::Data::Session && session, const std::string & query_str, const Block & sample_block, const size_t max_block_size) + Poco::Data::Session && session, const std::string & query_str, const Block & sample_block, const UInt64 max_block_size) : session{session} , statement{(this->session << query_str, Poco::Data::Keywords::now)} , result{statement} diff --git a/dbms/src/Dictionaries/ODBCBlockInputStream.h b/dbms/src/Dictionaries/ODBCBlockInputStream.h index 0cf19616b51..46bfed01a51 100644 --- a/dbms/src/Dictionaries/ODBCBlockInputStream.h +++ b/dbms/src/Dictionaries/ODBCBlockInputStream.h @@ -16,7 +16,7 @@ class ODBCBlockInputStream final : public IBlockInputStream { public: ODBCBlockInputStream( - Poco::Data::Session && session, const std::string & query_str, const Block & sample_block, const size_t max_block_size); + Poco::Data::Session && session, const std::string & query_str, const Block & sample_block, const UInt64 max_block_size); String getName() const override { return "ODBC"; } @@ -30,7 +30,7 @@ private: Poco::Data::RecordSet result; Poco::Data::RecordSet::Iterator iterator; - const size_t max_block_size; + const UInt64 max_block_size; ExternalResultDescription description; Poco::Logger * log; diff --git a/dbms/src/Dictionaries/RangeDictionaryBlockInputStream.h b/dbms/src/Dictionaries/RangeDictionaryBlockInputStream.h index f7911365506..e6185366627 100644 --- a/dbms/src/Dictionaries/RangeDictionaryBlockInputStream.h +++ b/dbms/src/Dictionaries/RangeDictionaryBlockInputStream.h @@ -25,7 +25,7 @@ public: RangeDictionaryBlockInputStream( DictionaryPtr dictionary, - size_t max_block_size, + UInt64 max_block_size, const Names & column_names, PaddedPODArray && ids_to_fill, PaddedPODArray && start_dates, diff --git a/dbms/src/Dictionaries/RangeHashedDictionary.cpp b/dbms/src/Dictionaries/RangeHashedDictionary.cpp index 48c884fa773..708bae3f967 100644 --- a/dbms/src/Dictionaries/RangeHashedDictionary.cpp +++ b/dbms/src/Dictionaries/RangeHashedDictionary.cpp @@ -634,7 +634,7 @@ void RangeHashedDictionary::getIdsAndDates( template -BlockInputStreamPtr RangeHashedDictionary::getBlockInputStreamImpl(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr RangeHashedDictionary::getBlockInputStreamImpl(const Names & column_names, UInt64 max_block_size) const { PaddedPODArray ids; PaddedPODArray start_dates; @@ -652,7 +652,7 @@ struct RangeHashedDIctionaryCallGetBlockInputStreamImpl BlockInputStreamPtr stream; const RangeHashedDictionary * dict; const Names * column_names; - size_t max_block_size; + UInt64 max_block_size; template void operator()() @@ -663,7 +663,7 @@ struct RangeHashedDIctionaryCallGetBlockInputStreamImpl } }; -BlockInputStreamPtr RangeHashedDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr RangeHashedDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { using ListType = TypeList; diff --git a/dbms/src/Dictionaries/RangeHashedDictionary.h b/dbms/src/Dictionaries/RangeHashedDictionary.h index 53e48ffe7eb..f5ac5f05d06 100644 --- a/dbms/src/Dictionaries/RangeHashedDictionary.h +++ b/dbms/src/Dictionaries/RangeHashedDictionary.h @@ -93,7 +93,7 @@ public: const PaddedPODArray & dates, ColumnString * out) const; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; struct Range { @@ -210,7 +210,7 @@ private: PaddedPODArray & end_dates) const; template - BlockInputStreamPtr getBlockInputStreamImpl(const Names & column_names, size_t max_block_size) const; + BlockInputStreamPtr getBlockInputStreamImpl(const Names & column_names, UInt64 max_block_size) const; friend struct RangeHashedDIctionaryCallGetBlockInputStreamImpl; diff --git a/dbms/src/Dictionaries/TrieDictionary.cpp b/dbms/src/Dictionaries/TrieDictionary.cpp index 9dc5fc0891d..66fdccc4d51 100644 --- a/dbms/src/Dictionaries/TrieDictionary.cpp +++ b/dbms/src/Dictionaries/TrieDictionary.cpp @@ -758,7 +758,7 @@ Columns TrieDictionary::getKeyColumns() const return {std::move(ip_column), std::move(mask_column)}; } -BlockInputStreamPtr TrieDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const +BlockInputStreamPtr TrieDictionary::getBlockInputStream(const Names & column_names, UInt64 max_block_size) const { using BlockInputStreamType = DictionaryBlockInputStream; diff --git a/dbms/src/Dictionaries/TrieDictionary.h b/dbms/src/Dictionaries/TrieDictionary.h index 3191916c094..5a3b87fb731 100644 --- a/dbms/src/Dictionaries/TrieDictionary.h +++ b/dbms/src/Dictionaries/TrieDictionary.h @@ -155,7 +155,7 @@ public: void has(const Columns & key_columns, const DataTypes & key_types, PaddedPODArray & out) const; - BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override; + BlockInputStreamPtr getBlockInputStream(const Names & column_names, UInt64 max_block_size) const override; private: template diff --git a/dbms/src/Dictionaries/XDBCDictionarySource.cpp b/dbms/src/Dictionaries/XDBCDictionarySource.cpp index f2d41ec75c8..3626febfcc1 100644 --- a/dbms/src/Dictionaries/XDBCDictionarySource.cpp +++ b/dbms/src/Dictionaries/XDBCDictionarySource.cpp @@ -39,7 +39,7 @@ namespace std::function callback, const Block & sample_block, const Context & context, - size_t max_block_size, + UInt64 max_block_size, const ConnectionTimeouts & timeouts, const String name) : name(name) @@ -62,7 +62,7 @@ namespace }; } -static const size_t max_block_size = 8192; +static const UInt64 max_block_size = 8192; XDBCDictionarySource::XDBCDictionarySource( diff --git a/dbms/src/Formats/BinaryRowInputStream.cpp b/dbms/src/Formats/BinaryRowInputStream.cpp index 7c059782e6d..3ecf36a7617 100644 --- a/dbms/src/Formats/BinaryRowInputStream.cpp +++ b/dbms/src/Formats/BinaryRowInputStream.cpp @@ -33,7 +33,7 @@ void registerInputFormatRowBinary(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context &, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( diff --git a/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp b/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp index 8062f59e245..fdc5e07b5ba 100644 --- a/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp +++ b/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp @@ -26,7 +26,7 @@ namespace ErrorCodes BlockInputStreamFromRowInputStream::BlockInputStreamFromRowInputStream( const RowInputStreamPtr & row_input_, const Block & sample_, - size_t max_block_size_, + UInt64 max_block_size_, const FormatSettings & settings) : row_input(row_input_), sample(sample_), max_block_size(max_block_size_), allow_errors_num(settings.input_allow_errors_num), allow_errors_ratio(settings.input_allow_errors_ratio) diff --git a/dbms/src/Formats/BlockInputStreamFromRowInputStream.h b/dbms/src/Formats/BlockInputStreamFromRowInputStream.h index b17e80e0dd3..701e674a0fc 100644 --- a/dbms/src/Formats/BlockInputStreamFromRowInputStream.h +++ b/dbms/src/Formats/BlockInputStreamFromRowInputStream.h @@ -21,7 +21,7 @@ public: BlockInputStreamFromRowInputStream( const RowInputStreamPtr & row_input_, const Block & sample_, - size_t max_block_size_, + UInt64 max_block_size_, const FormatSettings & settings); void readPrefix() override { row_input->readPrefix(); } @@ -41,7 +41,7 @@ protected: private: RowInputStreamPtr row_input; Block sample; - size_t max_block_size; + UInt64 max_block_size; BlockMissingValues block_missing_values; UInt64 allow_errors_num; diff --git a/dbms/src/Formats/CSVRowInputStream.cpp b/dbms/src/Formats/CSVRowInputStream.cpp index 1057e633445..ac6db183318 100644 --- a/dbms/src/Formats/CSVRowInputStream.cpp +++ b/dbms/src/Formats/CSVRowInputStream.cpp @@ -353,7 +353,7 @@ void registerInputFormatCSV(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context &, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( diff --git a/dbms/src/Formats/CapnProtoRowInputStream.cpp b/dbms/src/Formats/CapnProtoRowInputStream.cpp index bc3b1bc3926..692d1ec8dee 100644 --- a/dbms/src/Formats/CapnProtoRowInputStream.cpp +++ b/dbms/src/Formats/CapnProtoRowInputStream.cpp @@ -295,7 +295,7 @@ void registerInputFormatCapnProto(FormatFactory & factory) { factory.registerInputFormat( "CapnProto", - [](ReadBuffer & buf, const Block & sample, const Context & context, size_t max_block_size, const FormatSettings & settings) + [](ReadBuffer & buf, const Block & sample, const Context & context, UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( std::make_shared(buf, sample, FormatSchemaInfo(context, "capnp")), diff --git a/dbms/src/Formats/FormatFactory.cpp b/dbms/src/Formats/FormatFactory.cpp index 9674c376c47..9b97d8464ee 100644 --- a/dbms/src/Formats/FormatFactory.cpp +++ b/dbms/src/Formats/FormatFactory.cpp @@ -27,7 +27,7 @@ const FormatFactory::Creators & FormatFactory::getCreators(const String & name) } -BlockInputStreamPtr FormatFactory::getInput(const String & name, ReadBuffer & buf, const Block & sample, const Context & context, size_t max_block_size) const +BlockInputStreamPtr FormatFactory::getInput(const String & name, ReadBuffer & buf, const Block & sample, const Context & context, UInt64 max_block_size) const { const auto & input_getter = getCreators(name).first; if (!input_getter) diff --git a/dbms/src/Formats/FormatFactory.h b/dbms/src/Formats/FormatFactory.h index 7a9dc68d62e..fed069bbf8a 100644 --- a/dbms/src/Formats/FormatFactory.h +++ b/dbms/src/Formats/FormatFactory.h @@ -34,7 +34,7 @@ private: ReadBuffer & buf, const Block & sample, const Context & context, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings)>; using OutputCreator = std::function( diff --git a/dbms/src/Formats/TSKVRowInputStream.cpp b/dbms/src/Formats/TSKVRowInputStream.cpp index d85e5b9450e..710fad00ea6 100644 --- a/dbms/src/Formats/TSKVRowInputStream.cpp +++ b/dbms/src/Formats/TSKVRowInputStream.cpp @@ -197,7 +197,7 @@ void registerInputFormatTSKV(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context &, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( diff --git a/dbms/src/Formats/TabSeparatedRowInputStream.cpp b/dbms/src/Formats/TabSeparatedRowInputStream.cpp index f0c232ead0a..adef5720550 100644 --- a/dbms/src/Formats/TabSeparatedRowInputStream.cpp +++ b/dbms/src/Formats/TabSeparatedRowInputStream.cpp @@ -331,7 +331,7 @@ void registerInputFormatTabSeparated(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context &, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( @@ -346,7 +346,7 @@ void registerInputFormatTabSeparated(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context &, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( @@ -361,7 +361,7 @@ void registerInputFormatTabSeparated(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context &, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( diff --git a/dbms/src/Formats/ValuesRowInputStream.cpp b/dbms/src/Formats/ValuesRowInputStream.cpp index a48736bad6f..b32c8594429 100644 --- a/dbms/src/Formats/ValuesRowInputStream.cpp +++ b/dbms/src/Formats/ValuesRowInputStream.cpp @@ -154,7 +154,7 @@ void registerInputFormatValues(FormatFactory & factory) ReadBuffer & buf, const Block & sample, const Context & context, - size_t max_block_size, + UInt64 max_block_size, const FormatSettings & settings) { return std::make_shared( diff --git a/dbms/src/IO/LimitReadBuffer.cpp b/dbms/src/IO/LimitReadBuffer.cpp index d5830458baa..a6e4e7a7b16 100644 --- a/dbms/src/IO/LimitReadBuffer.cpp +++ b/dbms/src/IO/LimitReadBuffer.cpp @@ -36,7 +36,7 @@ bool LimitReadBuffer::nextImpl() } -LimitReadBuffer::LimitReadBuffer(ReadBuffer & in, size_t limit, bool throw_exception, std::string exception_message) +LimitReadBuffer::LimitReadBuffer(ReadBuffer & in, UInt64 limit, bool throw_exception, std::string exception_message) : ReadBuffer(in.position(), 0), in(in), limit(limit), throw_exception(throw_exception), exception_message(std::move(exception_message)) { size_t remaining_bytes_in_buffer = in.buffer().end() - in.position(); diff --git a/dbms/src/IO/LimitReadBuffer.h b/dbms/src/IO/LimitReadBuffer.h index 73654c012e1..d16579be7c5 100644 --- a/dbms/src/IO/LimitReadBuffer.h +++ b/dbms/src/IO/LimitReadBuffer.h @@ -14,14 +14,14 @@ class LimitReadBuffer : public ReadBuffer { private: ReadBuffer & in; - size_t limit; + UInt64 limit; bool throw_exception; std::string exception_message; bool nextImpl() override; public: - LimitReadBuffer(ReadBuffer & in, size_t limit, bool throw_exception, std::string exception_message = {}); + LimitReadBuffer(ReadBuffer & in, UInt64 limit, bool throw_exception, std::string exception_message = {}); ~LimitReadBuffer() override; }; diff --git a/dbms/src/IO/tests/limit_read_buffer.cpp b/dbms/src/IO/tests/limit_read_buffer.cpp index 7b9b4744a28..559c87353f0 100644 --- a/dbms/src/IO/tests/limit_read_buffer.cpp +++ b/dbms/src/IO/tests/limit_read_buffer.cpp @@ -17,7 +17,7 @@ int main(int argc, char ** argv) return 1; } - size_t limit = std::stol(argv[1]); + UInt64 limit = std::stol(argv[1]); ReadBufferFromFileDescriptor in(STDIN_FILENO); WriteBufferFromFileDescriptor out(STDOUT_FILENO); diff --git a/dbms/src/Interpreters/Context.cpp b/dbms/src/Interpreters/Context.cpp index dddce332276..d2e23354074 100644 --- a/dbms/src/Interpreters/Context.cpp +++ b/dbms/src/Interpreters/Context.cpp @@ -1698,7 +1698,7 @@ void Context::checkPartitionCanBeDropped(const String & database, const String & } -BlockInputStreamPtr Context::getInputFormat(const String & name, ReadBuffer & buf, const Block & sample, size_t max_block_size) const +BlockInputStreamPtr Context::getInputFormat(const String & name, ReadBuffer & buf, const Block & sample, UInt64 max_block_size) const { return FormatFactory::instance().getInput(name, buf, sample, *this, max_block_size); } diff --git a/dbms/src/Interpreters/Context.h b/dbms/src/Interpreters/Context.h index 3ff0efd83d9..259049836d1 100644 --- a/dbms/src/Interpreters/Context.h +++ b/dbms/src/Interpreters/Context.h @@ -262,7 +262,7 @@ public: void tryCreateExternalModels() const; /// I/O formats. - BlockInputStreamPtr getInputFormat(const String & name, ReadBuffer & buf, const Block & sample, size_t max_block_size) const; + BlockInputStreamPtr getInputFormat(const String & name, ReadBuffer & buf, const Block & sample, UInt64 max_block_size) const; BlockOutputStreamPtr getOutputFormat(const String & name, WriteBuffer & buf, const Block & sample) const; InterserverIOHandler & getInterserverIOHandler(); diff --git a/dbms/src/Interpreters/ExpressionActions.cpp b/dbms/src/Interpreters/ExpressionActions.cpp index 11fb6e0ace4..e46790a0e56 100644 --- a/dbms/src/Interpreters/ExpressionActions.cpp +++ b/dbms/src/Interpreters/ExpressionActions.cpp @@ -1109,7 +1109,7 @@ void ExpressionActions::optimizeArrayJoin() } -BlockInputStreamPtr ExpressionActions::createStreamWithNonJoinedDataIfFullOrRightJoin(const Block & source_header, size_t max_block_size) const +BlockInputStreamPtr ExpressionActions::createStreamWithNonJoinedDataIfFullOrRightJoin(const Block & source_header, UInt64 max_block_size) const { for (const auto & action : actions) if (action.join && (action.join->getKind() == ASTTableJoin::Kind::Full || action.join->getKind() == ASTTableJoin::Kind::Right)) diff --git a/dbms/src/Interpreters/ExpressionActions.h b/dbms/src/Interpreters/ExpressionActions.h index 484cbf31d95..39eeaf4fc72 100644 --- a/dbms/src/Interpreters/ExpressionActions.h +++ b/dbms/src/Interpreters/ExpressionActions.h @@ -238,7 +238,7 @@ public: static std::string getSmallestColumn(const NamesAndTypesList & columns); - BlockInputStreamPtr createStreamWithNonJoinedDataIfFullOrRightJoin(const Block & source_header, size_t max_block_size) const; + BlockInputStreamPtr createStreamWithNonJoinedDataIfFullOrRightJoin(const Block & source_header, UInt64 max_block_size) const; const Settings & getSettings() const { return settings; } diff --git a/dbms/src/Interpreters/ExpressionAnalyzer.cpp b/dbms/src/Interpreters/ExpressionAnalyzer.cpp index 31e08a95ec3..d365d7861bb 100644 --- a/dbms/src/Interpreters/ExpressionAnalyzer.cpp +++ b/dbms/src/Interpreters/ExpressionAnalyzer.cpp @@ -1056,7 +1056,7 @@ void ExpressionAnalyzer::collectUsedColumns() ss << "'" << name.name << "' "; throw Exception("Unknown identifier: " + *unknown_required_source_columns.begin() - + (select_query && !select_query->tables ? ". Note that there is no tables (FROM clause) in your query" : "") + + (select_query && !select_query->tables ? ". Note that there are no tables (FROM clause) in your query" : "") + ", context: " + ss.str(), ErrorCodes::UNKNOWN_IDENTIFIER); } } diff --git a/dbms/src/Interpreters/InterpreterSelectQuery.cpp b/dbms/src/Interpreters/InterpreterSelectQuery.cpp index d56afd3cd6d..c53ea7cae9e 100644 --- a/dbms/src/Interpreters/InterpreterSelectQuery.cpp +++ b/dbms/src/Interpreters/InterpreterSelectQuery.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -33,10 +34,12 @@ #include #include #include +#include +#include #include #include -#include +#include #include #include #include @@ -45,12 +48,12 @@ #include #include +#include #include #include #include #include #include -#include namespace DB @@ -68,6 +71,7 @@ namespace ErrorCodes extern const int NOT_IMPLEMENTED; extern const int PARAMETER_OUT_OF_BOUND; extern const int ARGUMENT_OUT_OF_BOUND; + extern const int INVALID_LIMIT_EXPRESSION; } InterpreterSelectQuery::InterpreterSelectQuery( @@ -718,16 +722,44 @@ void InterpreterSelectQuery::executeImpl(Pipeline & pipeline, const BlockInputSt } -static void getLimitLengthAndOffset(ASTSelectQuery & query, size_t & length, size_t & offset) +static UInt64 getLimitUIntValue(const ASTPtr & node, const Context & context) { - length = 0; - offset = 0; + const auto & [field, type] = evaluateConstantExpression(node, context); + + if (!isNumber(type)) + throw Exception("Illegal type " + type->getName() + " of LIMIT expression, must be numeric type", ErrorCodes::INVALID_LIMIT_EXPRESSION); + + Field converted = convertFieldToType(field, DataTypeUInt64()); + if (converted.isNull()) + throw Exception("The value " + applyVisitor(FieldVisitorToString(), field) + " of LIMIT expression is not representable as UInt64", ErrorCodes::INVALID_LIMIT_EXPRESSION); + + return converted.safeGet(); +} + +static std::pair getLimitLengthAndOffset(const ASTSelectQuery & query, const Context & context) +{ + UInt64 length = 0; + UInt64 offset = 0; + if (query.limit_length) { - length = safeGet(typeid_cast(*query.limit_length).value); + length = getLimitUIntValue(query.limit_length, context); if (query.limit_offset) - offset = safeGet(typeid_cast(*query.limit_offset).value); + offset = getLimitUIntValue(query.limit_offset, context); } + + return {length, offset}; +} + +static UInt64 getLimitForSorting(ASTSelectQuery & query, const Context & context) +{ + /// Partial sort can be done if there is LIMIT but no DISTINCT or LIMIT BY. + if (!query.distinct && !query.limit_by_expression_list) + { + auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context); + return limit_length + limit_offset; + } + return 0; } @@ -878,10 +910,6 @@ void InterpreterSelectQuery::executeFetchColumns( + ", maximum: " + settings.max_columns_to_read.toString(), ErrorCodes::TOO_MANY_COLUMNS); - size_t limit_length = 0; - size_t limit_offset = 0; - getLimitLengthAndOffset(query, limit_length, limit_offset); - /** With distributed query processing, almost no computations are done in the threads, * but wait and receive data from remote servers. * If we have 20 remote servers, and max_threads = 8, then it would not be very good @@ -896,10 +924,9 @@ void InterpreterSelectQuery::executeFetchColumns( max_streams = settings.max_distributed_connections; } - size_t max_block_size = settings.max_block_size; + UInt64 max_block_size = settings.max_block_size; - if (!max_block_size) - throw Exception("Setting 'max_block_size' cannot be zero", ErrorCodes::PARAMETER_OUT_OF_BOUND); + auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context); /** Optimization - if not specified DISTINCT, WHERE, GROUP, HAVING, ORDER, LIMIT BY but LIMIT is specified, and limit + offset < max_block_size, * then as the block size we will use limit + offset (not to read more from the table than requested), @@ -916,10 +943,13 @@ void InterpreterSelectQuery::executeFetchColumns( && !query_analyzer->hasAggregation() && limit_length + limit_offset < max_block_size) { - max_block_size = limit_length + limit_offset; + max_block_size = std::max(UInt64(1), limit_length + limit_offset); max_streams = 1; } + if (!max_block_size) + throw Exception("Setting 'max_block_size' cannot be zero", ErrorCodes::PARAMETER_OUT_OF_BOUND); + /// Initialize the initial data streams to which the query transforms are superimposed. Table or subquery or prepared input? if (!pipeline.streams.empty()) { @@ -1231,26 +1261,11 @@ static SortDescription getSortDescription(ASTSelectQuery & query) return order_descr; } -static size_t getLimitForSorting(ASTSelectQuery & query) -{ - /// Partial sort can be done if there is LIMIT but no DISTINCT or LIMIT BY. - size_t limit = 0; - if (!query.distinct && !query.limit_by_expression_list) - { - size_t limit_length = 0; - size_t limit_offset = 0; - getLimitLengthAndOffset(query, limit_length, limit_offset); - limit = limit_length + limit_offset; - } - - return limit; -} - void InterpreterSelectQuery::executeOrder(Pipeline & pipeline) { SortDescription order_descr = getSortDescription(query); - size_t limit = getLimitForSorting(query); + UInt64 limit = getLimitForSorting(query, context); const Settings & settings = context.getSettingsRef(); @@ -1281,7 +1296,7 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline) void InterpreterSelectQuery::executeMergeSorted(Pipeline & pipeline) { SortDescription order_descr = getSortDescription(query); - size_t limit = getLimitForSorting(query); + UInt64 limit = getLimitForSorting(query, context); const Settings & settings = context.getSettingsRef(); @@ -1320,11 +1335,8 @@ void InterpreterSelectQuery::executeDistinct(Pipeline & pipeline, bool before_or { const Settings & settings = context.getSettingsRef(); - size_t limit_length = 0; - size_t limit_offset = 0; - getLimitLengthAndOffset(query, limit_length, limit_offset); - - size_t limit_for_distinct = 0; + auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context); + UInt64 limit_for_distinct = 0; /// If after this stage of DISTINCT ORDER BY is not executed, then you can get no more than limit_length + limit_offset of different rows. if (!query.order_expression_list || !before_order) @@ -1361,16 +1373,13 @@ void InterpreterSelectQuery::executeUnion(Pipeline & pipeline) /// Preliminary LIMIT - is used in every source, if there are several sources, before they are combined. void InterpreterSelectQuery::executePreLimit(Pipeline & pipeline) { - size_t limit_length = 0; - size_t limit_offset = 0; - getLimitLengthAndOffset(query, limit_length, limit_offset); - /// If there is LIMIT if (query.limit_length) { - pipeline.transform([&](auto & stream) + auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context); + pipeline.transform([&, limit = limit_length + limit_offset](auto & stream) { - stream = std::make_shared(stream, limit_length + limit_offset, 0, false); + stream = std::make_shared(stream, limit, 0, false); }); } } @@ -1385,7 +1394,7 @@ void InterpreterSelectQuery::executeLimitBy(Pipeline & pipeline) for (const auto & elem : query.limit_by_expression_list->children) columns.emplace_back(elem->getColumnName()); - size_t value = safeGet(typeid_cast(*query.limit_by_value).value); + UInt64 value = getLimitUIntValue(query.limit_by_value, context); pipeline.transform([&](auto & stream) { @@ -1419,10 +1428,6 @@ bool hasWithTotalsInAnySubqueryInFromClause(const ASTSelectQuery & query) void InterpreterSelectQuery::executeLimit(Pipeline & pipeline) { - size_t limit_length = 0; - size_t limit_offset = 0; - getLimitLengthAndOffset(query, limit_length, limit_offset); - /// If there is LIMIT if (query.limit_length) { @@ -1443,6 +1448,10 @@ void InterpreterSelectQuery::executeLimit(Pipeline & pipeline) if (!query.group_by_with_totals && hasWithTotalsInAnySubqueryInFromClause(query)) always_read_till_end = true; + UInt64 limit_length; + UInt64 limit_offset; + std::tie(limit_length, limit_offset) = getLimitLengthAndOffset(query, context); + pipeline.transform([&](auto & stream) { stream = std::make_shared(stream, limit_length, limit_offset, always_read_till_end); diff --git a/dbms/src/Interpreters/Join.cpp b/dbms/src/Interpreters/Join.cpp index 6c5bda21965..9d5c19fe565 100644 --- a/dbms/src/Interpreters/Join.cpp +++ b/dbms/src/Interpreters/Join.cpp @@ -1106,7 +1106,7 @@ class NonJoinedBlockInputStream : public IBlockInputStream { public: NonJoinedBlockInputStream(const Join & parent_, const Block & left_sample_block, const Names & key_names_left, - const NamesAndTypesList & columns_added_by_join, size_t max_block_size_) + const NamesAndTypesList & columns_added_by_join, UInt64 max_block_size_) : parent(parent_), max_block_size(max_block_size_) { /** left_sample_block contains keys and "left" columns. @@ -1183,7 +1183,7 @@ protected: private: const Join & parent; - size_t max_block_size; + UInt64 max_block_size; Block result_sample_block; /// Indices of columns in result_sample_block that come from the left-side table (except key columns). @@ -1334,7 +1334,7 @@ private: BlockInputStreamPtr Join::createStreamWithNonJoinedRows(const Block & left_sample_block, const Names & key_names_left, - const NamesAndTypesList & columns_added_by_join, size_t max_block_size) const + const NamesAndTypesList & columns_added_by_join, UInt64 max_block_size) const { return std::make_shared(*this, left_sample_block, key_names_left, columns_added_by_join, max_block_size); } diff --git a/dbms/src/Interpreters/Join.h b/dbms/src/Interpreters/Join.h index 07b4849fd81..c4dd3e24e63 100644 --- a/dbms/src/Interpreters/Join.h +++ b/dbms/src/Interpreters/Join.h @@ -120,7 +120,7 @@ public: * left_sample_block is passed without account of 'use_nulls' setting (columns will be converted to Nullable inside). */ BlockInputStreamPtr createStreamWithNonJoinedRows(const Block & left_sample_block, const Names & key_names_left, - const NamesAndTypesList & columns_added_by_join, size_t max_block_size) const; + const NamesAndTypesList & columns_added_by_join, UInt64 max_block_size) const; /// Number of keys in all built JOIN maps. size_t getTotalRowCount() const; diff --git a/dbms/src/Interpreters/evaluateConstantExpression.cpp b/dbms/src/Interpreters/evaluateConstantExpression.cpp index 8f96160186d..ccf29968a5c 100644 --- a/dbms/src/Interpreters/evaluateConstantExpression.cpp +++ b/dbms/src/Interpreters/evaluateConstantExpression.cpp @@ -40,18 +40,18 @@ std::pair> evaluateConstantExpression(co expr_for_constant_folding->execute(block_with_constants); if (!block_with_constants || block_with_constants.rows() == 0) - throw Exception("Logical error: empty block after evaluation of constant expression for IN or VALUES", ErrorCodes::LOGICAL_ERROR); + throw Exception("Logical error: empty block after evaluation of constant expression for IN, VALUES or LIMIT", ErrorCodes::LOGICAL_ERROR); String name = node->getColumnName(); if (!block_with_constants.has(name)) - throw Exception("Element of set in IN or VALUES is not a constant expression: " + name, ErrorCodes::BAD_ARGUMENTS); + throw Exception("Element of set in IN, VALUES or LIMIT is not a constant expression: " + name, ErrorCodes::BAD_ARGUMENTS); const ColumnWithTypeAndName & result = block_with_constants.getByName(name); const IColumn & result_column = *result.column; if (!result_column.isColumnConst()) - throw Exception("Element of set in IN or VALUES is not a constant expression: " + name, ErrorCodes::BAD_ARGUMENTS); + throw Exception("Element of set in IN, VALUES or LIMIT is not a constant expression: " + name, ErrorCodes::BAD_ARGUMENTS); return std::make_pair(result_column[0], result.type); } diff --git a/dbms/src/Interpreters/sortBlock.cpp b/dbms/src/Interpreters/sortBlock.cpp index ae767eb6f96..2dd9d2c681e 100644 --- a/dbms/src/Interpreters/sortBlock.cpp +++ b/dbms/src/Interpreters/sortBlock.cpp @@ -95,7 +95,7 @@ struct PartialSortingLessWithCollation } }; -void sortBlock(Block & block, const SortDescription & description, size_t limit) +void sortBlock(Block & block, const SortDescription & description, UInt64 limit) { if (!block) return; diff --git a/dbms/src/Interpreters/sortBlock.h b/dbms/src/Interpreters/sortBlock.h index d6bce9a715d..06754e0d388 100644 --- a/dbms/src/Interpreters/sortBlock.h +++ b/dbms/src/Interpreters/sortBlock.h @@ -8,7 +8,7 @@ namespace DB { /// Sort one block by `description`. If limit != 0, then the partial sort of the first `limit` rows is produced. -void sortBlock(Block & block, const SortDescription & description, size_t limit = 0); +void sortBlock(Block & block, const SortDescription & description, UInt64 limit = 0); /** Used only in StorageMergeTree to sort the data with INSERT. diff --git a/dbms/src/Parsers/ParserSelectQuery.cpp b/dbms/src/Parsers/ParserSelectQuery.cpp index 74f2e735ccd..209060bb377 100644 --- a/dbms/src/Parsers/ParserSelectQuery.cpp +++ b/dbms/src/Parsers/ParserSelectQuery.cpp @@ -61,7 +61,7 @@ bool ParserSelectQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) } } - /// SELECT [DISTINCT] expr list + /// SELECT [DISTINCT] [TOP N] expr list { if (!s_select.ignore(pos, expected)) return false; @@ -173,15 +173,14 @@ bool ParserSelectQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) throw Exception("Can not use TOP and LIMIT together", ErrorCodes::TOP_AND_LIMIT_TOGETHER); ParserToken s_comma(TokenType::Comma); - ParserNumber num; - if (!num.parse(pos, select_query->limit_length, expected)) + if (!exp_elem.parse(pos, select_query->limit_length, expected)) return false; if (s_comma.ignore(pos, expected)) { select_query->limit_offset = select_query->limit_length; - if (!num.parse(pos, select_query->limit_length, expected)) + if (!exp_elem.parse(pos, select_query->limit_length, expected)) return false; } else if (s_by.ignore(pos, expected)) @@ -194,7 +193,7 @@ bool ParserSelectQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) } else if (s_offset.ignore(pos, expected)) { - if (!num.parse(pos, select_query->limit_offset, expected)) + if (!exp_elem.parse(pos, select_query->limit_offset, expected)) return false; } } @@ -206,15 +205,14 @@ bool ParserSelectQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) return false; ParserToken s_comma(TokenType::Comma); - ParserNumber num; - if (!num.parse(pos, select_query->limit_length, expected)) + if (!exp_elem.parse(pos, select_query->limit_length, expected)) return false; if (s_comma.ignore(pos, expected)) { select_query->limit_offset = select_query->limit_length; - if (!num.parse(pos, select_query->limit_length, expected)) + if (!exp_elem.parse(pos, select_query->limit_length, expected)) return false; } } diff --git a/dbms/src/Parsers/tests/select_parser.cpp b/dbms/src/Parsers/tests/select_parser.cpp index a91675fb2cb..bea1951ecb5 100644 --- a/dbms/src/Parsers/tests/select_parser.cpp +++ b/dbms/src/Parsers/tests/select_parser.cpp @@ -18,7 +18,7 @@ try " GROUP BY UniqID" " HAVING SUM(Refresh) > 100" " ORDER BY Visits, PageViews" - " LIMIT 1000, 10" + " LIMIT LENGTH('STRING OF 20 SYMBOLS') - 20 + 1000, 10.05 / 5.025 * 5" " INTO OUTFILE 'test.out'" " FORMAT TabSeparated"; diff --git a/dbms/src/Storages/Kafka/StorageKafka.cpp b/dbms/src/Storages/Kafka/StorageKafka.cpp index 2d8b85ad639..87722ec36c1 100644 --- a/dbms/src/Storages/Kafka/StorageKafka.cpp +++ b/dbms/src/Storages/Kafka/StorageKafka.cpp @@ -134,7 +134,7 @@ public: class KafkaBlockInputStream : public IBlockInputStream { public: - KafkaBlockInputStream(StorageKafka & storage_, const Context & context_, const String & schema, size_t max_block_size_) + KafkaBlockInputStream(StorageKafka & storage_, const Context & context_, const String & schema, UInt64 max_block_size_) : storage(storage_), context(context_), max_block_size(max_block_size_) { // Always skip unknown fields regardless of the context (JSON or TSKV) @@ -222,7 +222,7 @@ private: StorageKafka & storage; ConsumerPtr consumer; Context context; - size_t max_block_size; + UInt64 max_block_size; Block sample_block; std::unique_ptr read_buf; BlockInputStreamPtr reader; @@ -254,7 +254,7 @@ StorageKafka::StorageKafka( const ColumnsDescription & columns_, const String & brokers_, const String & group_, const Names & topics_, const String & format_name_, char row_delimiter_, const String & schema_name_, - size_t num_consumers_, size_t max_block_size_, size_t skip_broken_) + size_t num_consumers_, UInt64 max_block_size_, size_t skip_broken_) : IStorage{columns_}, table_name(table_name_), database_name(database_name_), global_context(context_), topics(global_context.getMacros()->expand(topics_)), @@ -724,7 +724,7 @@ void registerStorageKafka(StorageFactory & factory) } // Parse max block size (optional) - size_t max_block_size = 0; + UInt64 max_block_size = 0; if (args_count >= 8) { auto ast = typeid_cast(engine_args[7].get()); diff --git a/dbms/src/Storages/Kafka/StorageKafka.h b/dbms/src/Storages/Kafka/StorageKafka.h index 9d5f27fb4d6..cdb8e302db4 100644 --- a/dbms/src/Storages/Kafka/StorageKafka.h +++ b/dbms/src/Storages/Kafka/StorageKafka.h @@ -41,7 +41,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; void rename(const String & /*new_path_to_db*/, const String & new_database_name, const String & new_table_name) override @@ -68,7 +68,7 @@ private: /// Total number of consumers size_t num_consumers; /// Maximum block size for insertion into this table - size_t max_block_size; + UInt64 max_block_size; /// Number of actually created consumers. /// Can differ from num_consumers in case of exception in startup() (or if startup() hasn't been called). /// In this case we still need to be able to shutdown() properly. @@ -103,7 +103,7 @@ protected: const ColumnsDescription & columns_, const String & brokers_, const String & group_, const Names & topics_, const String & format_name_, char row_delimiter_, const String & schema_name_, - size_t num_consumers_, size_t max_block_size_, size_t skip_broken); + size_t num_consumers_, UInt64 max_block_size_, size_t skip_broken); }; } diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index 56ef7cc47f6..b4788f21a59 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -140,7 +140,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::read( const Names & column_names_to_return, const SelectQueryInfo & query_info, const Context & context, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned num_streams, const PartitionIdToMaxBlock * max_block_numbers_to_read) const { @@ -154,7 +154,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::readFromParts( const Names & column_names_to_return, const SelectQueryInfo & query_info, const Context & context, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned num_streams, const PartitionIdToMaxBlock * max_block_numbers_to_read) const { @@ -624,7 +624,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongStreams( RangesInDataParts && parts, size_t num_streams, const Names & column_names, - size_t max_block_size, + UInt64 max_block_size, bool use_uncompressed_cache, const PrewhereInfoPtr & prewhere_info, const Names & virt_columns, @@ -766,7 +766,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongStreams( BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongStreamsFinal( RangesInDataParts && parts, const Names & column_names, - size_t max_block_size, + UInt64 max_block_size, bool use_uncompressed_cache, const PrewhereInfoPtr & prewhere_info, const Names & virt_columns, diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.h b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.h index 22f56a14e27..af4445b3648 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.h +++ b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.h @@ -28,7 +28,7 @@ public: const Names & column_names, const SelectQueryInfo & query_info, const Context & context, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams, const PartitionIdToMaxBlock * max_block_numbers_to_read = nullptr) const; @@ -37,7 +37,7 @@ public: const Names & column_names, const SelectQueryInfo & query_info, const Context & context, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams, const PartitionIdToMaxBlock * max_block_numbers_to_read = nullptr) const; @@ -50,7 +50,7 @@ private: RangesInDataParts && parts, size_t num_streams, const Names & column_names, - size_t max_block_size, + UInt64 max_block_size, bool use_uncompressed_cache, const PrewhereInfoPtr & prewhere_info, const Names & virt_columns, @@ -59,7 +59,7 @@ private: BlockInputStreams spreadMarkRangesAmongStreamsFinal( RangesInDataParts && parts, const Names & column_names, - size_t max_block_size, + UInt64 max_block_size, bool use_uncompressed_cache, const PrewhereInfoPtr & prewhere_info, const Names & virt_columns, diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndices.h b/dbms/src/Storages/MergeTree/MergeTreeIndices.h index 6738d667b44..e2a40163b0e 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndices.h +++ b/dbms/src/Storages/MergeTree/MergeTreeIndices.h @@ -37,7 +37,7 @@ struct IMergeTreeIndexGranule /// Updates the stored info using rows of the specified block. /// Reads no more than `limit` rows. /// After finishing updating `pos` will store the position of the first row which was not read. - virtual void update(const Block & block, size_t * pos, size_t limit) = 0; + virtual void update(const Block & block, size_t * pos, UInt64 limit) = 0; }; using MergeTreeIndexGranulePtr = std::shared_ptr; diff --git a/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.cpp b/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.cpp index 7ff522ad46d..f2bcdb4a1ff 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.cpp @@ -52,7 +52,7 @@ void MergeTreeMinMaxGranule::deserializeBinary(ReadBuffer & istr) } } -void MergeTreeMinMaxGranule::update(const Block & block, size_t * pos, size_t limit) +void MergeTreeMinMaxGranule::update(const Block & block, size_t * pos, UInt64 limit) { if (*pos >= block.rows()) throw Exception( diff --git a/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.h b/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.h index 7a6206dccc7..d320631e3cd 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.h +++ b/dbms/src/Storages/MergeTree/MergeTreeMinMaxIndex.h @@ -21,7 +21,7 @@ struct MergeTreeMinMaxGranule : public IMergeTreeIndexGranule void deserializeBinary(ReadBuffer & istr) override; bool empty() const override { return parallelogram.empty(); } - void update(const Block & block, size_t * pos, size_t limit) override; + void update(const Block & block, size_t * pos, UInt64 limit) override; ~MergeTreeMinMaxGranule() override = default; diff --git a/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp b/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp index 6ca9b18b70c..f80cd01b45a 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp @@ -16,7 +16,7 @@ namespace ErrorCodes MergeTreeSelectBlockInputStream::MergeTreeSelectBlockInputStream( const MergeTreeData & storage_, const MergeTreeData::DataPartPtr & owned_data_part_, - size_t max_block_size_rows_, + UInt64 max_block_size_rows_, size_t preferred_block_size_bytes_, size_t preferred_max_column_in_block_size_bytes_, Names column_names, diff --git a/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.h b/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.h index 2bf6443ee8a..243283b9a43 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.h +++ b/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.h @@ -19,7 +19,7 @@ public: MergeTreeSelectBlockInputStream( const MergeTreeData & storage, const MergeTreeData::DataPartPtr & owned_data_part, - size_t max_block_size_rows, + UInt64 max_block_size_rows, size_t preferred_block_size_bytes, size_t preferred_max_column_in_block_size_bytes, Names column_names, diff --git a/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.cpp b/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.cpp index 95a7ff8dd24..bed74d0d640 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.cpp @@ -78,7 +78,7 @@ void MergeTreeSetIndexGranule::deserializeBinary(ReadBuffer & istr) set->insertFromBlock(block); } -void MergeTreeSetIndexGranule::update(const Block & new_block, size_t * pos, size_t limit) +void MergeTreeSetIndexGranule::update(const Block & new_block, size_t * pos, UInt64 limit) { if (*pos >= new_block.rows()) throw Exception( diff --git a/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.h b/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.h index 28be8788f98..de3dff3c8e2 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.h +++ b/dbms/src/Storages/MergeTree/MergeTreeSetSkippingIndex.h @@ -24,7 +24,7 @@ struct MergeTreeSetIndexGranule : public IMergeTreeIndexGranule size_t size() const { return set->getTotalRowCount(); } bool empty() const override { return !size(); } - void update(const Block & block, size_t * pos, size_t limit) override; + void update(const Block & block, size_t * pos, UInt64 limit) override; Block getElementsBlock() const; ~MergeTreeSetIndexGranule() override = default; diff --git a/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp b/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp index 964adc16edf..1067a50ba56 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp @@ -11,7 +11,7 @@ MergeTreeThreadSelectBlockInputStream::MergeTreeThreadSelectBlockInputStream( const size_t thread, const MergeTreeReadPoolPtr & pool, const size_t min_marks_to_read_, - const size_t max_block_size_rows_, + const UInt64 max_block_size_rows_, size_t preferred_block_size_bytes_, size_t preferred_max_column_in_block_size_bytes_, const MergeTreeData & storage_, diff --git a/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.h b/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.h index 064dc88655a..592b6b71f73 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.h +++ b/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.h @@ -18,7 +18,7 @@ public: const size_t thread, const std::shared_ptr & pool, const size_t min_marks_to_read, - const size_t max_block_size, + const UInt64 max_block_size, size_t preferred_block_size_bytes, size_t preferred_max_column_in_block_size_bytes, const MergeTreeData & storage, diff --git a/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp b/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp index 47cdd9755f0..d0b9474be4c 100644 --- a/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp @@ -110,7 +110,7 @@ void IMergedBlockOutputStream::writeData( size_t prev_mark = 0; while (prev_mark < size) { - size_t limit = 0; + UInt64 limit = 0; /// If there is `index_offset`, then the first mark goes not immediately, but after this number of rows. if (prev_mark == 0 && index_offset != 0) @@ -551,7 +551,7 @@ void MergedBlockOutputStream::writeImpl(const Block & block, const IColumn::Perm while (prev_pos < rows) { - size_t limit = 0; + UInt64 limit = 0; if (prev_pos == 0 && index_offset != 0) { limit = index_offset; diff --git a/dbms/src/Storages/MergeTree/StorageFromMergeTreeDataPart.h b/dbms/src/Storages/MergeTree/StorageFromMergeTreeDataPart.h index 1447ffb40d8..e58839b8137 100644 --- a/dbms/src/Storages/MergeTree/StorageFromMergeTreeDataPart.h +++ b/dbms/src/Storages/MergeTree/StorageFromMergeTreeDataPart.h @@ -23,7 +23,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override { return MergeTreeDataSelectExecutor(part->storage).readFromParts( diff --git a/dbms/src/Storages/StorageBuffer.cpp b/dbms/src/Storages/StorageBuffer.cpp index 9706b1d5562..10e339e041c 100644 --- a/dbms/src/Storages/StorageBuffer.cpp +++ b/dbms/src/Storages/StorageBuffer.cpp @@ -138,7 +138,7 @@ BlockInputStreams StorageBuffer::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) { BlockInputStreams streams_from_dst; diff --git a/dbms/src/Storages/StorageBuffer.h b/dbms/src/Storages/StorageBuffer.h index 85ea3f086b5..585c4ad98c1 100644 --- a/dbms/src/Storages/StorageBuffer.h +++ b/dbms/src/Storages/StorageBuffer.h @@ -61,7 +61,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageCatBoostPool.cpp b/dbms/src/Storages/StorageCatBoostPool.cpp index 011b5a7d80c..60be05304d2 100644 --- a/dbms/src/Storages/StorageCatBoostPool.cpp +++ b/dbms/src/Storages/StorageCatBoostPool.cpp @@ -30,7 +30,7 @@ class CatBoostDatasetBlockInputStream : public IBlockInputStream public: CatBoostDatasetBlockInputStream(const std::string & file_name, const std::string & format_name, - const Block & sample_block, const Context & context, size_t max_block_size) + const Block & sample_block, const Context & context, UInt64 max_block_size) : file_name(file_name), format_name(format_name) { read_buf = std::make_unique(file_name); @@ -262,7 +262,7 @@ BlockInputStreams StorageCatBoostPool::read(const Names & column_names, const SelectQueryInfo & /*query_info*/, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned /*threads*/) { auto stream = std::make_shared( diff --git a/dbms/src/Storages/StorageCatBoostPool.h b/dbms/src/Storages/StorageCatBoostPool.h index 54a7bf1b655..b7a5ca83157 100644 --- a/dbms/src/Storages/StorageCatBoostPool.h +++ b/dbms/src/Storages/StorageCatBoostPool.h @@ -18,7 +18,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned threads) override; private: diff --git a/dbms/src/Storages/StorageDictionary.cpp b/dbms/src/Storages/StorageDictionary.cpp index 5aa2ea6b329..f18a415fb6b 100644 --- a/dbms/src/Storages/StorageDictionary.cpp +++ b/dbms/src/Storages/StorageDictionary.cpp @@ -46,7 +46,7 @@ BlockInputStreams StorageDictionary::read( const SelectQueryInfo & /*query_info*/, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned /*threads*/) { auto dictionary = context.getExternalDictionaries().getDictionary(dictionary_name); diff --git a/dbms/src/Storages/StorageDictionary.h b/dbms/src/Storages/StorageDictionary.h index 96798022ebf..996e8cf1345 100644 --- a/dbms/src/Storages/StorageDictionary.h +++ b/dbms/src/Storages/StorageDictionary.h @@ -28,7 +28,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size = DEFAULT_BLOCK_SIZE, + UInt64 max_block_size = DEFAULT_BLOCK_SIZE, unsigned threads = 1) override; void drop() override {} diff --git a/dbms/src/Storages/StorageDistributed.h b/dbms/src/Storages/StorageDistributed.h index caa52209804..bbab30ce03e 100644 --- a/dbms/src/Storages/StorageDistributed.h +++ b/dbms/src/Storages/StorageDistributed.h @@ -68,7 +68,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageFile.cpp b/dbms/src/Storages/StorageFile.cpp index 8fac03c72a3..46308c314a3 100644 --- a/dbms/src/Storages/StorageFile.cpp +++ b/dbms/src/Storages/StorageFile.cpp @@ -116,7 +116,7 @@ StorageFile::StorageFile( class StorageFileBlockInputStream : public IBlockInputStream { public: - StorageFileBlockInputStream(StorageFile & storage_, const Context & context, size_t max_block_size) + StorageFileBlockInputStream(StorageFile & storage_, const Context & context, UInt64 max_block_size) : storage(storage_) { if (storage.use_table_fd) @@ -187,7 +187,7 @@ BlockInputStreams StorageFile::read( const SelectQueryInfo & /*query_info*/, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned /*num_streams*/) { BlockInputStreamPtr block_input = std::make_shared(*this, context, max_block_size); diff --git a/dbms/src/Storages/StorageFile.h b/dbms/src/Storages/StorageFile.h index 6716dc306a4..0b3fd32c7f4 100644 --- a/dbms/src/Storages/StorageFile.h +++ b/dbms/src/Storages/StorageFile.h @@ -36,7 +36,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write( diff --git a/dbms/src/Storages/StorageHDFS.cpp b/dbms/src/Storages/StorageHDFS.cpp index 7b553fc1ab8..5ed8f90d8e6 100644 --- a/dbms/src/Storages/StorageHDFS.cpp +++ b/dbms/src/Storages/StorageHDFS.cpp @@ -48,7 +48,7 @@ public: const String & format, const Block & sample_block, const Context & context, - size_t max_block_size) + UInt64 max_block_size) { std::unique_ptr read_buf = std::make_unique(uri); auto input_stream = FormatFactory::instance().getInput(format, *read_buf, sample_block, context, max_block_size); @@ -133,7 +133,7 @@ BlockInputStreams StorageHDFS::read( const SelectQueryInfo & /*query_info*/, const Context & context_, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned /*num_streams*/) { return {std::make_shared( diff --git a/dbms/src/Storages/StorageHDFS.h b/dbms/src/Storages/StorageHDFS.h index 6d5141eddbc..069b52b6a52 100644 --- a/dbms/src/Storages/StorageHDFS.h +++ b/dbms/src/Storages/StorageHDFS.h @@ -30,7 +30,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageJoin.cpp b/dbms/src/Storages/StorageJoin.cpp index 78ef15a4fc8..8ed6b27f67d 100644 --- a/dbms/src/Storages/StorageJoin.cpp +++ b/dbms/src/Storages/StorageJoin.cpp @@ -194,7 +194,7 @@ size_t rawSize(const StringRef & t) class JoinBlockInputStream : public IBlockInputStream { public: - JoinBlockInputStream(const Join & parent_, size_t max_block_size_, Block && sample_block_) + JoinBlockInputStream(const Join & parent_, UInt64 max_block_size_, Block && sample_block_) : parent(parent_), lock(parent.rwlock), max_block_size(max_block_size_), sample_block(std::move(sample_block_)) { columns.resize(sample_block.columns()); @@ -239,7 +239,7 @@ protected: private: const Join & parent; std::shared_lock lock; - size_t max_block_size; + UInt64 max_block_size; Block sample_block; ColumnNumbers column_indices; @@ -362,7 +362,7 @@ BlockInputStreams StorageJoin::read( const SelectQueryInfo & /*query_info*/, const Context & /*context*/, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned /*num_streams*/) { check(column_names); diff --git a/dbms/src/Storages/StorageJoin.h b/dbms/src/Storages/StorageJoin.h index 177cdee9834..3eaf479fee8 100644 --- a/dbms/src/Storages/StorageJoin.h +++ b/dbms/src/Storages/StorageJoin.h @@ -38,7 +38,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; private: diff --git a/dbms/src/Storages/StorageLog.cpp b/dbms/src/Storages/StorageLog.cpp index 76329da7827..3026a4d7909 100644 --- a/dbms/src/Storages/StorageLog.cpp +++ b/dbms/src/Storages/StorageLog.cpp @@ -578,7 +578,7 @@ BlockInputStreams StorageLog::read( const SelectQueryInfo & /*query_info*/, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) { check(column_names); diff --git a/dbms/src/Storages/StorageLog.h b/dbms/src/Storages/StorageLog.h index 73a4d387dc5..1d9f4a9a8a0 100644 --- a/dbms/src/Storages/StorageLog.h +++ b/dbms/src/Storages/StorageLog.h @@ -31,7 +31,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageMaterializedView.cpp b/dbms/src/Storages/StorageMaterializedView.cpp index ae33cac8427..e561f14e173 100644 --- a/dbms/src/Storages/StorageMaterializedView.cpp +++ b/dbms/src/Storages/StorageMaterializedView.cpp @@ -186,7 +186,7 @@ BlockInputStreams StorageMaterializedView::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned num_streams) { auto storage = getTargetTable(); diff --git a/dbms/src/Storages/StorageMaterializedView.h b/dbms/src/Storages/StorageMaterializedView.h index d308bd3550a..97f0c448c99 100644 --- a/dbms/src/Storages/StorageMaterializedView.h +++ b/dbms/src/Storages/StorageMaterializedView.h @@ -54,7 +54,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; String getDataPath() const override; diff --git a/dbms/src/Storages/StorageMemory.h b/dbms/src/Storages/StorageMemory.h index 39bcce76894..52f4b565591 100644 --- a/dbms/src/Storages/StorageMemory.h +++ b/dbms/src/Storages/StorageMemory.h @@ -33,7 +33,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageMerge.cpp b/dbms/src/Storages/StorageMerge.cpp index 406404c2293..d8b6fabe6f7 100644 --- a/dbms/src/Storages/StorageMerge.cpp +++ b/dbms/src/Storages/StorageMerge.cpp @@ -177,7 +177,7 @@ BlockInputStreams StorageMerge::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned num_streams) { BlockInputStreams res; @@ -260,7 +260,7 @@ BlockInputStreams StorageMerge::read( } BlockInputStreams StorageMerge::createSourceStreams(const SelectQueryInfo & query_info, const QueryProcessingStage::Enum & processed_stage, - const size_t max_block_size, const Block & header, const StoragePtr & storage, + const UInt64 max_block_size, const Block & header, const StoragePtr & storage, const TableStructureReadLockPtr & struct_lock, Names & real_column_names, Context & modified_context, size_t streams_num, bool has_table_virtual_column, bool concat_streams) diff --git a/dbms/src/Storages/StorageMerge.h b/dbms/src/Storages/StorageMerge.h index 247bb8ff930..8f94439fcc5 100644 --- a/dbms/src/Storages/StorageMerge.h +++ b/dbms/src/Storages/StorageMerge.h @@ -36,7 +36,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; void drop() override {} @@ -75,7 +75,7 @@ protected: const Context & context, QueryProcessingStage::Enum processed_stage); BlockInputStreams createSourceStreams(const SelectQueryInfo & query_info, const QueryProcessingStage::Enum & processed_stage, - const size_t max_block_size, const Block & header, const StoragePtr & storage, + const UInt64 max_block_size, const Block & header, const StoragePtr & storage, const TableStructureReadLockPtr & struct_lock, Names & real_column_names, Context & modified_context, size_t streams_num, bool has_table_virtual_column, bool concat_streams = false); diff --git a/dbms/src/Storages/StorageMergeTree.cpp b/dbms/src/Storages/StorageMergeTree.cpp index a41623b8ca3..0f9f2069645 100644 --- a/dbms/src/Storages/StorageMergeTree.cpp +++ b/dbms/src/Storages/StorageMergeTree.cpp @@ -118,7 +118,7 @@ BlockInputStreams StorageMergeTree::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned num_streams) { return reader.read(column_names, query_info, context, max_block_size, num_streams); diff --git a/dbms/src/Storages/StorageMergeTree.h b/dbms/src/Storages/StorageMergeTree.h index 70968e0dcb4..03b88592bc3 100644 --- a/dbms/src/Storages/StorageMergeTree.h +++ b/dbms/src/Storages/StorageMergeTree.h @@ -54,7 +54,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageMySQL.cpp b/dbms/src/Storages/StorageMySQL.cpp index a009e3568c7..2cd0062f12b 100644 --- a/dbms/src/Storages/StorageMySQL.cpp +++ b/dbms/src/Storages/StorageMySQL.cpp @@ -52,7 +52,7 @@ BlockInputStreams StorageMySQL::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned) { check(column_names); @@ -141,7 +141,7 @@ public: const size_t columns = block.columns(); const size_t rows = block.rows(); size_t offsets = 0; - size_t limits = max_batch_rows; + UInt64 limits = max_batch_rows; for (size_t idx = 0; idx < splited_block_size; ++idx) { /// For last batch, limits should be the remain size diff --git a/dbms/src/Storages/StorageMySQL.h b/dbms/src/Storages/StorageMySQL.h index ee6f0ed3fe8..85aa513e19d 100644 --- a/dbms/src/Storages/StorageMySQL.h +++ b/dbms/src/Storages/StorageMySQL.h @@ -37,7 +37,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageReplicatedMergeTree.cpp b/dbms/src/Storages/StorageReplicatedMergeTree.cpp index 101b9ee4c4c..20c259854b7 100644 --- a/dbms/src/Storages/StorageReplicatedMergeTree.cpp +++ b/dbms/src/Storages/StorageReplicatedMergeTree.cpp @@ -2920,7 +2920,7 @@ BlockInputStreams StorageReplicatedMergeTree::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned num_streams) { const Settings & settings = context.getSettingsRef(); diff --git a/dbms/src/Storages/StorageReplicatedMergeTree.h b/dbms/src/Storages/StorageReplicatedMergeTree.h index d1517182646..69a611288a7 100644 --- a/dbms/src/Storages/StorageReplicatedMergeTree.h +++ b/dbms/src/Storages/StorageReplicatedMergeTree.h @@ -109,7 +109,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageStripeLog.h b/dbms/src/Storages/StorageStripeLog.h index 0282235de51..26cd2898077 100644 --- a/dbms/src/Storages/StorageStripeLog.h +++ b/dbms/src/Storages/StorageStripeLog.h @@ -33,7 +33,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageTinyLog.cpp b/dbms/src/Storages/StorageTinyLog.cpp index 4bca40520b4..821318ceef8 100644 --- a/dbms/src/Storages/StorageTinyLog.cpp +++ b/dbms/src/Storages/StorageTinyLog.cpp @@ -100,7 +100,7 @@ private: using DeserializeStates = std::map; DeserializeStates deserialize_states; - void readData(const String & name, const IDataType & type, IColumn & column, size_t limit); + void readData(const String & name, const IDataType & type, IColumn & column, UInt64 limit); }; @@ -214,7 +214,7 @@ Block TinyLogBlockInputStream::readImpl() } -void TinyLogBlockInputStream::readData(const String & name, const IDataType & type, IColumn & column, size_t limit) +void TinyLogBlockInputStream::readData(const String & name, const IDataType & type, IColumn & column, UInt64 limit) { IDataType::DeserializeBinaryBulkSettings settings; /// TODO Use avg_value_size_hint. settings.getter = [&] (const IDataType::SubstreamPath & path) -> ReadBuffer * @@ -388,7 +388,7 @@ BlockInputStreams StorageTinyLog::read( const SelectQueryInfo & /*query_info*/, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned /*num_streams*/) { check(column_names); diff --git a/dbms/src/Storages/StorageTinyLog.h b/dbms/src/Storages/StorageTinyLog.h index b96570b4428..2ab4ae368ff 100644 --- a/dbms/src/Storages/StorageTinyLog.h +++ b/dbms/src/Storages/StorageTinyLog.h @@ -32,7 +32,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; diff --git a/dbms/src/Storages/StorageURL.cpp b/dbms/src/Storages/StorageURL.cpp index cc2dda4a67a..384a8d1c115 100644 --- a/dbms/src/Storages/StorageURL.cpp +++ b/dbms/src/Storages/StorageURL.cpp @@ -45,7 +45,7 @@ namespace const String & name_, const Block & sample_block, const Context & context, - size_t max_block_size, + UInt64 max_block_size, const ConnectionTimeouts & timeouts) : name(name_) { @@ -157,7 +157,7 @@ BlockInputStreams IStorageURLBase::read(const Names & column_names, const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned /*num_streams*/) { auto request_uri = uri; diff --git a/dbms/src/Storages/StorageURL.h b/dbms/src/Storages/StorageURL.h index dff889b6037..d47aaa2c63c 100644 --- a/dbms/src/Storages/StorageURL.h +++ b/dbms/src/Storages/StorageURL.h @@ -25,7 +25,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override; @@ -52,13 +52,13 @@ private: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum & processed_stage, - size_t max_block_size) const; + UInt64 max_block_size) const; virtual std::function getReadPOSTDataCallback(const Names & column_names, const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum & processed_stage, - size_t max_block_size) const; + UInt64 max_block_size) const; virtual Block getHeaderBlock(const Names & column_names) const = 0; }; diff --git a/dbms/src/Storages/StorageView.h b/dbms/src/Storages/StorageView.h index fed6664b8eb..345634cbbb3 100644 --- a/dbms/src/Storages/StorageView.h +++ b/dbms/src/Storages/StorageView.h @@ -27,7 +27,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; void rename(const String & /*new_path_to_db*/, const String & /*new_database_name*/, const String & new_table_name) override diff --git a/dbms/src/Storages/StorageXDBC.cpp b/dbms/src/Storages/StorageXDBC.cpp index ac8f156305a..9a91cf4e8d8 100644 --- a/dbms/src/Storages/StorageXDBC.cpp +++ b/dbms/src/Storages/StorageXDBC.cpp @@ -46,7 +46,7 @@ std::vector> StorageXDBC::getReadURIParams(c const SelectQueryInfo & /*query_info*/, const Context & /*context*/, QueryProcessingStage::Enum & /*processed_stage*/, - size_t max_block_size) const + UInt64 max_block_size) const { NamesAndTypesList cols; for (const String & name : column_names) @@ -77,7 +77,7 @@ BlockInputStreams StorageXDBC::read(const Names & column_names, const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) { check(column_names); diff --git a/dbms/src/Storages/StorageXDBC.h b/dbms/src/Storages/StorageXDBC.h index 749e8910a24..ddeb2e49eea 100644 --- a/dbms/src/Storages/StorageXDBC.h +++ b/dbms/src/Storages/StorageXDBC.h @@ -19,7 +19,7 @@ namespace DB const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; @@ -43,13 +43,13 @@ namespace DB const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum & processed_stage, - size_t max_block_size) const override; + UInt64 max_block_size) const override; std::function getReadPOSTDataCallback(const Names & column_names, const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum & processed_stage, - size_t max_block_size) const override; + UInt64 max_block_size) const override; Block getHeaderBlock(const Names & column_names) const override; diff --git a/dbms/src/Storages/System/StorageSystemColumns.cpp b/dbms/src/Storages/System/StorageSystemColumns.cpp index 8229b4f0d7c..76f398590fe 100644 --- a/dbms/src/Storages/System/StorageSystemColumns.cpp +++ b/dbms/src/Storages/System/StorageSystemColumns.cpp @@ -58,7 +58,7 @@ public: ColumnsBlockInputStream( const std::vector & columns_mask, const Block & header, - size_t max_block_size, + UInt64 max_block_size, ColumnPtr databases, ColumnPtr tables, Storages storages) @@ -247,7 +247,7 @@ protected: private: std::vector columns_mask; Block header; - size_t max_block_size; + UInt64 max_block_size; ColumnPtr databases; ColumnPtr tables; Storages storages; @@ -261,7 +261,7 @@ BlockInputStreams StorageSystemColumns::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned /*num_streams*/) { check(column_names); diff --git a/dbms/src/Storages/System/StorageSystemColumns.h b/dbms/src/Storages/System/StorageSystemColumns.h index e1814c96ef1..34d9e1fc330 100644 --- a/dbms/src/Storages/System/StorageSystemColumns.h +++ b/dbms/src/Storages/System/StorageSystemColumns.h @@ -23,7 +23,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; private: diff --git a/dbms/src/Storages/System/StorageSystemNumbers.cpp b/dbms/src/Storages/System/StorageSystemNumbers.cpp index f0bd4cfb0ff..e5179787da1 100644 --- a/dbms/src/Storages/System/StorageSystemNumbers.cpp +++ b/dbms/src/Storages/System/StorageSystemNumbers.cpp @@ -11,7 +11,7 @@ namespace DB class NumbersBlockInputStream : public IBlockInputStream { public: - NumbersBlockInputStream(size_t block_size_, size_t offset_, size_t step_) + NumbersBlockInputStream(UInt64 block_size_, UInt64 offset_, UInt64 step_) : block_size(block_size_), next(offset_), step(step_) {} String getName() const override { return "Numbers"; } @@ -37,13 +37,13 @@ protected: return { ColumnWithTypeAndName(std::move(column), std::make_shared(), "number") }; } private: - size_t block_size; + UInt64 block_size; UInt64 next; UInt64 step; }; -StorageSystemNumbers::StorageSystemNumbers(const std::string & name_, bool multithreaded_, std::optional limit_, size_t offset_) +StorageSystemNumbers::StorageSystemNumbers(const std::string & name_, bool multithreaded_, std::optional limit_, UInt64 offset_) : name(name_), multithreaded(multithreaded_), limit(limit_), offset(offset_) { setColumns(ColumnsDescription({{"number", std::make_shared()}})); @@ -55,7 +55,7 @@ BlockInputStreams StorageSystemNumbers::read( const SelectQueryInfo &, const Context & /*context*/, QueryProcessingStage::Enum /*processed_stage*/, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) { check(column_names); diff --git a/dbms/src/Storages/System/StorageSystemNumbers.h b/dbms/src/Storages/System/StorageSystemNumbers.h index d8465343be6..acda0a79de2 100644 --- a/dbms/src/Storages/System/StorageSystemNumbers.h +++ b/dbms/src/Storages/System/StorageSystemNumbers.h @@ -31,7 +31,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; private: diff --git a/dbms/src/Storages/System/StorageSystemOne.h b/dbms/src/Storages/System/StorageSystemOne.h index 721684b7802..a6e435a0cec 100644 --- a/dbms/src/Storages/System/StorageSystemOne.h +++ b/dbms/src/Storages/System/StorageSystemOne.h @@ -26,7 +26,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; private: diff --git a/dbms/src/Storages/System/StorageSystemPartsBase.h b/dbms/src/Storages/System/StorageSystemPartsBase.h index 920ae184e94..5ce2451f33a 100644 --- a/dbms/src/Storages/System/StorageSystemPartsBase.h +++ b/dbms/src/Storages/System/StorageSystemPartsBase.h @@ -28,7 +28,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; struct StoragesInfo diff --git a/dbms/src/Storages/System/StorageSystemReplicas.h b/dbms/src/Storages/System/StorageSystemReplicas.h index 53ba5ebd9bd..0712f6c292b 100644 --- a/dbms/src/Storages/System/StorageSystemReplicas.h +++ b/dbms/src/Storages/System/StorageSystemReplicas.h @@ -23,7 +23,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; private: diff --git a/dbms/src/Storages/System/StorageSystemTables.cpp b/dbms/src/Storages/System/StorageSystemTables.cpp index f7299d5de6c..d38df58da01 100644 --- a/dbms/src/Storages/System/StorageSystemTables.cpp +++ b/dbms/src/Storages/System/StorageSystemTables.cpp @@ -66,7 +66,7 @@ public: TablesBlockInputStream( std::vector columns_mask, Block header, - size_t max_block_size, + UInt64 max_block_size, ColumnPtr databases, const Context & context) : columns_mask(std::move(columns_mask)), header(std::move(header)), max_block_size(max_block_size), databases(std::move(databases)), context(context) {} @@ -298,7 +298,7 @@ protected: private: std::vector columns_mask; Block header; - size_t max_block_size; + UInt64 max_block_size; ColumnPtr databases; size_t database_idx = 0; DatabaseIteratorPtr tables_it; @@ -314,7 +314,7 @@ BlockInputStreams StorageSystemTables::read( const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum /*processed_stage*/, - const size_t max_block_size, + const UInt64 max_block_size, const unsigned /*num_streams*/) { check(column_names); diff --git a/dbms/src/Storages/System/StorageSystemTables.h b/dbms/src/Storages/System/StorageSystemTables.h index e646b21ff89..91d60add8c0 100644 --- a/dbms/src/Storages/System/StorageSystemTables.h +++ b/dbms/src/Storages/System/StorageSystemTables.h @@ -23,7 +23,7 @@ public: const SelectQueryInfo & query_info, const Context & context, QueryProcessingStage::Enum processed_stage, - size_t max_block_size, + UInt64 max_block_size, unsigned num_streams) override; private: diff --git a/dbms/tests/queries/0_stateless/00834_limit_with_constant_expressions.reference b/dbms/tests/queries/0_stateless/00834_limit_with_constant_expressions.reference new file mode 100644 index 00000000000..593bf010efd --- /dev/null +++ b/dbms/tests/queries/0_stateless/00834_limit_with_constant_expressions.reference @@ -0,0 +1,21 @@ +0 +0 +0 +0 +0 +1 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +0 +1 +2 +3 +4 diff --git a/dbms/tests/queries/0_stateless/00834_limit_with_constant_expressions.sql b/dbms/tests/queries/0_stateless/00834_limit_with_constant_expressions.sql new file mode 100644 index 00000000000..12104145237 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00834_limit_with_constant_expressions.sql @@ -0,0 +1,26 @@ +SELECT number FROM numbers(10) LIMIT 0 + 1; +SELECT number FROM numbers(10) LIMIT 1 - 1; +SELECT number FROM numbers(10) LIMIT 2 - 1; +SELECT number FROM numbers(10) LIMIT 0 - 1; -- { serverError 440 } +SELECT number FROM numbers(10) LIMIT 1.0; +SELECT number FROM numbers(10) LIMIT 1.5; -- { serverError 440 } +SELECT number FROM numbers(10) LIMIT '1'; -- { serverError 440 } +SELECT number FROM numbers(10) LIMIT now(); -- { serverError 440 } +SELECT number FROM numbers(10) LIMIT today(); -- { serverError 440 } +SELECT number FROM numbers(10) LIMIT toUInt8('1'); +SELECT number FROM numbers(10) LIMIT toFloat32('1'); +SELECT number FROM numbers(10) LIMIT rand(); -- { serverError 36 } + +SELECT count() <= 1 FROM (SELECT number FROM numbers(10) LIMIT randConstant() % 2); + +SELECT number FROM numbers(10) LIMIT 0 + 1 BY number; +SELECT number FROM numbers(10) LIMIT 0 BY number; + +SELECT TOP 5 * FROM numbers(10); + +SELECT * FROM numbers(10) LIMIT 0.33 / 0.165 - 0.33 + 0.67; -- { serverError 440 } +SELECT * FROM numbers(10) LIMIT LENGTH('NNN') + COS(0), toDate('0000-00-02'); -- { serverError 440 } +SELECT * FROM numbers(10) LIMIT LENGTH('NNN') + COS(0), toDate('0000-00-02'); -- { serverError 440 } +SELECT * FROM numbers(10) LIMIT a + 5 - a; -- { serverError 47 } +SELECT * FROM numbers(10) LIMIT a + b; -- { serverError 47 } +SELECT * FROM numbers(10) LIMIT 'Hello'; -- { serverError 440 } diff --git a/docs/en/operations/troubleshooting.md b/docs/en/operations/troubleshooting.md index 511bbfa2205..25bbc286680 100644 --- a/docs/en/operations/troubleshooting.md +++ b/docs/en/operations/troubleshooting.md @@ -126,7 +126,7 @@ If ClickHouse can not process the query, it sends the description of an error to ```bash $ curl 'http://localhost:8123/' --data-binary "SELECT a" -Code: 47, e.displayText() = DB::Exception: Unknown identifier: a. Note that there is no tables (FROM clause) in your query, context: required_names: 'a' source_tables: table_aliases: private_aliases: column_aliases: public_columns: 'a' masked_columns: array_join_columns: source_columns: , e.what() = DB::Exception +Code: 47, e.displayText() = DB::Exception: Unknown identifier: a. Note that there are no tables (FROM clause) in your query, context: required_names: 'a' source_tables: table_aliases: private_aliases: column_aliases: public_columns: 'a' masked_columns: array_join_columns: source_columns: , e.what() = DB::Exception ``` If you start `clickhouse-client` with `stack-trace` parameter, ClickHouse returns server stack trace with the description of an error. diff --git a/docs/ru/operations/troubleshooting.md b/docs/ru/operations/troubleshooting.md index 1eaaf26934d..a48eea394ca 100644 --- a/docs/ru/operations/troubleshooting.md +++ b/docs/ru/operations/troubleshooting.md @@ -125,7 +125,7 @@ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-serv ```bash $ curl 'http://localhost:8123/' --data-binary "SELECT a" -Code: 47, e.displayText() = DB::Exception: Unknown identifier: a. Note that there is no tables (FROM clause) in your query, context: required_names: 'a' source_tables: table_aliases: private_aliases: column_aliases: public_columns: 'a' masked_columns: array_join_columns: source_columns: , e.what() = DB::Exception +Code: 47, e.displayText() = DB::Exception: Unknown identifier: a. Note that there are no tables (FROM clause) in your query, context: required_names: 'a' source_tables: table_aliases: private_aliases: column_aliases: public_columns: 'a' masked_columns: array_join_columns: source_columns: , e.what() = DB::Exception ``` Если вы запускаете `clickhouse-client` c параметром `stack-trace`, то ClickHouse возвращает описание ошибки и соответствущий стек вызовов функций на сервере.