1#ifndef SQL_ITERATORS_BASIC_ROW_ITERATORS_H_
2#define SQL_ITERATORS_BASIC_ROW_ITERATORS_H_
100template <
bool Reverse>
116 double expected_rows,
ha_rows *examined_rows);
119 bool Init()
override;
150template <
bool Packed_addon_fields>
160 bool Init()
override;
198 bool ignore_not_found_rows,
bool has_null_flags,
201 bool Init()
override;
227template <
bool Packed_addon_fields>
236 bool Init()
override {
return false; }
270 IO_CACHE *tempfile,
bool ignore_not_found_rows,
271 bool has_null_flags,
ha_rows *examined_rows);
274 bool Init()
override;
320 assert(!is_null_row);
372 bool Init()
override {
return false; }
374 int Read()
override {
return -1; }
446 bool Init()
override;
506 bool Init()
override;
551 assert(idx == 0 || idx == 1);
552 return data.m_value[idx];
Definition: basic_row_iterators.h:296
int Read() override
Read a single row.
Definition: basic_row_iterators.h:307
void UnlockRow() override
Definition: basic_row_iterators.h:323
bool m_has_row
Definition: basic_row_iterators.h:326
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:327
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:302
FakeSingleRowIterator(THD *thd, ha_rows *examined_rows)
Definition: basic_row_iterators.h:299
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:319
A class wrapping misc buffers used for sorting.
Definition: sql_sort.h:189
FollowTailIterator is a special version of TableScanIterator that is used as part of WITH RECURSIVE q...
Definition: basic_row_iterators.h:439
bool RepositionCursorAfterSpillToDisk()
Signal to the iterator that the underlying table was closed and replaced with an InnoDB table with th...
Definition: basic_row_iterators.cc:433
FollowTailIterator(THD *thd, TABLE *table, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:294
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:473
unsigned m_recursive_iteration_count
Definition: basic_row_iterators.h:476
const double m_expected_rows
Definition: basic_row_iterators.h:472
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:308
bool m_inited
Definition: basic_row_iterators.h:470
uchar *const m_record
Definition: basic_row_iterators.h:471
ha_rows * m_stored_rows
Definition: basic_row_iterators.h:479
ha_rows m_read_rows
Definition: basic_row_iterators.h:474
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:358
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:456
~FollowTailIterator() override
Definition: basic_row_iterators.cc:302
ha_rows m_end_of_current_iteration
Definition: basic_row_iterators.h:475
Auxiliary class to squeeze two 32 bits integers into a 64 bits one, cf.
Definition: basic_row_iterators.h:539
HalfCounter(uint64_t packed)
Definition: basic_row_iterators.h:548
uint64_t value() const
Definition: basic_row_iterators.h:549
union HalfCounter::@53 data
uint32_t & operator[](size_t idx)
Definition: basic_row_iterators.h:550
uint32_t m_value[2]
[0]: # of duplicates on left side of INTERSECT ALL [1]: # of duplicates on right side of INTERSECT AL...
Definition: basic_row_iterators.h:543
uint64_t m_value64
Definition: basic_row_iterators.h:544
Perform a full index scan along an index.
Definition: basic_row_iterators.h:101
const int m_idx
Definition: basic_row_iterators.h:124
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:127
int Read() override
Read a single row.
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:77
IndexScanIterator(THD *thd, TABLE *table, int idx, bool use_order, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:58
uchar *const m_record
Definition: basic_row_iterators.h:123
~IndexScanIterator() override
Definition: basic_row_iterators.cc:70
const bool m_use_order
Definition: basic_row_iterators.h:125
const double m_expected_rows
Definition: basic_row_iterators.h:126
bool m_first
Definition: basic_row_iterators.h:128
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
Definition: sql_optimizer.h:133
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
A context for reading through a single table using a chosen access method: index read,...
Definition: row_iterator.h:82
THD * thd() const
Definition: row_iterator.h:228
Fetch the record IDs from a memory buffer, but the records themselves from the table on disk.
Definition: basic_row_iterators.h:187
uchar * m_cache_end
Definition: basic_row_iterators.h:214
bool m_has_null_flags
Definition: basic_row_iterators.h:216
SortBufferIndirectIterator(THD *thd, Mem_root_array< TABLE * > tables, Sort_result *sort_result, bool ignore_not_found_rows, bool has_null_flags, ha_rows *examined_rows)
Definition: sorting_iterator.cc:309
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:213
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:215
void UnlockRow() override
Definition: basic_row_iterators.h:207
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:329
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:211
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:203
uint m_sum_ref_length
Definition: basic_row_iterators.h:212
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:210
uchar * m_cache_pos
Definition: basic_row_iterators.h:214
~SortBufferIndirectIterator() override
Definition: sorting_iterator.cc:319
int Read() override
Read a single row.
Definition: sorting_iterator.cc:362
Fetch the records from a memory buffer.
Definition: basic_row_iterators.h:151
void UnlockRow() override
Definition: basic_row_iterators.h:162
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:271
unsigned m_unpack_counter
Definition: basic_row_iterators.h:172
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:171
~SortBufferIterator() override
Definition: sorting_iterator.cc:265
int Read() override
Read a result set record from a buffer after sorting.
Definition: sorting_iterator.cc:295
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:163
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:173
SortBufferIterator(THD *thd, Mem_root_array< TABLE * > tables, Filesort_info *sort, Sort_result *sort_result, ha_rows *examined_rows)
Definition: sorting_iterator.cc:255
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:174
Filesort_info *const m_sort
Definition: basic_row_iterators.h:170
Fetch the record IDs from a temporary file, then the records themselves from the table on disk.
Definition: basic_row_iterators.h:262
int Read() override
Read a single row.
Definition: sorting_iterator.cc:156
IO_CACHE * m_io_cache
Definition: basic_row_iterators.h:283
~SortFileIndirectIterator() override
Definition: sorting_iterator.cc:96
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:285
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:284
bool m_has_null_flags
Definition: basic_row_iterators.h:288
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:287
SortFileIndirectIterator(THD *thd, Mem_root_array< TABLE * > tables, IO_CACHE *tempfile, bool ignore_not_found_rows, bool has_null_flags, ha_rows *examined_rows)
Definition: sorting_iterator.cc:86
void UnlockRow() override
Definition: basic_row_iterators.h:280
uint m_sum_ref_length
Definition: basic_row_iterators.h:290
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:105
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:276
uchar * m_ref_pos
Definition: basic_row_iterators.h:286
Fetch the records from a tempoary file.
Definition: basic_row_iterators.h:228
int Read() override
Read a result set record from a temporary file after sorting.
Definition: sorting_iterator.cc:228
const uint m_buf_length
Definition: basic_row_iterators.h:246
void UnlockRow() override
Definition: basic_row_iterators.h:238
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:250
uchar *const m_rec_buf
Definition: basic_row_iterators.h:245
IO_CACHE *const m_io_cache
Definition: basic_row_iterators.h:248
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:239
Filesort_info *const m_sort
Definition: basic_row_iterators.h:249
SortFileIterator(THD *thd, Mem_root_array< TABLE * > tables, IO_CACHE *tempfile, Filesort_info *sort, ha_rows *examined_rows)
Definition: sorting_iterator.cc:195
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:247
~SortFileIterator() override
Definition: sorting_iterator.cc:207
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:236
Definition: sql_sort.h:156
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Definition: row_iterator.h:234
TABLE * table() const
Definition: row_iterator.h:246
Scan a table from beginning to end.
Definition: basic_row_iterators.h:56
const double m_expected_rows
Definition: basic_row_iterators.h:79
uchar *const m_record
Definition: basic_row_iterators.h:78
const ha_rows m_limit_rows
Used for EXCEPT and INTERSECT only: we cannot enforce limit during materialization as for UNION and s...
Definition: basic_row_iterators.h:93
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:80
ulonglong m_remaining_dups
Used to keep track of how many more duplicates of the last read row that remains to be written to the...
Definition: basic_row_iterators.h:89
ha_rows m_stored_rows
Used for EXCEPT and INTERSECT only: rows scanned so far, see also m_limit_rows.
Definition: basic_row_iterators.h:96
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:193
TableScanIterator(THD *thd, TABLE *table, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:177
~TableScanIterator() override
Definition: basic_row_iterators.cc:187
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:217
TableValueConstructor is the iterator for the table value constructor case of a query_primary (i....
Definition: basic_row_iterators.h:499
const mem_root_deque< mem_root_deque< Item * > * > & m_row_value_list
Contains the row values that are part of a VALUES clause.
Definition: basic_row_iterators.h:519
mem_root_deque< mem_root_deque< Item * > * >::const_iterator m_row_it
Definition: basic_row_iterators.h:520
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:920
bool Init() override
Initialize or reinitialize the iterator.
Definition: ref_row_iterators.cc:915
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:509
mem_root_deque< Item * > *const m_output_refs
References to the row we currently want to output.
Definition: basic_row_iterators.h:525
TableValueConstructorIterator(THD *thd, ha_rows *examined_rows, const mem_root_deque< mem_root_deque< Item * > * > &row_value_list, mem_root_deque< Item * > *join_fields)
Definition: ref_row_iterators.cc:904
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:514
void UnlockRow() override
Definition: basic_row_iterators.h:511
An iterator for unqualified COUNT(*) (ie., no WHERE, no join conditions, etc.), taking a special fast...
Definition: basic_row_iterators.h:337
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:846
void UnlockRow() override
Definition: basic_row_iterators.h:351
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:342
UnqualifiedCountIterator(THD *thd, JOIN *join)
Definition: basic_row_iterators.h:339
bool m_has_row
Definition: basic_row_iterators.h:354
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:349
JOIN *const m_join
Definition: basic_row_iterators.h:355
Like ZeroRowsIterator, but produces a single output row, since there are aggregation functions presen...
Definition: basic_row_iterators.h:392
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:875
JOIN *const m_join
Definition: basic_row_iterators.h:411
bool m_has_row
Definition: basic_row_iterators.h:410
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:412
ZeroRowsAggregatedIterator(THD *thd, JOIN *join, ha_rows *examined_rows)
Definition: basic_row_iterators.h:395
void UnlockRow() override
Definition: basic_row_iterators.h:407
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:398
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:405
A simple iterator that takes no input and produces zero output rows.
Definition: basic_row_iterators.h:368
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:372
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.cc:283
int Read() override
Read a single row.
Definition: basic_row_iterators.h:374
void UnlockRow() override
Definition: basic_row_iterators.h:378
ZeroRowsIterator(THD *thd, Mem_root_array< TABLE * > pruned_tables)
Definition: basic_row_iterators.cc:279
const Mem_root_array< TABLE * > m_pruned_tables
Definition: basic_row_iterators.h:381
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:110
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:151
unsigned int uint
Definition: uca9-dump.cc:75