MySQL 8.4.0
Source Code Documentation
sort_param.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SORT_PARAM_INCLUDED
25#define SORT_PARAM_INCLUDED
26
27#include <assert.h>
28#include <algorithm>
29
30#include "field_types.h" // enum_field_types
31#include "my_base.h" // ha_rows
32#include "my_byteorder.h" // uint4korr
33
34#include "my_inttypes.h"
35#include "my_io.h" // mysql_com.h needs my_socket
36#include "mysql_com.h" // Item_result
37#include "sql/mem_root_array.h"
38#include "sql/sql_array.h" // Bounds_checked_array
39#include "sql/sql_const.h"
40#include "sql/sql_sort.h" // Filesort_info
41#include "sql/thr_malloc.h"
42#include "sql_string.h"
43
44class Field;
45class Filesort;
46class Item;
47struct TABLE;
48
52
53 // The remainder are reasons why we are _not_ using addon fields.
60};
61
62inline const char *addon_fields_text(Addon_fields_status afs) {
63 switch (afs) {
64 default:
65 return "unknown";
67 return "using_addon_fields";
69 return "fulltext_searched";
71 return "keep_rowid";
73 return "row_not_packable";
75 return "row_contains_blob";
77 return "skip_heuristic";
79 return "using_priority_queue";
80 }
81}
82
83/* Structs used when sorting */
84
85/// Struct that holds information about a sort field.
87 Item *item; ///< Item to sort
88
89 /// Length of sort field. Beware, can be 0xFFFFFFFFu (infinite)!
90 uint length;
91
92 Item_result result_type; ///< Type of item
93 enum_field_types field_type; ///< Field type of the item
94 bool reverse; ///< if descending sort
95 bool is_varlen; ///< If key part has variable length
96 bool maybe_null; ///< If key part is nullable
97};
98
99/**
100 The structure Sort_addon_field describes the layout
101 for field values appended to sorted values in records to be sorted
102 in the sort buffer.
103
104 Null bit maps for the appended values is placed before the values
105 themselves. Offsets are from the last sorted field.
106
107 The structure is used to store values of the additional fields
108 in the sort buffer. It is used also when these values are read
109 from a temporary file/buffer in 'Filesort_info::unpack_addon_fields'.
110*/
111
112struct Sort_addon_field { /* Sort addon packed field */
113 Field *field; /* Original field */
114 uint null_offset; /* Offset to to null bit from the last sorted field */
115 uint max_length; /* Maximum length in the sort buffer */
116 uint8 null_bit; /* Null bit mask for the field */
117};
118
120
121/**
122 This class wraps information about usage of addon fields.
123 An Addon_fields object is used both during packing of data in the filesort
124 buffer, and later during unpacking in 'Filesort_info::unpack_addon_fields'.
125
126 @see documentation for the Sort_addon_field struct.
127 @see documentation for get_addon_fields()
128 */
130 public:
132 : m_field_descriptors(arr),
135 m_using_packed_addons(false) {
136 assert(!arr.is_null());
137 }
138
141 size_t num_field_descriptors() const { return m_field_descriptors.size(); }
142
143 /// SortFileIterator needs an extra buffer when unpacking.
145 if (using_packed_addons()) {
147 } else {
148 // For fixed-size "addons" the size should not change.
149 assert(m_addon_buf == nullptr || m_addon_buf_length == sz);
150 }
151 /*
152 For subqueries we try to re-use the buffer.
153 With packed addons, the longest_addons may change, so we may have
154 to allocate a larger buffer below.
155 */
156 if (m_addon_buf != nullptr && m_addon_buf_length >= sz) {
157 return m_addon_buf;
158 }
159 m_addon_buf = static_cast<uchar *>((*THR_MALLOC)->Alloc(sz));
161 return m_addon_buf;
162 }
163
166
168
171 }
172 int first_addon_offset() const {
174 }
175
177
178 /**
179 How many bytes to skip to get to the actual data; first NULL flags
180 (for tables and addon fields) and then the actual addons.
181 */
182 size_t skip_bytes() const {
185 } else {
186 return 0;
187 }
188 }
189
190 /**
191 @returns Total number of bytes used for packed addon fields.
192 the size of the length field + size of null bits + sum of field sizes.
193 */
194 static uint read_addon_length(uchar *p) {
196 }
197
198 /**
199 Stores the number of bytes used for packed addon fields.
200 */
201 static void store_addon_length(uchar *p, uint sz) {
202 // We actually store the length of everything *after* the length field.
204 }
205
206 static const uint size_of_length_field = 4;
207
208 private:
210
211 uchar *m_addon_buf; ///< Buffer for unpacking addon fields.
212 uint m_addon_buf_length; ///< Length of the buffer.
213 bool m_using_packed_addons; ///< Are we packing the addon fields?
214
215 /// Number of bytes from after skip_bytes() to the beginning of the first
216 /// addon field.
218};
219
220/* clang-format off */
221/**
222 There are several record formats for sorting:
223@verbatim
224 |<key a><key b>... | ( <null row flag> | <rowid> | ) * num_tables
225 / m_fixed_sort_length / ( 0 or 1 bytes | ref_len / )
226@endverbatim
227
228 or with "addon fields"
229@verbatim
230 |<key a><key b>... |<null bits>|<field a><field b>...|
231 / m_fixed_sort_length / addon_length /
232@endverbatim
233
234 The packed format for "addon fields"
235@verbatim
236 |<key a><key b>... |<length>|<null bits>|<field a><field b>...|
237 / m_fixed_sort_length / addon_length /
238@endverbatim
239
240 For packed addon fields, fields are not stored if the table is nullable and
241 has its NULL bit set.
242
243 All the figures above are depicted for the case of fixed-size keys, with
244 appropriate padding. Fixed-size keys can be compared/sorted using memcmp().
245
246 The packed (variable length) format for keys:
247@verbatim
248 |<keylen>|<varkey a><key b>...<hash>|<(null_row,rowid) * num_tables> or <addons> |
249 / 4 bytes/ keylen bytes / (0/1 + ref_len) * num_tables or addon_length /
250@endverbatim
251
252 Variable-size keys must be compared piece-by-piece, using type information
253 about each individual key part, @see cmp_varlen_keys.
254
255 All the record formats consist of a (possibly composite) key,
256 followed by a (possibly composite) payload.
257 The key is used for sorting data. Once sorting is done, the payload is
258 stored in some buffer, and read by some RowIterator.
259
260<dl>
261<dt>@<key@>
262 <dd> Fields are fixed-size, specially encoded with
263 Field::make_sort_key() so we can do byte-by-byte compare.
264<dt>@<length@>
265 <dd> Contains the *actual* packed length (after packing) of
266 everything after the sort keys.
267 The size of the length field is 2 bytes,
268 which should cover most use cases: addon data <= 65535 bytes.
269 This is the same as max record size in MySQL.
270<dt>@<null bits@>
271 <dd> One bit for each nullable table and field, indicating whether
272 the table/field is NULL or not. May have size zero if no fields
273 or rows are nullable. NULL bits for rows (on nullable tables),
274 if any, always come before NULL bits for fields.
275
276<dt>@<field xx@>
277 <dd> Are stored with field->pack(), and retrieved with
278 field->unpack().
279 Addon fields within a record are stored consecutively, with no
280 "holes" or padding. They will have zero size for NULL values.
281<dt>@<keylen@>
282 <dd> Contains the *actual* packed length of all the keys.
283 We may have an arbitrary mix of fixed and variable-sized keys.
284<dt>@<hash@>
285 <dd> Optional 8 byte hash, used for GROUPing of JSON values.
286<dt>@<varkey@>
287 <dd> Used for JSON and variable-length string values, the format is:
288</dl>
289@verbatim
290 |<null value>|<key length>|<sort key> |
291 / 1 byte / 4 bytes / key length bytes /
292@endverbatim
293<dl>
294<dt>@<null value@>
295 <dd> 0x00 for NULL. 0xff for NULL under DESC sort. 0x01 for NOT NULL.
296<dt>@<key length@>
297 <dd> The length of the sort key, *including* the four bytes for the
298 key length. Does not exist if the field is NULL.
299</dl>
300 */
301/* clang-format on */
303 uint m_fixed_rec_length{0}; ///< Maximum length of a record, see above.
304 uint m_fixed_sort_length{0}; ///< Maximum number of bytes used for sorting.
305 public:
306 uint sum_ref_length{0}; // Length of record ref.
307 uint m_addon_length{0}; // Length of added packed fields.
308 uint fixed_res_length{0}; // Length of records in final sorted file/buffer.
309 uint max_rows_per_buffer{0}; // Max (unpacked) rows / buffer.
310 ha_rows max_rows{0}; // Select limit, or HA_POS_ERROR if unlimited.
311 bool use_hash{false}; // Whether to use hash to distinguish cut JSON
313 false}; ///< Whether we want to remove duplicate rows
314
315 /// If we are removing duplicate rows and merging, contains a buffer where we
316 /// can store the last key seen.
318
319 /**
320 ORDER BY list with some precalculated info for filesort.
321 Array is created and owned by a Filesort instance.
322 */
324
325 Addon_fields *addon_fields{nullptr}; ///< Descriptors for addon fields.
326 bool using_pq{false};
328
329 /// Decide whether we are to use addon fields (sort rows instead of sorting
330 /// row IDs or not). See using_addon_fields().
331 ///
332 /// Note that currently, this function must _not_ be called from the Filesort
333 /// constructor, as the read sets are not fully set up at that time
334 /// (see filter_virtual_gcol_base_cols(), which runs very late in
335 /// optimization). If we want to change this, we can probably have
336 /// make_sortkey() check the read set at runtime, at the cost of slightly less
337 /// precise estimation of packed row size.
338 void decide_addon_fields(Filesort *file_sort,
339 const Mem_root_array<TABLE *> &tables,
340 bool force_sort_rowids);
341
342 /// Reset the decision made in decide_addon_fields(). Only used in exceptional
343 /// circumstances (see NewWeedoutAccessPathForTables()).
344 void clear_addon_fields();
345
346 /**
347 Initialize this struct for filesort() usage.
348 @see description of record layout above
349 @param [in,out] file_sort sorting information which may be re-used on
350 subsequent invocations of filesort()
351 @param sf_array initialization value for local_sortorder
352 @param sortlen length of sorted columns
353 @param tables tables to be sorted
354 @param maxrows HA_POS_ERROR or possible LIMIT value
355 @param remove_duplicates if true, items with duplicate keys will be removed
356 */
357 void init_for_filesort(Filesort *file_sort,
359 uint sortlen, const Mem_root_array<TABLE *> &tables,
360 ha_rows maxrows, bool remove_duplicates);
361
362 /**
363 Initialize this struct for unit testing.
364 */
366 local_sortorder = sf_array;
368 }
369
370 /// Enables the packing of addons if possible.
371 void try_to_pack_addons();
372
373 /// Are we packing the "addon fields"?
374 bool using_packed_addons() const {
375 assert(m_using_packed_addons ==
378 }
379
380 /// Are we using varlen key fields?
381 bool using_varlen_keys() const { return m_num_varlen_keys > 0; }
382
383 /// Are we using any JSON key fields?
384 bool using_json_keys() const { return m_num_json_keys > 0; }
385
386 /// Are we using "addon fields"? Note that decide_addon_fields() or
387 /// init_for_filesort() must be called before checking this.
388 bool using_addon_fields() const { return addon_fields != nullptr; }
389
390 /**
391 Stores key fields in *dst.
392 Then appends either *ref_pos (the @<rowid@>) or the "addon fields".
393 @param [out] dst Where to store the result
394 @param tables Tables to get @<rowid@> from
395 @param [in,out] longest_addons
396 The longest addon field row (sum of all addon fields for any single
397 given row) found.
398 @returns Number of bytes stored, or UINT_MAX if the result could not
399 provably fit within the destination buffer.
400 */
402 const Mem_root_array<TABLE *> &tables,
403 size_t *longest_addons);
404
405 // Adapter for Bounded_queue.
406 uint make_sortkey(uchar *dst, size_t dst_len,
407 const Mem_root_array<TABLE *> &tables) {
408 size_t longest_addons = 0; // Unused.
409 return make_sortkey(Bounds_checked_array<uchar>(dst, dst_len), tables,
410 &longest_addons);
411 }
412
413 /// Stores the length of a variable-sized key.
414 static void store_varlen_key_length(uchar *p, uint sz) { int4store(p, sz); }
415
416 /// Skips the key part, and returns address of payload.
418 size_t offset = using_varlen_keys() ? uint4korr(p) : max_compare_length();
420 offset -= sum_ref_length; // The reference is also part of the sort key.
421 return p + offset;
422 }
423
424 /**
425 Skips the key part, and returns address of payload.
426 For SortBufferIterator, which does not have access to Sort_param.
427 */
428 static uchar *get_start_of_payload(uint default_val, bool is_varlen,
429 uchar *p) {
430 const size_t offset = is_varlen ? uint4korr(p) : default_val;
431 return p + offset;
432 }
433
434 /// @returns The number of bytes used for sorting of fixed-size keys.
436
438
439 /// @returns The actual size of a record (key + addons)
440 size_t get_record_length(uchar *p) const;
441
442 /// @returns The maximum size of a record (key + addons)
443 uint max_record_length() const { return m_fixed_rec_length; }
444
446
447 /**
448 Getter for record length and result length.
449 @param record_start Pointer to record.
450 @param [out] recl Store record length here.
451 @param [out] resl Store result length here.
452 */
453 void get_rec_and_res_len(uchar *record_start, uint *recl, uint *resl);
454
455 // NOTE: Even with FILESORT_ALG_STD_STABLE, we do not necessarily have a
456 // stable sort if spilling to disk; this is purely a performance option.
461 };
463
466
467 static const uint size_of_varlength_field = 4;
468
469 private:
470 /// Counts number of varlen keys
471 int count_varlen_keys() const {
472 return std::count_if(local_sortorder.begin(), local_sortorder.end(),
473 [](const auto &sf) { return sf.is_varlen; });
474 }
475
476 /// Counts number of JSON keys
477 int count_json_keys() const;
478
479 /// total length of fields which have a packable type
481 /// caches the value of using_packed_addons()
483 int m_num_varlen_keys{0}; ///< number of varlen keys
484 int m_num_json_keys{0}; ///< number of JSON keys
485
486 public:
487 Sort_param() = default;
488 // Not copyable.
489 Sort_param(const Sort_param &) = delete;
490 Sort_param &operator=(const Sort_param &) = delete;
491};
492
495 fsi->using_varlen_keys(), p);
496}
497
498/// Are we using "packed addon fields"?
499inline bool using_packed_addons(const Filesort_info *fsi) {
500 return fsi->addon_fields != nullptr &&
502}
503
504#endif // SORT_PARAM_INCLUDED
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
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
Definition: field.h:575
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:934
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
Sort_param()=default
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:1392
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:681
const char * p
Definition: ctype-mb.cc:1235
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:55
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Functions for reading and storing in machine-independent format.
void int4store(char *pT, uint32 A)
Definition: my_byteorder.h:180
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:152
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
Definition: table.h:1405
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
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39