162139 {
162140
162141 const idx_t count = input.size();
162142 auto &aggregate = *
wexpr.aggregate;
162143 auto &aggr_state = *this;
162144 auto &
statev = aggr_state.statev;
162145
162146
162147 ValidityMask filter_mask;
162148 auto filtered = count;
162150 if (
wexpr.filter_expr) {
162152 if (filtered < count) {
162153 filter_mask.Initialize(count);
162154 filter_mask.SetAllInvalid(count);
162155 for (
idx_t f = 0; f < filtered; ++f) {
162156 filter_mask.SetValid(
filter_sel.get_index(f));
162157 }
162158 }
162159 }
162160
162161
162162 if (
wexpr.children.empty()) {
162163 D_ASSERT(GetTypeIdSize(result.GetType().InternalType()) == sizeof(int64_t));
162164 auto data = FlatVector::GetData<int64_t>(result);
162166 for (
idx_t i = 0; i < count; ++i) {
162169 }
162170 return;
162171 }
162172
162173
162174 auto &
arg_chunk = aggr_state.arg_chunk;
162178
162179
162180 ValidityMask distinct_mask;
162181 if (aggr_state.distinct) {
162184 if (
wexpr.filter_expr) {
162186 }
162189 if (filtered) {
162190
162191 auto &
hashes = aggr_state.hashes;
162193
162194 auto &
addresses = aggr_state.addresses;
162196 }
162197
162198
162199
162200
162202 distinct_mask.Initialize(count);
162203 distinct_mask.SetAllInvalid(count);
162206 distinct_mask.SetValid(
filter_sel.get_index(f));
162207 }
162208 }
162209 }
162210
162211
162213 SelectionVector
sel(&s);
162217
162218
162219 vector<column_t> structs;
162222 DictionaryVector::Child(col_vec).Reference(
arg_chunk.data[col_idx]);
162224 structs.emplace_back(col_idx);
162225 }
162226 }
162227
162228
162229 AggregateInputData aggr_input_data(
wexpr.bind_info.get(), aggr_state.arena_allocator);
162230 for (
idx_t i = 0; i < count; ++i) {
162231 sel.set_index(0, i);
162232 for (const auto struct_idx : structs) {
162234 }
162235 if (filter_mask.RowIsValid(i) && distinct_mask.RowIsValid(i)) {
162236 aggregate.GetStateUpdateCallback()(
arg_cursor.data.data(), aggr_input_data,
arg_cursor.ColumnCount(),
162238 }
162239 aggregate.GetStateFinalizeCallback()(
statev, aggr_input_data, result, 1, i);
162240 }
162241}
SelectionVector sel
A temporary selection vector.
Definition duckdb.cpp:162084
idx_t column_t
Type used for column identifiers.
Definition duckdb.hpp:259
@ STRUCT
Struct of logical types.
Definition duckdb.hpp:2816
uint32_t sel_t
Type used for the selection vector.
Definition duckdb.hpp:251
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
int64_t unfiltered
The number of unfiltered rows so far for COUNT(*).
Definition duckdb.cpp:161827