MySQL  8.0.27
Source Code Documentation
sort_param.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2021, 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 
43 class Field;
44 class Filesort;
45 class Item;
46 struct TABLE;
47 
48 enum class Addon_fields_status {
51 
52  // The remainder are reasons why we are _not_ using addon fields.
54  keep_rowid,
59 };
60 
61 inline 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.
85 struct st_sort_field {
86  Item *item; ///< Item to sort
87 
88  /// Length of sort field. Beware, can be 0xFFFFFFFFu (infinite)!
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 
111 struct 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()) {
145  assert(sz + Addon_fields::size_of_length_field > sz);
147  }
148  if (m_addon_buf != nullptr) {
149  assert(m_addon_buf_length == sz);
150  return m_addon_buf;
151  }
152  m_addon_buf = static_cast<uchar *>((*THR_MALLOC)->Alloc(sz));
154  return m_addon_buf;
155  }
156 
159 
161 
164  }
165  int first_addon_offset() const {
167  }
168 
170 
171  /**
172  How many bytes to skip to get to the actual data; first NULL flags
173  (for tables and addon fields) and then the actual addons.
174  */
175  size_t skip_bytes() const {
176  if (m_using_packed_addons) {
178  } else {
179  return 0;
180  }
181  }
182 
183  /**
184  @returns Total number of bytes used for packed addon fields.
185  the size of the length field + size of null bits + sum of field sizes.
186  */
188  return size_of_length_field + uint4korr(p);
189  }
190 
191  /**
192  Stores the number of bytes used for packed addon fields.
193  */
194  static void store_addon_length(uchar *p, uint sz) {
195  // We actually store the length of everything *after* the length field.
197  }
198 
199  static const uint size_of_length_field = 4;
200 
201  private:
203 
204  uchar *m_addon_buf; ///< Buffer for unpacking addon fields.
205  uint m_addon_buf_length; ///< Length of the buffer.
206  bool m_using_packed_addons; ///< Are we packing the addon fields?
207 
208  /// Number of bytes from after skip_bytes() to the beginning of the first
209  /// addon field.
211 };
212 
213 /* clang-format off */
214 /**
215  There are several record formats for sorting:
216 @verbatim
217  |<key a><key b>... | ( <null row flag> | <rowid> | ) * num_tables
218  / m_fixed_sort_length / ( 0 or 1 bytes | ref_len / )
219 @endverbatim
220 
221  or with "addon fields"
222 @verbatim
223  |<key a><key b>... |<null bits>|<field a><field b>...|
224  / m_fixed_sort_length / addon_length /
225 @endverbatim
226 
227  The packed format for "addon fields"
228 @verbatim
229  |<key a><key b>... |<length>|<null bits>|<field a><field b>...|
230  / m_fixed_sort_length / addon_length /
231 @endverbatim
232 
233  For packed addon fields, fields are not stored if the table is nullable and
234  has its NULL bit set.
235 
236  All the figures above are depicted for the case of fixed-size keys, with
237  appropriate padding. Fixed-size keys can be compared/sorted using memcmp().
238 
239  The packed (variable length) format for keys:
240 @verbatim
241  |<keylen>|<varkey a><key b>...<hash>|<(null_row,rowid) * num_tables> or <addons> |
242  / 4 bytes/ keylen bytes / (0/1 + ref_len) * num_tables or addon_length /
243 @endverbatim
244 
245  Variable-size keys must be compared piece-by-piece, using type information
246  about each individual key part, @see cmp_varlen_keys.
247 
248  All the record formats consist of a (possibly composite) key,
249  followed by a (possibly composite) payload.
250  The key is used for sorting data. Once sorting is done, the payload is
251  stored in some buffer, and read by some RowIterator.
252 
253 <dl>
254 <dt>@<key@>
255  <dd> Fields are fixed-size, specially encoded with
256  Field::make_sort_key() so we can do byte-by-byte compare.
257 <dt>@<length@>
258  <dd> Contains the *actual* packed length (after packing) of
259  everything after the sort keys.
260  The size of the length field is 2 bytes,
261  which should cover most use cases: addon data <= 65535 bytes.
262  This is the same as max record size in MySQL.
263 <dt>@<null bits@>
264  <dd> One bit for each nullable table and field, indicating whether
265  the table/field is NULL or not. May have size zero if no fields
266  or rows are nullable. NULL bits for rows (on nullable tables),
267  if any, always come before NULL bits for fields.
268 
269 <dt>@<field xx@>
270  <dd> Are stored with field->pack(), and retrieved with
271  field->unpack().
272  Addon fields within a record are stored consecutively, with no
273  "holes" or padding. They will have zero size for NULL values.
274 <dt>@<keylen@>
275  <dd> Contains the *actual* packed length of all the keys.
276  We may have an arbitrary mix of fixed and variable-sized keys.
277 <dt>@<hash@>
278  <dd> Optional 8 byte hash, used for GROUPing of JSON values.
279 <dt>@<varkey@>
280  <dd> Used for JSON and variable-length string values, the format is:
281 </dl>
282 @verbatim
283  |<null value>|<key length>|<sort key> |
284  / 1 byte / 4 bytes / key length bytes /
285 @endverbatim
286 <dl>
287 <dt>@<null value@>
288  <dd> 0x00 for NULL. 0xff for NULL under DESC sort. 0x01 for NOT NULL.
289 <dt>@<key length@>
290  <dd> The length of the sort key, *including* the four bytes for the
291  key length. Does not exist if the field is NULL.
292 </dl>
293  */
294 /* clang-format on */
295 class Sort_param {
296  uint m_fixed_rec_length{0}; ///< Maximum length of a record, see above.
297  uint m_fixed_sort_length{0}; ///< Maximum number of bytes used for sorting.
298  public:
299  uint sum_ref_length{0}; // Length of record ref.
300  uint m_addon_length{0}; // Length of added packed fields.
301  uint fixed_res_length{0}; // Length of records in final sorted file/buffer.
302  uint max_rows_per_buffer{0}; // Max (unpacked) rows / buffer.
303  ha_rows max_rows{0}; // Select limit, or HA_POS_ERROR if unlimited.
304  bool use_hash{false}; // Whether to use hash to distinguish cut JSON
306  false}; ///< Whether we want to remove duplicate rows
307 
308  /// If we are removing duplicate rows and merging, contains a buffer where we
309  /// can store the last key seen.
311 
312  /**
313  ORDER BY list with some precalculated info for filesort.
314  Array is created and owned by a Filesort instance.
315  */
317 
318  Addon_fields *addon_fields{nullptr}; ///< Descriptors for addon fields.
319  bool using_pq{false};
321 
322  /// Decide whether we are to use addon fields (sort rows instead of sorting
323  /// row IDs or not). See using_addon_fields().
324  ///
325  /// Note that currently, this function must _not_ be called from the Filesort
326  /// constructor, as the read sets are not fully set up at that time
327  /// (see filter_virtual_gcol_base_cols(), which runs very late in
328  /// optimization). If we want to change this, we can probably have
329  /// make_sortkey() check the read set at runtime, at the cost of slightly less
330  /// precise estimation of packed row size.
331  void decide_addon_fields(Filesort *file_sort,
332  const Mem_root_array<TABLE *> &tables,
333  bool sort_positions);
334 
335  /// Reset the decision made in decide_addon_fields(). Only used in exceptional
336  /// circumstances (see NewWeedoutAccessPathForTables()).
337  void clear_addon_fields();
338 
339  /**
340  Initialize this struct for filesort() usage.
341  @see description of record layout above
342  @param [in,out] file_sort sorting information which may be re-used on
343  subsequent invocations of filesort()
344  @param sf_array initialization value for local_sortorder
345  @param sortlen length of sorted columns
346  @param tables tables to be sorted
347  @param maxrows HA_POS_ERROR or possible LIMIT value
348  @param remove_duplicates if true, items with duplicate keys will be removed
349  */
350  void init_for_filesort(Filesort *file_sort,
352  uint sortlen, const Mem_root_array<TABLE *> &tables,
353  ha_rows maxrows, bool remove_duplicates);
354 
355  /**
356  Initialize this struct for unit testing.
357  */
359  local_sortorder = sf_array;
361  }
362 
363  /// Enables the packing of addons if possible.
364  void try_to_pack_addons();
365 
366  /// Are we packing the "addon fields"?
367  bool using_packed_addons() const {
368  assert(m_using_packed_addons ==
369  (addon_fields != nullptr && addon_fields->using_packed_addons()));
370  return m_using_packed_addons;
371  }
372 
373  /// Are we using varlen key fields?
374  bool using_varlen_keys() const { return m_num_varlen_keys > 0; }
375 
376  /// Are we using any JSON key fields?
377  bool using_json_keys() const { return m_num_json_keys > 0; }
378 
379  /// Are we using "addon fields"? Note that decide_addon_fields() or
380  /// init_for_filesort() must be called before checking this.
381  bool using_addon_fields() const { return addon_fields != nullptr; }
382 
383  /**
384  Stores key fields in *dst.
385  Then appends either *ref_pos (the @<rowid@>) or the "addon fields".
386  @param [out] dst Where to store the result
387  @param tables Tables to get @<rowid@> from
388  @param [in,out] longest_addons
389  The longest addon field row (sum of all addon fields for any single
390  given row) found.
391  @returns Number of bytes stored, or UINT_MAX if the result could not
392  provably fit within the destination buffer.
393  */
395  const Mem_root_array<TABLE *> &tables,
396  size_t *longest_addons);
397 
398  // Adapter for Bounded_queue.
399  uint make_sortkey(uchar *dst, size_t dst_len,
400  const Mem_root_array<TABLE *> &tables) {
401  size_t longest_addons = 0; // Unused.
402  return make_sortkey(Bounds_checked_array<uchar>(dst, dst_len), tables,
403  &longest_addons);
404  }
405 
406  /// Stores the length of a variable-sized key.
407  static void store_varlen_key_length(uchar *p, uint sz) { int4store(p, sz); }
408 
409  /// Skips the key part, and returns address of payload.
411  size_t offset = using_varlen_keys() ? uint4korr(p) : max_compare_length();
413  offset -= sum_ref_length; // The reference is also part of the sort key.
414  return p + offset;
415  }
416 
417  /**
418  Skips the key part, and returns address of payload.
419  For SortBufferIterator, which does not have access to Sort_param.
420  */
421  static uchar *get_start_of_payload(uint default_val, bool is_varlen,
422  uchar *p) {
423  size_t offset = is_varlen ? uint4korr(p) : default_val;
424  return p + offset;
425  }
426 
427  /// @returns The number of bytes used for sorting of fixed-size keys.
429 
431 
432  /// @returns The actual size of a record (key + addons)
433  size_t get_record_length(uchar *p) const;
434 
435  /// @returns The maximum size of a record (key + addons)
437 
439 
440  /**
441  Getter for record length and result length.
442  @param record_start Pointer to record.
443  @param [out] recl Store record length here.
444  @param [out] resl Store result length here.
445  */
446  void get_rec_and_res_len(uchar *record_start, uint *recl, uint *resl);
447 
448  // NOTE: Even with FILESORT_ALG_STD_STABLE, we do not necessarily have a
449  // stable sort if spilling to disk; this is purely a performance option.
454  };
456 
459 
460  static const uint size_of_varlength_field = 4;
461 
462  private:
463  /// Counts number of varlen keys
464  int count_varlen_keys() const {
465  return std::count_if(local_sortorder.begin(), local_sortorder.end(),
466  [](const auto &sf) { return sf.is_varlen; });
467  }
468 
469  /// Counts number of JSON keys
470  int count_json_keys() const;
471 
472  /// total length of fields which have a packable type
474  /// caches the value of using_packed_addons()
476  int m_num_varlen_keys{0}; ///< number of varlen keys
477  int m_num_json_keys{0}; ///< number of JSON keys
478 
479  public:
480  Sort_param() = default;
481  // Not copyable.
482  Sort_param(const Sort_param &) = delete;
483  Sort_param &operator=(const Sort_param &) = delete;
484 };
485 
488  fsi->using_varlen_keys(), p);
489 }
490 
491 /// Are we using "packed addon fields"?
492 inline bool using_packed_addons(const Filesort_info *fsi) {
493  return fsi->addon_fields != nullptr &&
495 }
496 
497 #endif // SORT_PARAM_INCLUDED
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:210
static uint read_addon_length(uchar *p)
Definition: sort_param.h:187
static void store_addon_length(uchar *p, uint sz)
Stores the number of bytes used for packed addon fields.
Definition: sort_param.h:194
Sort_addon_field * begin()
Definition: sort_param.h:138
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:175
uchar * allocate_addon_buf(uint sz)
SortFileIterator needs an extra buffer when unpacking.
Definition: sort_param.h:143
uchar * m_addon_buf
Buffer for unpacking addon fields.
Definition: sort_param.h:204
uchar * get_addon_buf()
Definition: sort_param.h:157
uint m_addon_buf_length
Length of the buffer.
Definition: sort_param.h:205
static const uint size_of_length_field
Definition: sort_param.h:199
int first_addon_offset() const
Definition: sort_param.h:165
Addon_fields_array m_field_descriptors
Definition: sort_param.h:202
void set_using_packed_addons(bool val)
Definition: sort_param.h:160
void set_first_addon_relative_offset(int offset)
Definition: sort_param.h:162
Sort_addon_field * end()
Definition: sort_param.h:139
bool using_packed_addons() const
Definition: sort_param.h:169
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:206
Addon_fields(Addon_fields_array arr)
Definition: sort_param.h:130
uint get_addon_buf_length() const
Definition: sort_param.h:158
bool is_null() const
Definition: sql_array.h:134
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:116
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:118
size_t size() const
Definition: sql_array.h:131
Definition: field.h:590
A class wrapping misc buffers used for sorting.
Definition: sql_sort.h:177
Addon_fields * addon_fields
Addon field descriptors.
Definition: sql_sort.h:184
bool using_varlen_keys() const
Definition: sql_sort.h:262
uint sort_length() const
Definition: sql_sort.h:261
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:802
There are several record formats for sorting:
Definition: sort_param.h:295
enum_sort_algorithm
Definition: sort_param.h:450
@ FILESORT_ALG_STD_STABLE
Definition: sort_param.h:453
@ FILESORT_ALG_NONE
Definition: sort_param.h:451
@ FILESORT_ALG_STD_SORT
Definition: sort_param.h:452
void set_max_compare_length(uint len)
Definition: sort_param.h:430
Sort_param()=default
uint make_sortkey(uchar *dst, size_t dst_len, const Mem_root_array< TABLE * > &tables)
Definition: sort_param.h:399
enum_sort_algorithm m_sort_algorithm
Definition: sort_param.h:455
Bounds_checked_array< st_sort_field > local_sortorder
ORDER BY list with some precalculated info for filesort.
Definition: sort_param.h:316
bool using_packed_addons() const
Are we packing the "addon fields"?
Definition: sort_param.h:367
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:407
uint fixed_res_length
Definition: sort_param.h:301
void decide_addon_fields(Filesort *file_sort, const Mem_root_array< TABLE * > &tables, bool sort_positions)
Decide whether we are to use addon fields (sort rows instead of sorting row IDs or not).
Definition: filesort.cc:161
Addon_fields * addon_fields
Descriptors for addon fields.
Definition: sort_param.h:318
void init_for_unittest(Bounds_checked_array< st_sort_field > sf_array)
Initialize this struct for unit testing.
Definition: sort_param.h:358
static const uint size_of_varlength_field
Definition: sort_param.h:460
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:438
uint m_packable_length
total length of fields which have a packable type
Definition: sort_param.h:473
int m_num_varlen_keys
number of varlen keys
Definition: sort_param.h:476
bool using_json_keys() const
Are we using any JSON key fields?
Definition: sort_param.h:377
int m_num_json_keys
number of JSON keys
Definition: sort_param.h:477
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:475
int count_varlen_keys() const
Counts number of varlen keys.
Definition: sort_param.h:464
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:428
bool m_remove_duplicates
Whether we want to remove duplicate rows.
Definition: sort_param.h:305
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:297
StringBuffer< STRING_BUFFER_USUAL_SIZE > tmp_buffer
Definition: sort_param.h:320
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:296
bool using_pq
Definition: sort_param.h:319
uint sum_ref_length
Definition: sort_param.h:299
Addon_fields_status m_addon_fields_status
Definition: sort_param.h:457
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:421
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:310
uint max_record_length() const
Definition: sort_param.h:436
size_t get_record_length(uchar *p) const
Definition: filesort.cc:293
uint max_rows_per_buffer
Definition: sort_param.h:302
uint m_addon_length
Definition: sort_param.h:300
Sort_param & operator=(const Sort_param &)=delete
ha_rows max_rows
Definition: sort_param.h:303
bool use_hash
Definition: sort_param.h:304
uchar * get_start_of_payload(uchar *p) const
Skips the key part, and returns address of payload.
Definition: sort_param.h:410
bool using_varlen_keys() const
Are we using varlen key fields?
Definition: sort_param.h:374
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:381
const char * p
Definition: ctype-mb.cc:1236
Dialog Client Authentication nullptr
Definition: dialog.cc:352
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:57
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1138
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
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:492
uchar * get_start_of_payload(const Filesort_info *fsi, uchar *p)
Definition: sort_param.h:486
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:1394
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
unsigned int uint
Definition: uca-dump.cc:29
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:38