MySQL  8.0.20
Source Code Documentation
basic_row_iterators.h
Go to the documentation of this file.
1 #ifndef SQL_BASIC_ROW_ITERATORS_H_
2 #define SQL_BASIC_ROW_ITERATORS_H_
3 
4 /* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License, version 2.0,
8  as published by the Free Software Foundation.
9 
10  This program is also distributed with certain software (including
11  but not limited to OpenSSL) that is licensed under separate terms,
12  as designated in a particular file or component or in included license
13  documentation. The authors of MySQL hereby grant you an additional
14  permission to link the program and your derivative works with the
15  separately licensed software that they have included with MySQL.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License, version 2.0, for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 
26 /**
27  @file
28  Row iterators that scan a single table without reference to other tables
29  or iterators.
30  */
31 
32 #include <sys/types.h>
33 #include <memory>
34 
35 #include "map_helpers.h"
36 #include "my_alloc.h"
37 #include "my_base.h"
38 #include "my_inttypes.h"
39 #include "sql/mem_root_array.h"
40 #include "sql/row_iterator.h"
41 #include "sql/sql_list.h"
42 
43 class Filesort_info;
44 class Item;
45 class QEP_TAB;
46 class QUICK_SELECT_I;
47 class Sort_result;
48 class THD;
49 class handler;
50 struct IO_CACHE;
51 struct TABLE;
52 
53 /**
54  Scan a table from beginning to end.
55 
56  This is the most basic access method of a table using rnd_init,
57  ha_rnd_next and rnd_end. No indexes are used.
58  */
60  public:
61  // Accepts nullptr for qep_tab; qep_tab is used only for setting up record
62  // buffers.
63  //
64  // The pushed condition can be nullptr.
65  //
66  // "examined_rows", if not nullptr, is incremented for each successful Read().
68  ha_rows *examined_rows);
69  ~TableScanIterator() override;
70 
71  bool Init() override;
72  int Read() override;
73 
74  std::vector<std::string> DebugString() const override;
75 
76  private:
77  uchar *const m_record;
80 };
81 
82 /** Perform a full index scan along an index. */
83 template <bool Reverse>
85  public:
86  // use_order must be set to true if you actually need to get the records
87  // back in index order. It can be set to false if you wish to scan
88  // using the index (e.g. for an index-only scan of the entire table),
89  // but do not actually care about the order. In particular, partitioned
90  // tables can use this to deliver more efficient scans.
91  //
92  // Accepts nullptr for qep_tab; qep_tab is used only for setting up record
93  // buffers.
94  //
95  // The pushed condition can be nullptr.
96  //
97  // "examined_rows", if not nullptr, is incremented for each successful Read().
98  IndexScanIterator(THD *thd, TABLE *table, int idx, bool use_order,
99  QEP_TAB *qep_tab, ha_rows *examined_rows);
100  ~IndexScanIterator() override;
101 
102  bool Init() override;
103  int Read() override;
104  std::vector<std::string> DebugString() const override;
105 
106  private:
107  uchar *const m_record;
108  const int m_idx;
109  const bool m_use_order;
112  bool m_first = true;
113 };
114 
115 /**
116  Scan a given range of the table (a “quick”), using an index.
117 
118  IndexRangeScanIterator uses one of the QUICK_SELECT classes in opt_range.cc
119  to perform an index scan. There are loads of functionality hidden
120  in these quick classes. It handles all index scans of various kinds.
121 
122  TODO: Convert the QUICK_SELECT framework to RowIterator, so that
123  we do not need this adapter.
124  */
126  public:
127  // Does _not_ take ownership of "quick" (but maybe it should).
128  //
129  // Accepts nullptr for qep_tab; qep_tab is used only for setting up record
130  // buffers.
131  //
132  // The pushed condition can be nullptr.
133  //
134  // "examined_rows", if not nullptr, is incremented for each successful Read().
136  QEP_TAB *qep_tab, ha_rows *examined_rows);
137 
138  bool Init() override;
139  int Read() override;
140  std::vector<std::string> DebugString() const override;
141 
142  private:
143  // NOTE: No destructor; quick_range will call ha_index_or_rnd_end() for us.
147 
148  // After m_quick has returned EOF, some of its members are destroyed, making
149  // subsequent requests for new rows undefined. We flag EOF so that the
150  // iterator does not request a new row.
151  bool m_seen_eof{false};
152 };
153 
154 // Readers relating to reading sorted data (from filesort).
155 //
156 // Filesort will produce references to the records sorted; these
157 // references can be stored in memory or in a temporary file.
158 //
159 // The temporary file is normally used when the references doesn't fit into
160 // a properly sized memory buffer. For most small queries the references
161 // are stored in the memory buffer.
162 //
163 // The temporary file is also used when performing an update where a key is
164 // modified.
165 
166 /**
167  Fetch the records from a memory buffer.
168 
169  This method is used when table->sort.addon_field is allocated.
170  This is allocated for most SELECT queries not involving any BLOB's.
171  In this case the records are fetched from a memory buffer.
172  */
173 template <bool Packed_addon_fields>
175  public:
176  // "examined_rows", if not nullptr, is incremented for each successful Read().
177  // The table is used solely for NULL row flags.
179  Sort_result *sort_result, ha_rows *examined_rows);
180  ~SortBufferIterator() override;
181 
182  bool Init() override;
183  int Read() override;
184  std::vector<std::string> DebugString() const override;
185  void UnlockRow() override {}
186 
187  private:
188  // NOTE: No m_record -- unpacks directly into each Field's field->ptr.
193 };
194 
195 /**
196  Fetch the record IDs from a memory buffer, but the records themselves from
197  the table on disk.
198 
199  Used when the above (comment on SortBufferIterator) is not true, UPDATE,
200  DELETE and so forth and SELECT's involving large BLOBs. It is also used for
201  the result of Unique, which returns row IDs in the same format as filesort.
202  In this case the record data is fetched from the handler using the saved
203  reference using the rnd_pos handler call.
204  */
206  public:
207  // Ownership here is suboptimal: Takes only partial ownership of
208  // "sort_result", so it must be alive for as long as the RowIterator is.
209  // However, it _does_ free the buffers within on destruction.
210  //
211  // The pushed condition can be nullptr.
212  //
213  // "examined_rows", if not nullptr, is incremented for each successful Read().
215  bool ignore_not_found_rows,
216  ha_rows *examined_rows);
217  ~SortBufferIndirectIterator() override;
218  bool Init() override;
219  int Read() override;
220  std::vector<std::string> DebugString() const override;
221 
222  private:
226  uchar *m_record = nullptr;
227  uchar *m_cache_pos = nullptr, *m_cache_end = nullptr;
229 };
230 
231 /**
232  Fetch the records from a tempoary file.
233 
234  There used to be a comment here saying “should obviously not really happen
235  other than in strange configurations”, but especially with packed addons
236  and InnoDB (where fetching rows needs a primary key lookup), it's not
237  necessarily suboptimal compared to e.g. SortBufferIndirectIterator.
238  */
239 template <bool Packed_addon_fields>
241  public:
242  // Takes ownership of tempfile.
243  // The table is used solely for NULL row flags.
244  SortFileIterator(THD *thd, TABLE *table, IO_CACHE *tempfile,
245  Filesort_info *sort, ha_rows *examined_rows);
246  ~SortFileIterator() override;
247 
248  bool Init() override { return false; }
249  int Read() override;
250  std::vector<std::string> DebugString() const override;
251  void UnlockRow() override {}
252 
253  private:
254  uchar *const m_rec_buf;
259 };
260 
261 /**
262  Fetch the record IDs from a temporary file, then the records themselves from
263  the table on disk.
264 
265  Same as SortBufferIndirectIterator except that references are fetched
266  from temporary file instead of from a memory buffer. So first the record IDs
267  are read from file, then those record IDs are used to look up rows in the
268  table.
269  */
271  public:
272  // Takes ownership of tempfile.
273  //
274  // The pushed condition can be nullptr.
275  //
276  // "examined_rows", if not nullptr, is incremented for each successful Read().
278  bool request_cache, bool ignore_not_found_rows,
279  ha_rows *examined_rows);
280  ~SortFileIndirectIterator() override;
281 
282  bool Init() override;
283  int Read() override;
284  std::vector<std::string> DebugString() const override;
285 
286  private:
287  bool InitCache();
288  int CachedRead();
289  int UncachedRead();
290 
291  IO_CACHE *m_io_cache = nullptr;
293  uchar *m_record = nullptr;
294  uchar *m_ref_pos = nullptr; /* pointer to form->refpos */
296 
297  // This is a special variant that can be used for
298  // handlers that is not using the HA_FAST_KEY_READ table flag. Instead
299  // of reading the references one by one from the temporary file it reads
300  // a set of them, sorts them and reads all of them into a buffer which
301  // is then used for a number of subsequent calls to Read().
302  // It is only used for SELECT queries and a number of other conditions
303  // on table size.
306  uint m_ref_length, m_struct_length, m_reclength, m_rec_cache_size,
307  m_error_offset;
309  uchar *m_cache_pos = nullptr, *m_cache_end = nullptr,
310  *m_read_positions = nullptr;
311 };
312 
313 // Used when the plan is const, ie. is known to contain a single row
314 // (and all values have been read in advance, so we don't need to read
315 // a single table).
317  public:
318  // "examined_rows", if not nullptr, is incremented for each successful Read().
320  : RowIterator(thd), m_examined_rows(examined_rows) {}
321 
322  bool Init() override {
323  m_has_row = true;
324  return false;
325  }
326 
327  int Read() override {
328  if (m_has_row) {
329  m_has_row = false;
330  if (m_examined_rows != nullptr) {
331  ++*m_examined_rows;
332  }
333  return 0;
334  } else {
335  return -1;
336  }
337  }
338 
339  std::vector<std::string> DebugString() const override {
340  return {"Rows fetched before execution"};
341  }
342 
343  void SetNullRowFlag(bool is_null_row MY_ATTRIBUTE((unused))) override {
344  DBUG_ASSERT(!is_null_row);
345  }
346 
347  void UnlockRow() override {}
348 
349  private:
350  bool m_has_row;
352 };
353 
354 /**
355  An iterator for unqualified COUNT(*) (ie., no WHERE, no join conditions,
356  etc.), taking a special fast path in the handler. It returns a single row,
357  much like FakeSingleRowIterator; however, unlike said iterator, it actually
358  does the counting in Read() instead of expecting all fields to already be
359  filled out.
360  */
362  public:
364  : RowIterator(thd), m_join(join) {}
365 
366  std::vector<std::string> DebugString() const override;
367 
368  bool Init() override {
369  m_has_row = true;
370  return false;
371  }
372 
373  int Read() override;
374 
375  void SetNullRowFlag(bool) override { DBUG_ASSERT(false); }
376 
377  void UnlockRow() override {}
378 
379  private:
380  bool m_has_row;
381  JOIN *const m_join;
382 };
383 
384 /**
385  A simple iterator that takes no input and produces zero output rows.
386  Used when the optimizer has figured out ahead of time that a given table
387  can produce no output (e.g. SELECT ... WHERE 2+2 = 5).
388 
389  The child iterator is optional (can be nullptr) if SetNullRowFlag() is
390  not to be called. It is used when a subtree used on the inner side of an
391  outer join is found to be never executable, and replaced with a
392  ZeroRowsIterator; in that case, we need to forward the SetNullRowFlag call
393  to it. This child is not printed as part of the iterator tree.
394  */
396  public:
397  ZeroRowsIterator(THD *thd, const char *reason,
399  : RowIterator(thd),
400  m_reason(reason),
401  m_child_iterator(std::move(child_iterator)) {}
402 
403  bool Init() override { return false; }
404 
405  int Read() override { return -1; }
406 
407  std::vector<std::string> DebugString() const override {
408  return {std::string("Zero rows (") + m_reason + ")"};
409  }
410 
411  void SetNullRowFlag(bool is_null_row) override {
412  DBUG_ASSERT(m_child_iterator != nullptr);
413  m_child_iterator->SetNullRowFlag(is_null_row);
414  }
415 
416  void UnlockRow() override {}
417 
418  private:
419  const char *m_reason;
421 };
422 
423 class SELECT_LEX;
424 
425 /**
426  Like ZeroRowsIterator, but produces a single output row, since there are
427  aggregation functions present and no GROUP BY. E.g.,
428 
429  SELECT SUM(f1) FROM t1 WHERE 2+2 = 5;
430 
431  should produce a single row, containing only the value NULL.
432  */
434  public:
435  // "examined_rows", if not nullptr, is incremented for each successful Read().
436  ZeroRowsAggregatedIterator(THD *thd, const char *reason, JOIN *join,
437  ha_rows *examined_rows)
438  : RowIterator(thd),
439  m_reason(reason),
440  m_join(join),
441  m_examined_rows(examined_rows) {}
442 
443  bool Init() override {
444  m_has_row = true;
445  return false;
446  }
447 
448  int Read() override;
449 
450  std::vector<std::string> DebugString() const override {
451  return {std::string("Zero input rows (") + m_reason +
452  "), aggregated into one output row"};
453  }
454 
455  void SetNullRowFlag(bool) override { DBUG_ASSERT(false); }
456 
457  void UnlockRow() override {}
458 
459  private:
460  bool m_has_row;
461  const char *const m_reason;
462  JOIN *const m_join;
464 };
465 
466 /**
467  FollowTailIterator is a special version of TableScanIterator that is used
468  as part of WITH RECURSIVE queries. It is designed to read from a temporary
469  table at the same time as MaterializeIterator writes to the same table,
470  picking up new records in the order they come in -- it follows the tail,
471  much like the UNIX tool “tail -f”.
472 
473  Furthermore, when materializing a recursive query expression consisting of
474  multiple query blocks, MaterializeIterator needs to run each block several
475  times until convergence. (For a single query block, one iteration suffices,
476  since the iterator sees new records as they come in.) Each such run, the
477  recursive references should see only rows that were added since the last
478  iteration, even though Init() is called anew. FollowTailIterator is thus
479  different from TableScanIterator in that subsequent calls to Init() do not
480  move the cursor back to the start.
481 
482  In addition, FollowTailIterator implements the WITH RECURSIVE iteration limit.
483  This is not specified in terms of Init() calls, since one run can encompass
484  many iterations. Instead, it keeps track of the number of records in the table
485  at the start of iteration, and when it has read all of those records, the next
486  iteration is deemed to have begun. If the iteration counter is above the
487  user-set limit, it raises an error to stop runaway queries with infinite
488  recursion.
489  */
491  public:
492  // "examined_rows", if not nullptr, is incremented for each successful Read().
494  ha_rows *examined_rows);
495  ~FollowTailIterator() override;
496 
497  bool Init() override;
498  int Read() override;
499 
500  std::vector<std::string> DebugString() const override;
501 
502  /**
503  Signal where we can expect to find the number of generated rows for this
504  materialization (this points into the MaterializeIterator's data).
505 
506  This must be called when we start materializing the CTE,
507  before Init() runs.
508  */
509  void set_stored_rows_pointer(ha_rows *stored_rows) {
510  m_stored_rows = stored_rows;
511  }
512 
513  /**
514  Signal to the iterator that the underlying table was closed and replaced
515  with an InnoDB table with the same data, due to a spill-to-disk
516  (e.g. the table used to be MEMORY and now is InnoDB). This is
517  required so that Read() can continue scanning from the right place.
518  Called by MaterializeIterator::MaterializeRecursive().
519  */
520  bool RepositionCursorAfterSpillToDisk();
521 
522  private:
523  uchar *const m_record;
529 
530  // Points into MaterializeIterator's data; set by BeginMaterialization() only.
531  ha_rows *m_stored_rows = nullptr;
532 };
533 
534 /**
535  TableValueConstructor is the iterator for the table value constructor case of
536  a query_primary (i.e. queries of the form VALUES row_list; e.g. VALUES ROW(1,
537  10), ROW(2, 20)).
538 
539  The iterator is passed the field list of its parent JOIN object, which may
540  contain Item_values_column objects that are created during
541  SELECT_LEX::prepare_values(). This is required so that Read() can replace the
542  currently selected row by simply changing the references of Item_values_column
543  objects to the next row.
544 
545  The iterator must output multiple rows without being materialized, and does
546  not scan any tables. The indirection of Item_values_column is required, as the
547  executor outputs what is contained in join->fields (either directly, or
548  indirectly through ConvertItemsToCopy), and is thus responsible for ensuring
549  that join->fields contains the correct next row.
550  */
552  public:
553  TableValueConstructorIterator(THD *thd, ha_rows *examined_rows,
554  const List<List<Item>> &row_value_list,
555  List<Item> *join_fields);
556 
557  bool Init() override;
558  int Read() override;
559 
560  std::vector<std::string> DebugString() const override {
561  return {"Rows fetched before execution"};
562  }
563 
564  void SetNullRowFlag(bool) override { DBUG_ASSERT(false); }
565 
566  void UnlockRow() override {}
567 
568  private:
569  ha_rows *const m_examined_rows{nullptr};
570 
571  /// Contains the row values that are part of a VALUES clause. Read() will
572  /// modify contained Item objects during execution by calls to is_null() and
573  /// the required val function to extract its value.
576 
577  /// References to the row we currently want to output. When multiple rows must
578  /// be output, this contains Item_values_column objects. In this case, each
579  /// call to Read() will replace its current reference with the next row.
581 };
582 
583 #endif // SQL_BASIC_ROW_ITERATORS_H_
const int m_idx
Definition: basic_row_iterators.h:108
Scan a table from beginning to end.
Definition: basic_row_iterators.h:59
unsigned char uchar
Definition: my_inttypes.h:51
Definition: sql_optimizer.h:175
Definition: row_iterator.h:263
void UnlockRow() override
Definition: basic_row_iterators.h:457
Fetch the records from a memory buffer.
Definition: basic_row_iterators.h:174
Fetch the record IDs from a memory buffer, but the records themselves from the table on disk...
Definition: basic_row_iterators.h:205
std::vector< std::string > DebugString() const override
Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterato...
Definition: basic_row_iterators.h:450
bool m_has_row
Definition: basic_row_iterators.h:460
UnqualifiedCountIterator(THD *thd, JOIN *join)
Definition: basic_row_iterators.h:363
void UnlockRow() override
Definition: basic_row_iterators.h:566
unsigned m_recursive_iteration_count
Definition: basic_row_iterators.h:528
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:292
Some integer typedefs for easier portability.
bool Init() override
Initialize or reinitialize the iterator.
Definition: records.cc:402
std::unique_ptr< T, My_free_deleter > unique_ptr_my_free
std::unique_ptr, but with my_free as deleter.
Definition: map_helpers.h:126
A context for reading through a single table using a chosen access method: index read, scan, etc, use of cache, etc.
Definition: row_iterator.h:61
IO_CACHE *const m_io_cache
Definition: basic_row_iterators.h:256
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:997
JOIN *const m_join
Definition: basic_row_iterators.h:381
void UnlockRow() override
Definition: basic_row_iterators.h:347
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:223
std::string join(Container cont, const std::string &delim)
join elements of an container into a string seperated by a delimiter.
Definition: string.h:144
Definition: varlen_sort.h:182
Definition: sql_list.h:435
JOIN *const m_join
Definition: basic_row_iterators.h:462
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:443
Scan a given range of the table (a “quick”), using an index.
Definition: basic_row_iterators.h:125
int Read() override
Read a single row.
Definition: basic_row_iterators.h:327
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:192
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:3986
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:146
int Read() override
Read a single row.
Definition: basic_row_iterators.h:405
void UnlockRow() override
Definition: basic_row_iterators.h:377
std::vector< std::string > DebugString() const override
Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterato...
Definition: basic_row_iterators.h:339
uint m_struct_length
Definition: basic_row_iterators.h:306
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:403
static bool quick
Definition: mysql.cc:153
Definition: table.h:1306
unique_ptr_my_free< uchar[]> m_cache
Definition: basic_row_iterators.h:308
void UnlockRow() override
Definition: basic_row_iterators.h:416
QUICK_SELECT_I *const m_quick
Definition: basic_row_iterators.h:144
An iterator for unqualified COUNT(*) (ie., no WHERE, no join conditions, etc.), taking a special fast...
Definition: basic_row_iterators.h:361
Fetch the record IDs from a temporary file, then the records themselves from the table on disk...
Definition: basic_row_iterators.h:270
bool m_has_row
Definition: basic_row_iterators.h:380
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:228
This file includes constants used by all storage engines.
Fetch the records from a tempoary file.
Definition: basic_row_iterators.h:240
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:463
#define DBUG_ASSERT(A)
Definition: my_dbug.h:199
unsigned m_unpack_counter
Definition: basic_row_iterators.h:191
void SetNullRowFlag(bool is_null_row) override
Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag...
Definition: basic_row_iterators.h:343
const bool m_use_order
Definition: basic_row_iterators.h:109
const uint m_ref_length
Definition: basic_row_iterators.h:224
ha_rows m_end_of_current_iteration
Definition: basic_row_iterators.h:527
const uint m_ref_length
Definition: basic_row_iterators.h:255
Perform a full index scan along an index.
Definition: basic_row_iterators.h:84
ZeroRowsIterator(THD *thd, const char *reason, unique_ptr_destroy_only< RowIterator > child_iterator)
Definition: basic_row_iterators.h:397
void SetNullRowFlag(bool) override
Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag...
Definition: basic_row_iterators.h:455
TABLE * table() const
Definition: row_iterator.h:275
QEP_TAB *const m_qep_tab
Definition: basic_row_iterators.h:78
Definition: aggregate_check.h:523
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:351
ha_rows m_read_rows
Definition: basic_row_iterators.h:526
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:525
Definition: my_sys.h:337
std::vector< std::string > DebugString() const override
Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterato...
Definition: basic_row_iterators.h:560
void UnlockRow() override
Definition: basic_row_iterators.h:185
Like ZeroRowsIterator, but produces a single output row, since there are aggregation functions presen...
Definition: basic_row_iterators.h:433
Definition: item.h:740
unsigned int uint
Definition: uca-dump.cc:29
#define final(a, b, c)
Definition: hash.c:109
void SetNullRowFlag(bool) override
Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag...
Definition: basic_row_iterators.h:375
FollowTailIterator is a special version of TableScanIterator that is used as part of WITH RECURSIVE q...
Definition: basic_row_iterators.h:490
void UnlockRow() override
Definition: basic_row_iterators.h:251
TableValueConstructor is the iterator for the table value constructor case of a query_primary (i...
Definition: basic_row_iterators.h:551
THD * thd() const
Definition: row_iterator.h:254
bool m_using_cache
Definition: basic_row_iterators.h:304
unique_ptr_destroy_only< RowIterator > m_child_iterator
Definition: basic_row_iterators.h:420
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:111
Definition: sql_executor.h:270
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:408
Definition: sql_sort.h:141
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:79
void SetNullRowFlag(bool) override
Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag...
Definition: basic_row_iterators.h:564
Filesort_info *const m_sort
Definition: basic_row_iterators.h:189
QEP_TAB *const m_qep_tab
Definition: basic_row_iterators.h:145
Definition: basic_row_iterators.h:316
void SetNullRowFlag(bool is_null_row) override
Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag...
Definition: basic_row_iterators.h:411
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:322
const char * m_reason
Definition: basic_row_iterators.h:419
QEP_TAB *const m_qep_tab
Definition: basic_row_iterators.h:110
A simple iterator that takes no input and produces zero output rows.
Definition: basic_row_iterators.h:395
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:368
uchar *const m_rec_buf
Definition: basic_row_iterators.h:254
A class wrapping misc buffers used for sorting.
Definition: sql_sort.h:174
Definition: opt_range.h:229
std::vector< std::string > DebugString() const override
Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterato...
Definition: basic_row_iterators.h:407
int Read() override
Read a single row.
Definition: records.cc:421
const char *const m_reason
Definition: basic_row_iterators.h:461
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:190
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:225
uchar *const m_record
Definition: basic_row_iterators.h:523
QEP_TAB *const m_qep_tab
Definition: basic_row_iterators.h:524
~TableScanIterator() override
Definition: records.cc:396
uint m_cache_records
Definition: basic_row_iterators.h:305
ZeroRowsAggregatedIterator(THD *thd, const char *reason, JOIN *join, ha_rows *examined_rows)
Definition: basic_row_iterators.h:436
bool m_has_row
Definition: basic_row_iterators.h:350
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:248
TableScanIterator(THD *thd, TABLE *table, QEP_TAB *qep_tab, ha_rows *examined_rows)
Definition: records.cc:389
std::vector< std::string > DebugString() const override
Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterato...
Definition: records.cc:437
void set_stored_rows_pointer(ha_rows *stored_rows)
Signal where we can expect to find the number of generated rows for this materialization (this points...
Definition: basic_row_iterators.h:509
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:258
List_STL_Iterator< const List< Item > > m_row_it
Definition: basic_row_iterators.h:575
FakeSingleRowIterator(THD *thd, ha_rows *examined_rows)
Definition: basic_row_iterators.h:319
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:295
my_off_t ha_rows
Definition: my_base.h:1132
uchar *const m_record
Definition: basic_row_iterators.h:77
Filesort_info *const m_sort
Definition: basic_row_iterators.h:257
List< Item > *const m_output_refs
References to the row we currently want to output.
Definition: basic_row_iterators.h:580
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:765
const List< List< Item > > & m_row_value_list
Contains the row values that are part of a VALUES clause.
Definition: basic_row_iterators.h:574
uchar *const m_record
Definition: basic_row_iterators.h:107