message: Make scanning great again
diff: @@ -86,7 +86,8 @@ void DataTable::Scan(Transaction &transaction, DataChunk &result, TableScanState
  transaction.storage.Scan(state.local_state, state.column_ids, result, &table_filters);
  }
  -template <class T> bool checkZonemap(TableScanState &state, TableFilter &table_filter, T constant) {
  +template<class T>
  +bool checkZonemap(TableScanState &state, TableFilter &table_filter, T constant) {
  T *min = (T *) state.column_scans[table_filter.column_index].current->stats.minimum.get();
  T *max = (T *) state.column_scans[table_filter.column_index].current->stats.maximum.get();
  switch (table_filter.comparison_type) {
  @@ -187,7 +188,8 @@ bool DataTable::CheckZonemap(TableScanState &state, unordered_map<idx_t, vector<
  //! We can skip this partition
  idx_t vectorsToSkip =
  ceil((double) (state.column_scans[predicate_constant.column_index].current->count +
  - state.column_scans[predicate_constant.column_index].current->start - current_row) /
  + state.column_scans[predicate_constant.column_index].current->start -
  + current_row) /
  STANDARD_VECTOR_SIZE);
  for (idx_t i = 0; i < vectorsToSkip; ++i) {
  state.NextVector();
  @@ -223,8 +225,22 @@ bool DataTable::ScanBaseTable(Transaction &transaction, DataChunk &result, Table
  current_row += STANDARD_VECTOR_SIZE;
  return true;
  }
  - SelectionVector sel;
  idx_t approved_tuple_count = count;
  + if (count == max_count && table_filters.empty()) {
  + //! If we don't have any deleted tuples or filters we can just run a regular scan
  + for (idx_t i = 0; i < state.column_ids.size(); i++) {
  + auto column = state.column_ids[i];
  + if (column == COLUMN_IDENTIFIER_ROW_ID) {
  + // scan row id
  + assert(result.data[i].type == ROW_TYPE);
  + result.data[i].Sequence(base_row + current_row, 1);
  + } else {
  + columns[column].Scan(transaction, state.column_scans[i], result.data[i]);
  + }
  + }
  + } else {
  + SelectionVector sel;
  +
  if (count != max_count) {
  sel.Initialize(valid_sel);
  } else {
  @@ -256,6 +272,8 @@ bool DataTable::ScanBaseTable(Transaction &transaction, DataChunk &result, Table
  }
  }
  }
  + }
  +
  result.SetCardinality(approved_tuple_count);
  current_row += STANDARD_VECTOR_SIZE;
  return true;
  @@ -282,7 +300,8 @@ void DataTable::InitializeIndexScan(Transaction &transaction, TableIndexScanStat
  vector<column_t> column_ids) {
  InitializeIndexScan(transaction, state, index, move(column_ids));
  state.index_state =
  - index.InitializeScanTwoPredicates(transaction, state.column_ids, low_value, low_type, high_value, high_type);
  + index.InitializeScanTwoPredicates(transaction, state.column_ids, low_value, low_type, high_value,
  + high_type);
  }
  void DataTable::IndexScan(Transaction &transaction, DataChunk &result, TableIndexScanState &state) {
  