summaryrefslogtreecommitdiff
path: root/sql/sql_sort.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_sort.h')
-rw-r--r--sql/sql_sort.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/sql/sql_sort.h b/sql/sql_sort.h
index 6c9a81a32c9..88f719b3593 100644
--- a/sql/sql_sort.h
+++ b/sql/sql_sort.h
@@ -541,14 +541,25 @@ to be fixed later
class Sort_param {
public:
- uint rec_length; // Length of sorted records.
- uint sort_length; // Length of sorted columns.
+ // Length of sorted records. ALWAYS equal to sort_length + addon_length
+ uint rec_length;
+ /*
+ Length of what we need to sort: Sorted columns + ref_length if not
+ addon fields are used
+ */
+ uint sort_length;
+ /* Length of the reference to the row (rowid or primary key etc */
uint ref_length; // Length of record ref.
+ /* Length of all addon fields. 0 if no addon fields */
uint addon_length; // Length of addon_fields
- uint res_length; // Length of records in final sorted file/buffer.
+ /*
+ The length of the 'result' we are going to return to the caller for
+ each sort element. Also the length of data in final sorted file/buffer.
+ */
+ uint res_length;
uint max_keys_per_buffer; // Max keys / buffer.
uint min_dupl_count;
- ha_rows max_rows; // Select limit, or HA_POS_ERROR if unlimited.
+ ha_rows limit_rows; // Select limit, or HA_POS_ERROR if unlimited.
ha_rows examined_rows; // Number of examined rows.
TABLE *sort_form; // For quicker make_sortkey.
/**
@@ -579,10 +590,14 @@ public:
*/
tmp_buffer.set_charset(&my_charset_bin);
}
- void init_for_filesort(uint sortlen, TABLE *table,
- ha_rows maxrows, Filesort *filesort);
- void (*unpack)(TABLE *);
+ void init_for_filesort(TABLE *table, Filesort *filesort,
+ uint sortlen, ha_rows limit_rows_arg);
+ void setup_lengths_and_limit(TABLE *table,
+ uint sortlen,
+ uint addon_length,
+ ha_rows limit_rows_arg);
+ void (*unpack)(TABLE *);
/// Enables the packing of addons if possible.
void try_to_pack_addons(ulong max_length_for_sort_data);