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