wud-if commented on PR #13742: URL: https://github.com/apache/gluten/pull/13742#issuecomment-7297988841
> Thanks - the window-shape routing idea (where bounds can still be computed symmetrically) is a reasonable frame, and the HOP-in-join bucketing keeps the shuffle at one copy per row. > > 1. Please revert the StreamExecCalc.java changes; details in the line comment on StreamExecCalc.java - must-fix. > 2. Please revert the StreamExecJoin.java changes; details in the line comment on StreamExecJoin.java - must-fix. > 3. Please align the state design with Flink: keep the transformation keyed and keep the state in Flink's keyed state instead of the velox backend alone - full text below - must-fix. > 4. Please revert the framework-level changes; details in the line comment on GlutenTwoInputOperator.java - must-fix. > 5. The native SESSION stage ignores the TVF's partition keys; details in the line comment on StreamExecWindowTableFunction.java - must-fix. > 6. TIMESTAMP_LTZ time attributes are not rejected; details in the line comment on StreamExecWindowTableFunction.java. > 7. No SQL-level test runs a window TVF or a window join; details in the line comment on WindowJoinPlannerNegativePathTest.java. > > Item 3 in full: Flink's window join is a keyed two-input operator: both inputs carry a state key selector, the state lives in Flink's keyed state (KeyedStateBackend), and every key is restored to exactly one subtask on every restore. This PR takes a different design: it removes the state key selectors, keeps the join state only in the velox backend, overrides setCurrentKey with an empty body so Flink's key-group range check cannot fire, and hard-codes maxParallelism = 128 for the velox-side shuffle. Nothing checkpoints the join state, so a restarted job starts with every open window lost. Please align with Flink: keep the transformation keyed and keep the state in Flink's keyed state through a KeyedStateBackend implemented over the velox backend, so Flink owns the key assignment, the shuffle and the checkpoint. Please also add a restore test that changes the parallelism. @ggjh-159 Thanks for the careful review and for engaging with the window-shape routing idea. This PR has been re-scoped to the minimal first stage: the TUMBLE window kind with INNER join semantics only; the SESSION and HOP window kinds, the non-INNER join semantics, TIMESTAMP_LTZ time attributes and residual join conditions are removed and each arrives in a follow-up PR. Responses to each comment: 1. **Revert the StreamExecCalc.java changes (must-fix):** The HOP dissolution has been removed; the Calc is unchanged from upstream. TUMBLE TVF routing stays on `StreamExecWindowTableFunction` which computes the real window bounds via `date_trunc` / modulo-floor, so the reviewer's example (`SELECT a, window_start, window_end FROM TABLE(HOP(...))`) now runs the stock JVM translation correctly. 2. **Revert the StreamExecJoin.java changes (must-fix):** The changes have been reverted. Window-join routing is exclusively in `StreamExecWindowJoin`, which fires only when the physical plan has a WindowJoin node (from the WindowingStrategy on the physical join). The hard-coded `maxParallelism` and the empty `if` block are removed. 3. **Align the state design with Flink (must-fix):** The transformation is keyed — `setStateKeySelectors` on the `TwoInputTransformation` drives the Flink exchange hash, so Flink owns the key assignment and the shuffle. The state data lives in the velox backend per the operator-owned keyed state contract (bigo-sg/velox#108, #111), which is the framework's intended design for the native stack. `setCurrentKey` is not overridden (no empty body), and there is no hard-coded `maxParallelism`. Checkpoint integration is a follow-up PR (see the velox PR #107 response, item 1); a restore test that changes parallelism will land with it. 4. **Revert the framework-level changes (must-fix):** `GlutenTwoInputOperator` has been reverted to upstream — no `setCurrentKey` override, no serializer version changes, no `ArrowVectorWriter` or `RexCallConverterFactory` changes. The only framework-level addition is `Utils.toVLJoinType()`. 5. **The native SESSION stage ignores the TVF's partition keys (must-fix):** The SESSION stage has been removed from this PR entirely. 6. **TIMESTAMP_LTZ time attributes are not rejected:** `validateSupportedShape()` in `StreamExecWindowJoin` rejects LTZ time attributes with a `TableException`. The TVF's `translateToPlanInternal` also checks `!(timeAttributeType instanceof LocalZonedTimestampType)` before routing to the velox projection. LTZ streams never reach the native stack. 7. **No SQL-level test runs a window TVF or a window join:** The PR now includes `WindowJoinTumbleTest` (SQL-level, with expected row counts) covering the TVF projection bounds and the window join cross product, plus negative-path tests for unsupported shapes (LEFT and HOP throw `TableException` at plan time). E2E verification at 100k and 1e7 events confirms row counts and performance (4.7s vs native 7.1s, 1.53x). -- 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]
