Module window

Module window 

Source
Expand description

Window Function Evaluator

This module implements the core window function evaluation engine that:

  • Partitions rows by PARTITION BY expressions
  • Sorts partitions by ORDER BY clauses
  • Calculates frame boundaries (ROWS mode)
  • Evaluates window functions over frames

§Module Organization

The window function evaluator is split into logical modules:

  • partitioning - Partition management and row grouping
  • sorting - Partition sorting and value comparison
  • frames - Frame boundary calculation (ROWS mode)
  • ranking - Ranking functions (ROW_NUMBER, RANK, DENSE_RANK, NTILE)
  • aggregates - Aggregate window functions (COUNT, SUM, AVG, MIN, MAX)
  • value - Value access functions (LAG, LEAD, FIRST_VALUE, LAST_VALUE)
  • utils - Shared utility functions

Structs§

FrameResult
Result of frame calculation including exclusion information
Partition
A partition of rows for window function evaluation

Functions§

calculate_frame
Calculate frame boundaries for a given row in a partition
calculate_frame_with_exclusion
Calculate frame with exclusion information
compare_values
Compare two SQL values for ordering
evaluate_avg_window
Evaluate AVG aggregate window function over a frame
evaluate_count_window
Evaluate COUNT aggregate window function over a frame
evaluate_cume_dist
Evaluate CUME_DIST() window function
evaluate_dense_rank
Evaluate DENSE_RANK() window function
evaluate_first_value
Evaluate FIRST_VALUE() value window function
evaluate_group_concat_window
Evaluate GROUP_CONCAT aggregate window function over a frame
evaluate_lag
Evaluate LAG() value window function
evaluate_last_value
Evaluate LAST_VALUE() value window function
evaluate_lead
Evaluate LEAD() value window function
evaluate_max_window
Evaluate MAX aggregate window function over a frame
evaluate_min_window
Evaluate MIN aggregate window function over a frame
evaluate_nth_value
Evaluate NTH_VALUE() value window function
evaluate_ntile
Evaluate NTILE(n) window function
evaluate_percent_rank
Evaluate PERCENT_RANK() window function
evaluate_rank
Evaluate RANK() window function
evaluate_row_number
Evaluate ROW_NUMBER() window function
evaluate_sum_window
Evaluate SUM aggregate window function over a frame
partition_rows
Partition rows by PARTITION BY expressions
sort_partition
Sort a partition by ORDER BY clauses
validate_frame
Validate a window frame specification, returning an error if invalid.