23#ifndef SORT_PARAM_INCLUDED
24#define SORT_PARAM_INCLUDED
66 return "using_addon_fields";
68 return "fulltext_searched";
72 return "row_not_packable";
74 return "row_contains_blob";
76 return "skip_heuristic";
78 return "using_priority_queue";
339 bool force_sort_rowids);
402 size_t *longest_addons);
407 size_t longest_addons = 0;
429 const size_t offset = is_varlen ?
uint4korr(
p) : default_val;
472 [](
const auto &sf) { return sf.is_varlen; });
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:250
This class wraps information about usage of addon fields.
Definition: sort_param.h:128
int m_first_addon_relative_offset
Number of bytes from after skip_bytes() to the beginning of the first addon field.
Definition: sort_param.h:216
static uint read_addon_length(uchar *p)
Definition: sort_param.h:193
static void store_addon_length(uchar *p, uint sz)
Stores the number of bytes used for packed addon fields.
Definition: sort_param.h:200
uchar * allocate_addon_buf(uint sz)
SortFileIterator needs an extra buffer when unpacking.
Definition: sort_param.h:143
size_t skip_bytes() const
How many bytes to skip to get to the actual data; first NULL flags (for tables and addon fields) and ...
Definition: sort_param.h:181
Sort_addon_field * end()
Definition: sort_param.h:139
uchar * get_addon_buf()
Definition: sort_param.h:163
uchar * m_addon_buf
Buffer for unpacking addon fields.
Definition: sort_param.h:210
uint m_addon_buf_length
Length of the buffer.
Definition: sort_param.h:211
static const uint size_of_length_field
Definition: sort_param.h:205
int first_addon_offset() const
Definition: sort_param.h:171
Addon_fields_array m_field_descriptors
Definition: sort_param.h:208
void set_using_packed_addons(bool val)
Definition: sort_param.h:166
void set_first_addon_relative_offset(int offset)
Definition: sort_param.h:168
Sort_addon_field * begin()
Definition: sort_param.h:138
bool using_packed_addons() const
Definition: sort_param.h:175
size_t num_field_descriptors() const
Definition: sort_param.h:140
bool m_using_packed_addons
Are we packing the addon fields?
Definition: sort_param.h:212
Addon_fields(Addon_fields_array arr)
Definition: sort_param.h:130
uint get_addon_buf_length() const
Definition: sort_param.h:164
bool is_null() const
Definition: sql_array.h:156
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:133
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:135
size_t size() const
Definition: sql_array.h:153
A class wrapping misc buffers used for sorting.
Definition: sql_sort.h:188
Addon_fields * addon_fields
Addon field descriptors.
Definition: sql_sort.h:195
bool using_varlen_keys() const
Definition: sql_sort.h:273
uint sort_length() const
Definition: sql_sort.h:272
Sorting related info.
Definition: filesort.h:51
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:932
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:425
There are several record formats for sorting:
Definition: sort_param.h:301
enum_sort_algorithm
Definition: sort_param.h:456
@ FILESORT_ALG_STD_STABLE
Definition: sort_param.h:459
@ FILESORT_ALG_NONE
Definition: sort_param.h:457
@ FILESORT_ALG_STD_SORT
Definition: sort_param.h:458
void set_max_compare_length(uint len)
Definition: sort_param.h:436
uchar * get_start_of_payload(uchar *p) const
Skips the key part, and returns address of payload.
Definition: sort_param.h:416
uint make_sortkey(uchar *dst, size_t dst_len, const Mem_root_array< TABLE * > &tables)
Definition: sort_param.h:405
enum_sort_algorithm m_sort_algorithm
Definition: sort_param.h:461
Bounds_checked_array< st_sort_field > local_sortorder
ORDER BY list with some precalculated info for filesort.
Definition: sort_param.h:322
bool using_packed_addons() const
Are we packing the "addon fields"?
Definition: sort_param.h:373
int count_json_keys() const
Counts number of JSON keys.
Definition: filesort.cc:283
static void store_varlen_key_length(uchar *p, uint sz)
Stores the length of a variable-sized key.
Definition: sort_param.h:413
uint fixed_res_length
Definition: sort_param.h:307
Addon_fields * addon_fields
Descriptors for addon fields.
Definition: sort_param.h:324
void init_for_unittest(Bounds_checked_array< st_sort_field > sf_array)
Initialize this struct for unit testing.
Definition: sort_param.h:364
static const uint size_of_varlength_field
Definition: sort_param.h:466
void try_to_pack_addons()
Enables the packing of addons if possible.
Definition: filesort.cc:263
void set_max_record_length(uint len)
Definition: sort_param.h:444
uint m_packable_length
total length of fields which have a packable type
Definition: sort_param.h:479
int m_num_varlen_keys
number of varlen keys
Definition: sort_param.h:482
bool using_json_keys() const
Are we using any JSON key fields?
Definition: sort_param.h:383
int m_num_json_keys
number of JSON keys
Definition: sort_param.h:483
uint make_sortkey(Bounds_checked_array< uchar > dst, const Mem_root_array< TABLE * > &tables, size_t *longest_addons)
Stores key fields in *dst.
Definition: filesort.cc:1391
bool m_using_packed_addons
caches the value of using_packed_addons()
Definition: sort_param.h:481
Sort_param & operator=(const Sort_param &)=delete
int count_varlen_keys() const
Counts number of varlen keys.
Definition: sort_param.h:470
void clear_addon_fields()
Reset the decision made in decide_addon_fields().
Definition: filesort.cc:209
uint max_compare_length() const
Definition: sort_param.h:434
bool m_remove_duplicates
Whether we want to remove duplicate rows.
Definition: sort_param.h:311
void init_for_filesort(Filesort *file_sort, Bounds_checked_array< st_sort_field > sf_array, uint sortlen, const Mem_root_array< TABLE * > &tables, ha_rows maxrows, bool remove_duplicates)
Initialize this struct for filesort() usage.
Definition: filesort.cc:214
uint m_fixed_sort_length
Maximum number of bytes used for sorting.
Definition: sort_param.h:303
StringBuffer< STRING_BUFFER_USUAL_SIZE > tmp_buffer
Definition: sort_param.h:326
void get_rec_and_res_len(uchar *record_start, uint *recl, uint *resl)
Getter for record length and result length.
Definition: filesort.cc:302
uint m_fixed_rec_length
Maximum length of a record, see above.
Definition: sort_param.h:302
bool using_pq
Definition: sort_param.h:325
void decide_addon_fields(Filesort *file_sort, const Mem_root_array< TABLE * > &tables, bool force_sort_rowids)
Decide whether we are to use addon fields (sort rows instead of sorting row IDs or not).
Definition: filesort.cc:161
uint sum_ref_length
Definition: sort_param.h:305
Addon_fields_status m_addon_fields_status
Definition: sort_param.h:463
Sort_param(const Sort_param &)=delete
uchar * m_last_key_seen
If we are removing duplicate rows and merging, contains a buffer where we can store the last key seen...
Definition: sort_param.h:316
uint max_record_length() const
Definition: sort_param.h:442
static uchar * get_start_of_payload(uint default_val, bool is_varlen, uchar *p)
Skips the key part, and returns address of payload.
Definition: sort_param.h:427
size_t get_record_length(uchar *p) const
Definition: filesort.cc:293
uint max_rows_per_buffer
Definition: sort_param.h:308
uint m_addon_length
Definition: sort_param.h:306
ha_rows max_rows
Definition: sort_param.h:309
bool use_hash
Definition: sort_param.h:310
bool using_varlen_keys() const
Are we using varlen key fields?
Definition: sort_param.h:380
bool using_addon_fields() const
Are we using "addon fields"? Note that decide_addon_fields() or init_for_filesort() must be called be...
Definition: sort_param.h:387
String class wrapper with a preallocated buffer of size buff_sz.
Definition: sql_string.h:658
const char * p
Definition: ctype-mb.cc:1234
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:54
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1139
Functions for reading and storing in machine-independent format.
void int4store(char *pT, uint32 A)
Definition: my_byteorder.h:172
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:144
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:62
unsigned char uchar
Definition: my_inttypes.h:51
Common #defines and includes for file and socket I/O.
Common definition between mysql server & client.
R::iterator remove_duplicates(R *rp, LESSF &&lessf=LESSF(), EQUALF &&equalf=EQUALF())
Definition: tablespace_impl.cc:391
uchar * get_start_of_payload(const Filesort_info *fsi, uchar *p)
Definition: sort_param.h:492
Addon_fields_status
Definition: sort_param.h:48
const char * addon_fields_text(Addon_fields_status afs)
Definition: sort_param.h:61
Bounds_checked_array< Sort_addon_field > Addon_fields_array
Definition: sort_param.h:118
bool using_packed_addons(const Filesort_info *fsi)
Are we using "packed addon fields"?
Definition: sort_param.h:498
File containing constants that can be used throughout the server.
Our own string classes, used pervasively throughout the executor.
The structure Sort_addon_field describes the layout for field values appended to sorted values in rec...
Definition: sort_param.h:111
uint max_length
Definition: sort_param.h:114
Field * field
Definition: sort_param.h:112
uint null_offset
Definition: sort_param.h:113
uint8 null_bit
Definition: sort_param.h:115
Struct that holds information about a sort field.
Definition: sort_param.h:85
bool maybe_null
If key part is nullable.
Definition: sort_param.h:95
Item * item
Item to sort.
Definition: sort_param.h:86
Item_result result_type
Type of item.
Definition: sort_param.h:91
bool reverse
if descending sort
Definition: sort_param.h:93
enum_field_types field_type
Field type of the item.
Definition: sort_param.h:92
bool is_varlen
If key part has variable length.
Definition: sort_param.h:94
uint length
Length of sort field. Beware, can be 0xFFFFFFFFu (infinite)!
Definition: sort_param.h:89
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:38