From 9dd0c3d4de5c6b02cd91032535eb680dc9ee5344 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 18 Nov 2024 10:21:37 +0800 Subject: [PATCH] [comment](sort) Add some comments for `sort_column` (#44024) --- be/src/vec/columns/column.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h index e0706a131c4b85..98894a20895a82 100644 --- a/be/src/vec/columns/column.h +++ b/be/src/vec/columns/column.h @@ -653,6 +653,20 @@ class IColumn : public COW { /// If the only value column can contain is NULL. virtual bool only_null() const { return false; } + /** + * ColumnSorter is used to sort each columns in a Block. In this sorting pattern, sorting a + * column will produce a list of EqualRange which has the same elements respectively. And for + * next column in this block, we only need to sort rows in those `range`. + * + * Besides, we do not materialize sorted data eagerly. Instead, the intermediate sorting results + * are represendted by permutation and data will be materialized after all of columns are sorted. + * + * @sorter: ColumnSorter is used to do sorting. + * @flags : indicates if current item equals to the previous one. + * @perms : permutation after sorting + * @range : EqualRange which has the same elements respectively. + * @last_column : indicates if this column is the last in this block. + */ virtual void sort_column(const ColumnSorter* sorter, EqualFlags& flags, IColumn::Permutation& perms, EqualRange& range, bool last_column) const;