Skip to content

[VL] [Flink] Offload window joins and TUMBLE/HOP/SESSION window TVFs to velox - #13742

Open
wud-if wants to merge 1 commit into
apache:mainfrom
wud-if:windowjoin-dev
Open

wud-if wants to merge 1 commit into
apache:mainfrom
wud-if:windowjoin-dev

Conversation

@wud-if

@wud-if wud-if commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #13741

What changes are proposed in this pull request?

Planner-side routing so a Flink window join and its window TVFs offload to the velox stateful stack (bigo-sg/velox#107 adds the operators):

  • StreamExecWindowJoin: detects the window bounds of both inputs and routes to a StreamWindowJoinNode. When the join is INNER and the planner-extracted condition is pure key equality (the window equality conjuncts are tautologies once both inputs share the window spec), the probe condition is dropped entirely — this unlocks the native zero-copy dictionary cross-product and is the single largest win: the 1e8 nexmark canonical drops from 74.7 s to 38.5 s.
  • StreamExecWindowTableFunction: three-tier routing — aligned unit-size TUMBLE compiles to a velox projection (date_trunc for natural units, modulo-floor for arbitrary sizes); aligned HOP (slide divides size, offset null or zero — null means zero here) routes to the new HopExpandNode; SESSION routes to SessionExpandNode. Everything else falls back to the stock JVM translation.
  • StreamExecJoin: window detection and tautology drop for FLOOR-shaped joins, plus window_start key pruning (window_start is determined by window_end, so the shuffle key narrows from (key…, ws, we) to (key…, we)).
  • StreamExecCalc: unit-TUMBLE TVFs dissolve into the downstream Calc projection, removing an operator hop.
  • Runtime: GlutenStatefulRecordSerializer exchanges StatefulRecords as presto-frame bytes between all-gluten vertices; GlutenTwoInputOperator carries the two-input watermark path.

How was this patch tested?

  • gluten-flink/ut: WindowJoinPlannerNegativePathTest (fail-loud routing for unsupported shapes) 2/2; UtilsJoinTypeMappingTest, DataPathMillisProbe pass.
  • Functional dual-run at 100k events (nexmark, filesystem sink): offloaded row counts match native within the generators' RNG variance — TUMBLE 19838 vs 19844, HOP exactly 2.0x, SESSION equal to TUMBLE.
  • End-to-end dual-run benchmarks (nexmark, 8-way parallelism, identical SQL at /root/gfv/e2e/sql/windowjoin-*.sql): 1e7 TUMBLE 3.9 s vs 7.3 s, HOP 6.4 s vs 8.5 s, SESSION 11.3 s vs 19.0 s; 1e8 TUMBLE 38.7 s vs 66.0 s, HOP 67.7 s and SESSION 173.0 s complete where native fails with TaskManager heartbeat overload.

- StreamExecJoin/StreamExecWindowJoin: window-join routing with
  window_end detection, tautological condition drop enabling the native
  fast cross-product path, window_start key pruning
- StreamExecWindowTableFunction: velox projection for aligned unit-size
  TUMBLE windows; velox expand routing for aligned HOP (slide divides
  size, null offset) and SESSION windows; unit-TUMBLE TVF dissolution
  into the downstream Calc projection

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VL] [Flink] Velox-native window join operator and vectorized window TVFs (TUMBLE/HOP/SESSION)

1 participant