AnissaLiu opened a new pull request, #13690:
URL: https://github.com/apache/gluten/pull/13690
## What changes are proposed in this pull request?
Native support for Flink streaming window TVF aggregation through the
gluten-flink stateful backend. Fixes #13687.
Commit 1 — window TVF aggregation planner support (9 files):
- `StreamExecWindowAggregate` (single stage): passes `KeyedStateSpec`,
`shiftTimeZone` and the real window-column positions to the native operator;
keyless windows (GROUP BY window_start/window_end only) wrap a constant
`$keyless_key` channel via the shared `Utils.wrapKeylessInput`; FILTER masks
are carried through; update-stream input (needRetraction) is rejected with an
explicit error.
- `StreamExecLocalWindowAggregate` / `StreamExecGlobalWindowAggregate` (new
shadows, two-stage): the local node translates to a `kPartial` aggregation with
`isLocalAgg=true`; the global node to a `kFinal` aggregation whose slice end
comes from the trailing windowEnd column of the local output
(`SliceAttachedWindowingStrategy`). Output types are Flink's planner-derived
layouts verbatim — no reordering.
- `WindowUtils` extracts all four TVF window specs
(HOP/TUMBLE/SESSION/CUMULATE; CUMULATE fails loudly in the operator), pinned by
the new `WindowUtilsTest`.
- `WindowAggOperator` (runtime): when the transformation is non-keyed (the
native keyed backend owns the state), Java keyed state is skipped.
Commit 2 — JNI vector serde contract (author ggjh-159, cherry-picked from
`flink/vector-serde-bytea`): `GlutenStatefulRecordSerializer` writes the
serialized vector frame as a raw `byte[]` instead of a base64 String, pairing
with the velox4j-side PrestoVectorSerde JNI change. The `velox4j-ref` pin
points at the window-serde branch tip; it will follow the velox4j merge commit
once the companion lands.
Dependencies / merge order: this PR depends on the bigo-sg/velox operator PR
("Window TVF aggregation over the keyed state backend") and the bigo-sg/velox4j
serde PR; suggested order **velox → velox4j → gluten**. Cross-repo conflicts
(ref pins, serde contract pair) will be resolved at merge time.
Scope notes (honest limitations): two-stage applies where Flink's rule fires
(event-time, non-SESSION); SESSION and processing-time run single-stage;
aggregate support is COUNT/SUM (verified); AVG in window aggregation fails
loudly — see the issue's aggregate-support note.
## How was this patch tested?
Standalone Flink 1.19.2 (1 JM / 1 TM, 8 slots), native-Flink same-input
references, multiset-exact comparison (timestamp normalization + sort + line
diff empty); operator-level tests live in the velox PR (WindowAggregatorTest
40/40, stateful ctest 18/18).
- E2E correctness vs native: single-stage 8/8 exact matches (multi-window +
late rows, empty windows, HOP overlap and stop-chain, keyless, composite key,
parallelism 4, FILTER); two-stage 7/7 exact matches (same scenarios through the
local-global path); SESSION 2/2 (gap-merge match + nexmark 10M closure of
exactly 8,900,000). All 17 scenarios FINISHED.
- Performance (100M events, datagen rate cap 50M/s — CPU-bound at ~3.7M/s,
blackhole, parallelism 4, GFV with object-reuse off; native with the switch off
and on; same-day):
| Query | GFV | Native (reuse off) | Native (reuse on) | GFV vs off | GFV vs
on |
|---|---|---|---|---|---|
| TUMBLE (nexmark q12, processing time) | **16.4s** | 80.8s | 40.3s |
**4.9x** | **2.5x** |
| HOP 30s/5s (event time) | **49.9s** | 84.1s | 45.0s | **1.7x** | 0.90x |
| SESSION gap 30s (event time) | **18.8s** | 80.9s | 40.5s | **4.3x** |
**2.2x** |
The JNI serde change accounts for a large share of the wins (q12 25.3s →
16.8s, SESSION 40.6s → 19.3s measured before/after on the integration line);
the remaining HOP gap to native-with-reuse (-11%) is the fire-time slice merge,
attributed to scattered state-row cache misses.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]