diff --git a/dbms/src/DataStreams/DistinctSortedBlockInputStream.h b/dbms/src/DataStreams/DistinctSortedBlockInputStream.h index 1b3947b7a61..bf5bbb6c90c 100644 --- a/dbms/src/DataStreams/DistinctSortedBlockInputStream.h +++ b/dbms/src/DataStreams/DistinctSortedBlockInputStream.h @@ -10,6 +10,9 @@ namespace DB /** This class is intended for implementation of SELECT DISTINCT clause and * leaves only unique rows in the stream. * + * Implementation for case, when input stream has rows for same DISTINCT key or at least its prefix, + * grouped together (going consecutively). + * * To optimize the SELECT DISTINCT ... LIMIT clause we can * set limit_hint to non zero value. So we stop emitting new rows after * count of already emitted rows will reach the limit_hint. @@ -46,12 +49,14 @@ private: size_t rows, ClearableSetVariants & variants) const; - const SortDescription& description; + const SortDescription & description; + struct PreviousBlock { Block block; ConstColumnPlainPtrs clearing_hint_columns; - } prev_block; + }; + PreviousBlock prev_block; Names columns_names; ClearableSetVariants data;