258816 {
258817 auto &gvstate = sink.global_state.Cast<WindowValueGlobalState>();
258818 auto &lvstate = sink.local_state.Cast<WindowValueLocalState>();
258819 auto &cursor = *lvstate.cursor;
258820 auto &bounds = lvstate.bounds;
258821 auto &frames = lvstate.frames;
258822 auto &ignore_nulls = *gvstate.ignore_nulls;
258823 auto exclude_mode = gvstate.executor.wexpr.exclude_clause;
258824 WindowAggregator::EvaluateSubFrames(bounds, exclude_mode, count, row_idx, frames, [&](
idx_t i) {
258825 if (gvstate.value_tree) {
258826 idx_t frame_width = 0;
258827 for (const auto &frame : frames) {
258828 frame_width += frame.end - frame.start;
258829 }
258830
258831 if (frame_width) {
258832 const auto first_idx = gvstate.value_tree->SelectNth(frames, 0);
258833 D_ASSERT(first_idx.second == 0);
258834 if (first_idx.first < cursor.Count()) {
258835 cursor.CopyCell(0, first_idx.first, result, i);
258836 } else {
258837 FlatVector::SetNull(result, i, true);
258838 }
258839 } else {
258840 FlatVector::SetNull(result, i, true);
258841 }
258842 return;
258843 }
258844
258845 for (const auto &frame : frames) {
258846 if (frame.start >= frame.end) {
258847 continue;
258848 }
258849
258850
258852 const auto first_idx = WindowBoundariesState::FindNextStart(ignore_nulls, frame.start, frame.end, n);
258853 if (!n) {
258854 cursor.CopyCell(0, first_idx, result, i);
258855 return;
258856 }
258857 }
258858
258859
258860 FlatVector::SetNull(result, i, true);
258861 });
258862}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237