Add window functions node (rolling, cumulative, rank, tile)#420
Open
Edwardvaneechoud wants to merge 3 commits into
Open
Add window functions node (rolling, cumulative, rank, tile)#420Edwardvaneechoud wants to merge 3 commits into
Edwardvaneechoud wants to merge 3 commits into
Conversation
Introduces a new "Window Functions" transformation node so medium users can compute rolling aggregates, cumulative aggregates, rank and equal-sized tile groupings (Alteryx-style) without writing code. The node accepts an optional partition-by, an order-by list, and a list of per-column window operations producing one new column each. Backend: - transform_schema: WindowFunctionInput / WindowFunctionsInput with validation for required params per function family. - input_schema: NodeWindowFunctions wired into NODE_TYPE_TO_SETTINGS_CLASS. - FlowDataEngine.do_window_functions applies ops via with_columns and .over(partition) after pre-sorting by order_by. Tile uses SQL NTILE semantics (sizes distributed with larger groups first). - FlowGraph.add_window_functions registers the node and its schema. - code_generator emits cross-framework (pl + ff) expressions. - node_store registers the node under the aggregate category. Frontend: - WindowFunctions.vue component with partition-by, order-by, and op table reusing the GroupBy/Sort UX patterns. - Type definitions in node.types.ts; icon added. Tests: - Unit tests for rolling, cumulative, rank, tile semantics and schema validation in test_window_functions.py. - End-to-end code-generator tests for both polars and flowframe outputs. https://claude.ai/code/session_01KHCMBBsT4TcFtpDJ3tsXTc
…led params
Addresses UX feedback from the first pass:
- Output name column is now properly laid out (table uses table-layout:
fixed with explicit column widths) so the input is always visible and
editable. Previously the column existed but got squashed.
- Auto-naming now tracks per-row whether the name is auto-generated or
user-edited. Changing the source column or function updates the output
name only when the user hasn't customized it; clearing the field
re-enables auto-update.
- Added help-icon tooltips on each section header explaining what
partition-by and order-by do and what the parameter column means.
- Parameter column now shows a label under each input ("window size
(rows)", "number of groups", "tie-breaking method") so "3" in the row
is no longer mystery meat.
- Empty-params row (cum_sum etc) now renders a clear "No parameters"
label instead of an empty input-number blob.
- Tile minimum is now 2 (a single group is pointless).
https://claude.ai/code/session_01KHCMBBsT4TcFtpDJ3tsXTc
Adds a per-row control for how rolling functions behave before the window has filled up: - "Leave empty (null)" — require a full window (default, matches Polars' default behavior) - "Use partial window" — compute on whatever rows are available (min_samples=1) - "Fill with 0" — compute on partial windows, then coalesce any remaining nulls to 0 (useful when the source column itself has nulls) Wired through transform_schema (new RollingEdgeBehavior literal), FlowDataEngine expression builder, code generator, and the Vue UI (secondary dropdown labeled "incomplete windows" under the window size input). Tests cover all three behaviors including the null-source-column case for fill_zero. https://claude.ai/code/session_01KHCMBBsT4TcFtpDJ3tsXTc
✅ Deploy Preview for flowfile-wasm canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive support for window functions to Flowfile, enabling users to compute rolling averages, cumulative sums, rankings, and tile-based partitioning operations on their data.
Key Changes
Backend Implementation
Schema definitions (
transform_schema.py): AddedWindowFunctionName,RankMethod,RollingEdgeBehaviortypes andWindowFunctionInput/WindowFunctionsInputmodels with comprehensive validationData engine (
flow_data_engine.py): Implementeddo_window_functions()method and_build_window_expr()helperFlow graph (
flow_graph.py): Addedadd_window_functions()method with automatic schema inference for output columnsCode generator (
code_generator.py): Generates executable Polars/FlowFrame code for window operations, including complex tile logicInput schema (
input_schema.py): AddedNodeWindowFunctionsclass with human-readable descriptionsFrontend Implementation
Vue component (
WindowFunctions.vue): Full-featured UI with:Type definitions (
node.types.ts): TypeScript interfaces for all window function typesNode configuration (
nodes.py): Registered window_functions as a standard node templateIcon (
window_functions.svg): Added SVG icon with light/dark mode supportTesting
Comprehensive test suite (
test_window_functions.py): 13 tests covering:Code generation tests (
test_code_generator.py): 2 tests verifying generated code correctness for rolling/cumulative and tile operationsNotable Implementation Details
https://claude.ai/code/session_01KHCMBBsT4TcFtpDJ3tsXTc