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;
151 bool Init()
override;
182template <
bool Packed_addon_fields>
192 bool Init()
override;
230 bool ignore_not_found_rows,
bool has_null_flags,
233 bool Init()
override;
259template <
bool Packed_addon_fields>
268 bool Init()
override {
return false; }
302 IO_CACHE *tempfile,
bool ignore_not_found_rows,
303 bool has_null_flags,
ha_rows *examined_rows);
306 bool Init()
override;
352 assert(!is_null_row);
404 bool Init()
override {
return false; }
406 int Read()
override {
return -1; }
478 bool Init()
override;
538 bool Init()
override;
584 assert(idx == 0 || idx == 1);
585 return data.m_value[idx];
Definition: basic_row_iterators.h:328
int Read() override
Read a single row.
Definition: basic_row_iterators.h:339
void UnlockRow() override
Definition: basic_row_iterators.h:355
bool m_has_row
Definition: basic_row_iterators.h:358
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:359
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:334
FakeSingleRowIterator(THD *thd, ha_rows *examined_rows)
Definition: basic_row_iterators.h:331
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:351
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:471
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:507
FollowTailIterator(THD *thd, TABLE *table, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:368
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:505
unsigned m_recursive_iteration_count
Definition: basic_row_iterators.h:508
const double m_expected_rows
Definition: basic_row_iterators.h:504
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:382
bool m_inited
Definition: basic_row_iterators.h:502
uchar *const m_record
Definition: basic_row_iterators.h:503
ha_rows * m_stored_rows
Definition: basic_row_iterators.h:511
ha_rows m_read_rows
Definition: basic_row_iterators.h:506
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:432
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:488
~FollowTailIterator() override
Definition: basic_row_iterators.cc:376
ha_rows m_end_of_current_iteration
Definition: basic_row_iterators.h:507
Auxiliary class to squeeze two 32 bits integers into a 64 bits one, cf.
Definition: basic_row_iterators.h:572
HalfCounter(uint64_t packed)
Definition: basic_row_iterators.h:581
union HalfCounter::@58 data
uint64_t value() const
Definition: basic_row_iterators.h:582
uint32_t & operator[](size_t idx)
Definition: basic_row_iterators.h:583
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:576
uint64_t m_value64
Definition: basic_row_iterators.h:577
Perform a distance index scan along an index.
Definition: basic_row_iterators.h:138
QUICK_RANGE * m_query_mbr
Definition: basic_row_iterators.h:157
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:159
~IndexDistanceScanIterator() override
Definition: basic_row_iterators.cc:153
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:187
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:160
const int m_idx
Definition: basic_row_iterators.h:156
uchar *const m_record
Definition: basic_row_iterators.h:155
const double m_expected_rows
Definition: basic_row_iterators.h:158
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.cc:161
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:7305
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:934
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:219
uchar * m_cache_end
Definition: basic_row_iterators.h:246
bool m_has_null_flags
Definition: basic_row_iterators.h:248
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:245
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:247
void UnlockRow() override
Definition: basic_row_iterators.h:239
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:329
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:243
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:235
uint m_sum_ref_length
Definition: basic_row_iterators.h:244
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:242
uchar * m_cache_pos
Definition: basic_row_iterators.h:246
~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:183
void UnlockRow() override
Definition: basic_row_iterators.h:194
bool Init() override
Initialize or reinitialize the iterator.
Definition: sorting_iterator.cc:271
unsigned m_unpack_counter
Definition: basic_row_iterators.h:204
Sort_result *const m_sort_result
Definition: basic_row_iterators.h:203
~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:195
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:205
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:206
Filesort_info *const m_sort
Definition: basic_row_iterators.h:202
Fetch the record IDs from a temporary file, then the records themselves from the table on disk.
Definition: basic_row_iterators.h:294
int Read() override
Read a single row.
Definition: sorting_iterator.cc:156
IO_CACHE * m_io_cache
Definition: basic_row_iterators.h:315
~SortFileIndirectIterator() override
Definition: sorting_iterator.cc:96
Mem_root_array< TABLE * > m_tables
Definition: basic_row_iterators.h:317
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:316
bool m_has_null_flags
Definition: basic_row_iterators.h:320
bool m_ignore_not_found_rows
Definition: basic_row_iterators.h:319
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:312
uint m_sum_ref_length
Definition: basic_row_iterators.h:322
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:308
uchar * m_ref_pos
Definition: basic_row_iterators.h:318
Fetch the records from a tempoary file.
Definition: basic_row_iterators.h:260
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:278
void UnlockRow() override
Definition: basic_row_iterators.h:270
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:282
uchar *const m_rec_buf
Definition: basic_row_iterators.h:277
IO_CACHE *const m_io_cache
Definition: basic_row_iterators.h:280
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:271
Filesort_info *const m_sort
Definition: basic_row_iterators.h:281
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:279
~SortFileIterator() override
Definition: sorting_iterator.cc:207
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:268
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:267
TableScanIterator(THD *thd, TABLE *table, double expected_rows, ha_rows *examined_rows)
Definition: basic_row_iterators.cc:251
~TableScanIterator() override
Definition: basic_row_iterators.cc:261
int Read() override
Read a single row.
Definition: basic_row_iterators.cc:291
TableValueConstructor is the iterator for the table value constructor case of a query_primary (i....
Definition: basic_row_iterators.h:531
Mem_root_array< Item_values_column * > * m_output_refs
References to the row we currently want to output.
Definition: basic_row_iterators.h:558
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:551
mem_root_deque< mem_root_deque< Item * > * >::const_iterator m_row_it
Definition: basic_row_iterators.h:552
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:541
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:546
void UnlockRow() override
Definition: basic_row_iterators.h:543
An iterator for unqualified COUNT(*) (ie., no WHERE, no join conditions, etc.), taking a special fast...
Definition: basic_row_iterators.h:369
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:848
void UnlockRow() override
Definition: basic_row_iterators.h:383
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:374
UnqualifiedCountIterator(THD *thd, JOIN *join)
Definition: basic_row_iterators.h:371
bool m_has_row
Definition: basic_row_iterators.h:386
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:381
JOIN *const m_join
Definition: basic_row_iterators.h:387
Like ZeroRowsIterator, but produces a single output row, since there are aggregation functions presen...
Definition: basic_row_iterators.h:424
int Read() override
Read a single row.
Definition: ref_row_iterators.cc:877
JOIN *const m_join
Definition: basic_row_iterators.h:443
bool m_has_row
Definition: basic_row_iterators.h:442
ha_rows *const m_examined_rows
Definition: basic_row_iterators.h:444
ZeroRowsAggregatedIterator(THD *thd, JOIN *join, ha_rows *examined_rows)
Definition: basic_row_iterators.h:427
void UnlockRow() override
Definition: basic_row_iterators.h:439
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:430
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:437
A simple iterator that takes no input and produces zero output rows.
Definition: basic_row_iterators.h:400
bool Init() override
Initialize or reinitialize the iterator.
Definition: basic_row_iterators.h:404
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:357
int Read() override
Read a single row.
Definition: basic_row_iterators.h:406
void UnlockRow() override
Definition: basic_row_iterators.h:410
ZeroRowsIterator(THD *thd, Mem_root_array< TABLE * > pruned_tables)
Definition: basic_row_iterators.cc:353
const Mem_root_array< TABLE * > m_pruned_tables
Definition: basic_row_iterators.h:413
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(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:151