• class SelectScan: public Iterator: Like TableScan, SelectScan is an Iterator.

  • Iterator* input: SelectScan will take rows provided by an input Iterator, and pass on those satisfying the predicate.

  • while(...): Keep going until a row suitable for output is found.

  • next = input->next(): Assign the current input row to next. This evaluates to true if next != NULL

  • !predicate(next): Stay in the loop, testing more rows, if the current row does not cause the predicate to evaluate to true.

  • There is no loop to return all qualifying rows. Instead, rows are provided on demand to the caller, calling next().