255219 {
255220 auto &gasink = sink.global_state.Cast<WindowConstantAggregatorGlobalState>();
255221 const auto &partition_offsets = gasink.partition_offsets;
255222 const auto &results = *gasink.results;
255223
255224 auto begins = FlatVector::GetData<const idx_t>(bounds.
data[FRAME_BEGIN]);
255225
255226 auto &lcstate = sink.local_state.Cast<WindowConstantAggregatorLocalState>();
255227 idx_t matched = 0;
255228 idx_t target_offset = 0;
255229 for (
idx_t i = 0; i < count; ++i) {
255230 const auto begin = begins[i];
255231
255232 while (partition_offsets[lcstate.partition + 1] <= begin) {
255233
255234 if (matched) {
255235 VectorOperations::Copy(results, result, lcstate.matches, matched, 0, target_offset);
255236 target_offset += matched;
255237 matched = 0;
255238 }
255239 ++lcstate.partition;
255240 }
255241
255242 lcstate.matches.set_index(matched++, lcstate.partition);
255243 }
255244
255245
255246 if (matched) {
255247
255248 if (target_offset == 0 && matched == count) {
255249 VectorOperations::Copy(results, result, lcstate.matches, 1, 0, target_offset);
255250 result.SetVectorType(VectorType::CONSTANT_VECTOR);
255251 } else {
255252 VectorOperations::Copy(results, result, lcstate.matches, matched, 0, target_offset);
255253 }
255254 }
255255}
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237