1#ifndef SQL_ITERATORS_BASIC_ROW_ITERATORS_H_
2#define SQL_ITERATORS_BASIC_ROW_ITERATORS_H_
102template <
bool Reverse>
118 double expected_rows,
ha_rows *examined_rows);
121 bool Init()
override;
150 bool Init()
override;
181template <
bool Packed_addon_fields>
191 bool Init()
override;
229 bool ignore_not_found_rows,
bool has_null_flags,
232 bool Init()
override;
258template <
bool Packed_addon_fields>
267 bool Init()
override {
return false; }
301 IO_CACHE *tempfile,
bool ignore_not_found_rows,
302 bool has_null_flags,
ha_rows *examined_rows);
305 bool Init()
override;
351 assert(!is_null_row);
403 bool Init()
override {
return false; }
405 int Read()
override {
return -1; }
477 bool Init()
override;
537 bool Init()
override;
583 assert(idx == 0 || idx == 1);
584 return data.m_value[idx];
Definition: basic_row_iterators.h:327
int Read() override
Read a single row.
Definition: basic_row_iterators.h:338
void UnlockRow() override
Definition: basic_row_iterators.h:354
bool m_has_row
Definition: basic_row_iterators.h:357
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:358
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:333
FakeSingleRowIterator(THD *thd, ha_rows *examined_rows)
Definition: basic_row_iterators.h:330
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:350
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:470
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:491
FollowTailIterator(THD *thd, TABLE *table, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:352
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:504
unsigned m_recursive_iteration_count
Definition: basic_row_iterators.h:507
const double m_expected_rows
Definition: basic_row_iterators.h:503
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:366
bool m_inited
Definition: basic_row_iterators.h:501
uchar *const m_record
Definition: basic_row_iterators.h:502
ha_rows * m_stored_rows
Definition: basic_row_iterators.h:510
ha_rows m_read_rows
Definition: basic_row_iterators.h:505
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:416
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:487
~FollowTailIterator() override
Definition: basic_row_iterators.cc:360
ha_rows m_end_of_current_iteration
Definition: basic_row_iterators.h:506
Auxiliary class to squeeze two 32 bits integers into a 64 bits one, cf.
Definition: basic_row_iterators.h:571
HalfCounter(uint64_t packed)
Definition: basic_row_iterators.h:580
uint64_t value() const
Definition: basic_row_iterators.h:581
uint32_t & operator[](size_t idx)
Definition: basic_row_iterators.h:582
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:575
uint64_t m_value64
Definition: basic_row_iterators.h:576
union HalfCounter::@59 data
Perform a distance index scan along an index.
Definition: basic_row_iterators.h:138
QUICK_RANGE * m_query_mbr
Definition: basic_row_iterators.h:156
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:158
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:171
IndexDistanceScanIterator(THD *thd, TABLE *table, int idx, QUICK_RANGE *query_mbr, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:137
bool m_first
Definition: basic_row_iterators.h:159
const int m_idx
Definition: basic_row_iterators.h:155
uchar *const m_record
Definition: basic_row_iterators.h:154
const double m_expected_rows
Definition: basic_row_iterators.h:157
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:153
Perform a full index scan along an index.
Definition: basic_row_iterators.h:103
const int m_idx
Definition: basic_row_iterators.h:126
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:129
int Read() override
Read a single row.
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:78
IndexScanIterator(THD *thd, TABLE *table, int idx, bool use_order, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:59
uchar *const m_record
Definition: basic_row_iterators.h:125
~IndexScanIterator() override
Definition: basic_row_iterators.cc:71
const bool m_use_order
Definition: basic_row_iterators.h:127
const double m_expected_rows
Definition: basic_row_iterators.h:128
bool m_first
Definition: basic_row_iterators.h:130
Reference item that encapsulates both the type and the contained items of a single column of a VALUES...
Definition: item.h:7273
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
Definition: sql_optimizer.h:133
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Definition: range_optimizer.h:69
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:218
uchar * m_cache_end
Definition: basic_row_iterators.h:245
bool m_has_null_flags
Definition: basic_row_iterators.h:247
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:244
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:246
void UnlockRow() override
Definition: basic_row_iterators.h:238
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:329
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:242
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:234
uint m_sum_ref_length
Definition: basic_row_iterators.h:243
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:241
uchar * m_cache_pos
Definition: basic_row_iterators.h:245
~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:182
void UnlockRow() override
Definition: basic_row_iterators.h:193
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:271
unsigned m_unpack_counter
Definition: basic_row_iterators.h:203
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:202
~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:194
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:204
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:205
Filesort_info *const m_sort
Definition: basic_row_iterators.h:201
Fetch the record IDs from a temporary file, then the records themselves from the table on disk.
Definition: basic_row_iterators.h:293
int Read() override
Read a single row.
Definition: sorting_iterator.cc:156
IO_CACHE * m_io_cache
Definition: basic_row_iterators.h:314
~SortFileIndirectIterator() override
Definition: sorting_iterator.cc:96
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:316
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:315
bool m_has_null_flags
Definition: basic_row_iterators.h:319
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:318
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:311
uint m_sum_ref_length
Definition: basic_row_iterators.h:321
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:307
uchar * m_ref_pos
Definition: basic_row_iterators.h:317
Fetch the records from a tempoary file.
Definition: basic_row_iterators.h:259
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:277
void UnlockRow() override
Definition: basic_row_iterators.h:269
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:281
uchar *const m_rec_buf
Definition: basic_row_iterators.h:276
IO_CACHE *const m_io_cache
Definition: basic_row_iterators.h:279
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:270
Filesort_info *const m_sort
Definition: basic_row_iterators.h:280
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:278
~SortFileIterator() override
Definition: sorting_iterator.cc:207
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:267
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:36
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:58
const double m_expected_rows
Definition: basic_row_iterators.h:81
uchar *const m_record
Definition: basic_row_iterators.h:80
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:95
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:82
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:91
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:98
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:251
TableScanIterator(THD *thd, TABLE *table, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:235
~TableScanIterator() override
Definition: basic_row_iterators.cc:245
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:275
TableValueConstructor is the iterator for the table value constructor case of a query_primary (i....
Definition: basic_row_iterators.h:530
Mem_root_array< Item_values_column * > * m_output_refs
References to the row we currently want to output.
Definition: basic_row_iterators.h:557
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:550
mem_root_deque< mem_root_deque< Item * > * >::const_iterator m_row_it
Definition: basic_row_iterators.h:551
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:922
bool Init() override
Initialize or reinitialize the iterator.
Definition: ref_row_iterators.cc:917
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:540
TableValueConstructorIterator(THD *thd, ha_rows *examined_rows, const mem_root_deque< mem_root_deque< Item * > * > &row_value_list, Mem_root_array< Item_values_column * > *output_refs)
Definition: ref_row_iterators.cc:906
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:545
void UnlockRow() override
Definition: basic_row_iterators.h:542
An iterator for unqualified COUNT(*) (ie., no WHERE, no join conditions, etc.), taking a special fast...
Definition: basic_row_iterators.h:368
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:848
void UnlockRow() override
Definition: basic_row_iterators.h:382
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:373
UnqualifiedCountIterator(THD *thd, JOIN *join)
Definition: basic_row_iterators.h:370
bool m_has_row
Definition: basic_row_iterators.h:385
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:380
JOIN *const m_join
Definition: basic_row_iterators.h:386
Like ZeroRowsIterator, but produces a single output row, since there are aggregation functions presen...
Definition: basic_row_iterators.h:423
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:877
JOIN *const m_join
Definition: basic_row_iterators.h:442
bool m_has_row
Definition: basic_row_iterators.h:441
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:443
ZeroRowsAggregatedIterator(THD *thd, JOIN *join, ha_rows *examined_rows)
Definition: basic_row_iterators.h:426
void UnlockRow() override
Definition: basic_row_iterators.h:438
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:429
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:436
A simple iterator that takes no input and produces zero output rows.
Definition: basic_row_iterators.h:399
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:403
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:341
int Read() override
Read a single row.
Definition: basic_row_iterators.h:405
void UnlockRow() override
Definition: basic_row_iterators.h:409
ZeroRowsIterator(THD *thd, Mem_root_array< TABLE * > pruned_tables)
Definition: basic_row_iterators.cc:337
const Mem_root_array< TABLE * > m_pruned_tables
Definition: basic_row_iterators.h:412
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
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(const detail::range auto &rng, std::string_view delim)
join elements of a range into a string separated by a delimiter.
Definition: string.h:74