Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support negative preceding/following for ROW window functions #14093

Merged
merged 18 commits into from
Sep 21, 2023

Commits on Sep 5, 2023

  1. Support negative preceding/following for ROW window functions

    This commit adds support for "offset" ROW windows, where the preceding and following
    window bounds are allowed to have negative values.  This allows window definitions to
    exclude the current row entirely.
    
    Prior to this change, ROW-based windows *had* to include the current row, causing
    `preceding` and `following` to support only non-negative values.  Additionally, the
    inclusion of the current row would count against the `min_periods` check.
    
    The following is an example of the new "negative" semantics.  Consider the input:
    ```c++
    auto const row = ints_column{1, 2, 3, 4};
    ```
    If the window bounds are specified as (preceding=3, following=-1), then the window
    for the third row (`3`) is `{1, 2}`.
    `following=-1` indicates a "following" row *before* the current row.
    
    A negative value for `preceding` follows the existing convention of including the
    current row.  This makes it slightly more involved:
      1. `preceding=2` indicates *one* row before the current row.
      2. `preceding=1` indicates the current row.
      3. `preceding=0` indicates one row past (i.e. after) the current row.
      4. `preceding=-1` indicates two rows after the current row.
    Et cetera.
    
    `min_periods` checks continue to be honoured as before, but the requirement for
    positive `min_periods` is dropped.  `min_periods` only need be non-negative.
    
    Signed-off-by: MithunR <[email protected]>
    mythrocks committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    9f6acc6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7e4ae8b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a577d2e View commit details
    Browse the repository at this point in the history
  4. Tests for ungrouped cases.

    mythrocks committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    f2a9e1e View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2023

  1. Removed unused includes.

    mythrocks committed Sep 10, 2023
    Configuration menu
    Copy the full SHA
    e616ecc View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2023

  1. Configuration menu
    Copy the full SHA
    6d65898 View commit details
    Browse the repository at this point in the history
  2. Materialized preceding/following offsets for fixed windows.

    Also, removed prints.
    mythrocks committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    eaff7dd View commit details
    Browse the repository at this point in the history
  3. Formatting.

    mythrocks committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    c3e7f8b View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2023

  1. Configuration menu
    Copy the full SHA
    4aca25e View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2023

  1. Configuration menu
    Copy the full SHA
    589f2a5 View commit details
    Browse the repository at this point in the history
  2. Fixed up test.

    mythrocks committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    5f310a2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4d4683c View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2023

  1. Configuration menu
    Copy the full SHA
    ada90c2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f7c504b View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2023

  1. Updated grouped_rolling_window documentation:

    This now explains the semantics for negative window bounds.
    mythrocks committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    da78c8e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1821eaf View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    46de250 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b66fd14 View commit details
    Browse the repository at this point in the history