24#ifndef SORT_PARAM_INCLUDED
25#define SORT_PARAM_INCLUDED
67 return "using_addon_fields";
69 return "fulltext_searched";
73 return "row_not_packable";
75 return "row_contains_blob";
77 return "skip_heuristic";
79 return "using_priority_queue";
340 bool force_sort_rowids);
403 size_t *longest_addons);
408 size_t longest_addons = 0;
430 size_t offset = is_varlen ?
uint4korr(
p) : default_val;
473 [](
const auto &sf) { return sf.is_varlen; });
This class wraps information about usage of addon fields.
Definition: sort_param.h:129
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:217
static uint read_addon_length(uchar *p)
Definition: sort_param.h:194
static void store_addon_length(uchar *p, uint sz)
Stores the number of bytes used for packed addon fields.
Definition: sort_param.h:201
uchar * allocate_addon_buf(uint sz)
SortFileIterator needs an extra buffer when unpacking.
Definition: sort_param.h:144
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:182
Sort_addon_field * end()
Definition: sort_param.h:140
uchar * get_addon_buf()
Definition: sort_param.h:164
uchar * m_addon_buf
Buffer for unpacking addon fields.
Definition: sort_param.h:211
uint m_addon_buf_length
Length of the buffer.
Definition: sort_param.h:212
static const uint size_of_length_field
Definition: sort_param.h:206
int first_addon_offset() const
Definition: sort_param.h:172
Addon_fields_array m_field_descriptors
Definition: sort_param.h:209
void set_using_packed_addons(bool val)
Definition: sort_param.h:167
void set_first_addon_relative_offset(int offset)
Definition: sort_param.h:169
Sort_addon_field * begin()
Definition: sort_param.h:139
bool using_packed_addons() const
Definition: sort_param.h:176
size_t num_field_descriptors() const
Definition: sort_param.h:141
bool m_using_packed_addons
Are we packing the addon fields?
Definition: sort_param.h:213
Addon_fields(Addon_fields_array arr)
Definition: sort_param.h:131
uint get_addon_buf_length() const
Definition: sort_param.h:165
bool is_null() const
Definition: sql_array.h:157
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:134
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:136
size_t size() const
Definition: sql_array.h:154
A class wrapping misc buffers used for sorting.
Definition: sql_sort.h:189
Addon_fields * addon_fields
Addon field descriptors.
Definition: sql_sort.h:196
bool using_varlen_keys() const
Definition: sql_sort.h:274
uint sort_length() const
Definition: sql_sort.h:273
Sorting related info.
Definition: filesort.h:52
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
There are several record formats for sorting:
Definition: sort_param.h:302
enum_sort_algorithm
Definition: sort_param.h:457
@ FILESORT_ALG_STD_STABLE
Definition: sort_param.h:460
@ FILESORT_ALG_NONE
Definition: sort_param.h:458
@ FILESORT_ALG_STD_SORT
Definition: sort_param.h:459
void set_max_compare_length(uint len)
Definition: sort_param.h:437
uchar * get_start_of_payload(uchar *p) const
Skips the key part, and returns address of payload.
Definition: sort_param.h:417
uint make_sortkey(uchar *dst, size_t dst_len, const Mem_root_array< TABLE * > &tables)
Definition: sort_param.h:406
enum_sort_algorithm m_sort_algorithm
Definition: sort_param.h:462
Bounds_checked_array< st_sort_field > local_sortorder
ORDER BY list with some precalculated info for filesort.
Definition: sort_param.h:323
bool using_packed_addons() const
Are we packing the "addon fields"?
Definition: sort_param.h:374
int count_json_keys() const
Counts number of JSON keys.
Definition: filesort.cc:284
static void store_varlen_key_length(uchar *p, uint sz)
Stores the length of a variable-sized key.
Definition: sort_param.h:414
uint fixed_res_length
Definition: sort_param.h:308
Addon_fields * addon_fields
Descriptors for addon fields.
Definition: sort_param.h:325
void init_for_unittest(Bounds_checked_array< st_sort_field > sf_array)
Initialize this struct for unit testing.
Definition: sort_param.h:365
static const uint size_of_varlength_field
Definition: sort_param.h:467
void try_to_pack_addons()
Enables the packing of addons if possible.
Definition: filesort.cc:264
void set_max_record_length(uint len)
Definition: sort_param.h:445
uint m_packable_length
total length of fields which have a packable type
Definition: sort_param.h:480
int m_num_varlen_keys
number of varlen keys
Definition: sort_param.h:483
bool using_json_keys() const
Are we using any JSON key fields?
Definition: sort_param.h:384
int m_num_json_keys
number of JSON keys
Definition: sort_param.h:484
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:482
Sort_param & operator=(const Sort_param &)=delete
int count_varlen_keys() const
Counts number of varlen keys.
Definition: sort_param.h:471
void clear_addon_fields()
Reset the decision made in decide_addon_fields().
Definition: filesort.cc:210
uint max_compare_length() const
Definition: sort_param.h:435
bool m_remove_duplicates
Whether we want to remove duplicate rows.
Definition: sort_param.h:312
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:215
uint m_fixed_sort_length
Maximum number of bytes used for sorting.
Definition: sort_param.h:304
StringBuffer< STRING_BUFFER_USUAL_SIZE > tmp_buffer
Definition: sort_param.h:327
void get_rec_and_res_len(uchar *record_start, uint *recl, uint *resl)
Getter for record length and result length.
Definition: filesort.cc:303
uint m_fixed_rec_length
Maximum length of a record, see above.
Definition: sort_param.h:303
bool using_pq
Definition: sort_param.h:326
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:162
uint sum_ref_length
Definition: sort_param.h:306
Addon_fields_status m_addon_fields_status
Definition: sort_param.h:464
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:317
uint max_record_length() const
Definition: sort_param.h:443
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:428
size_t get_record_length(uchar *p) const
Definition: filesort.cc:294
uint max_rows_per_buffer
Definition: sort_param.h:309
uint m_addon_length
Definition: sort_param.h:307
ha_rows max_rows
Definition: sort_param.h:310
bool use_hash
Definition: sort_param.h:311
bool using_varlen_keys() const
Are we using varlen key fields?
Definition: sort_param.h:381
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:388
String class wrapper with a preallocated buffer of size buff_sz.
Definition: sql_string.h:660
const char * p
Definition: ctype-mb.cc:1237
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:53
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Functions for reading and storing in machine-independent format.
void int4store(char *pT, uint32 A)
Definition: my_byteorder.h:173
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:145
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:63
unsigned char uchar
Definition: my_inttypes.h:52
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:392
uchar * get_start_of_payload(const Filesort_info *fsi, uchar *p)
Definition: sort_param.h:493
Addon_fields_status
Definition: sort_param.h:49
const char * addon_fields_text(Addon_fields_status afs)
Definition: sort_param.h:62
Bounds_checked_array< Sort_addon_field > Addon_fields_array
Definition: sort_param.h:119
bool using_packed_addons(const Filesort_info *fsi)
Are we using "packed addon fields"?
Definition: sort_param.h:499
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:112
uint max_length
Definition: sort_param.h:115
Field * field
Definition: sort_param.h:113
uint null_offset
Definition: sort_param.h:114
uint8 null_bit
Definition: sort_param.h:116
Struct that holds information about a sort field.
Definition: sort_param.h:86
bool maybe_null
If key part is nullable.
Definition: sort_param.h:96
Item * item
Item to sort.
Definition: sort_param.h:87
Item_result result_type
Type of item.
Definition: sort_param.h:92
bool reverse
if descending sort
Definition: sort_param.h:94
enum_field_types field_type
Field type of the item.
Definition: sort_param.h:93
bool is_varlen
If key part has variable length.
Definition: sort_param.h:95
uint length
Length of sort field. Beware, can be 0xFFFFFFFFu (infinite)!
Definition: sort_param.h:90
unsigned int uint
Definition: uca9-dump.cc:75
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39