From 2ed598eae8ebe737cdfa2aa2e7e6e0f3ad8d6ef7 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 24 Jan 2023 13:30:22 +0200 Subject: Added comments re JOIN::all_fields, JOIN::fields_list --- sql/sql_select.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'sql/sql_select.h') diff --git a/sql/sql_select.h b/sql/sql_select.h index a953354abb0..b9b272cb1f6 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1396,12 +1396,30 @@ public: (set in make_join_statistics()) */ bool impossible_where; - List all_fields; ///< to store all fields that used in query + + /* + All fields used in the query processing. + + Initially this is a list of fields from the query's SQL text. + + Then, ORDER/GROUP BY and Window Function code add columns that need to + be saved to be available in the post-group-by context. These extra columns + are added to the front, because this->all_fields points to the suffix of + this list. + */ + List all_fields; ///Above list changed to use temporary table List tmp_all_fields1, tmp_all_fields2, tmp_all_fields3; ///Part, shared with list above, emulate following list List tmp_fields_list1, tmp_fields_list2, tmp_fields_list3; - List &fields_list; ///< hold field list passed to mysql_select + + /* + The original field list as it was passed to mysql_select(). This refers + to select_lex->item_list. + CAUTION: this list is a suffix of this->all_fields list, that is, it shares + elements with that list! + */ + List &fields_list; List procedure_fields_list; int error; -- cgit v1.2.1