ggjh-159 commented on code in PR #13558:
URL: https://github.com/apache/gluten/pull/13558#discussion_r4651538205


##########
gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupAggregate.java:
##########
@@ -226,15 +240,13 @@ protected Transformation<RowData> translateToPlanInternal(
             inputTransform.getParallelism(),
             false);
 
-    // set KeyType and Selector for state
-    final RowDataKeySelector selector =
-        KeySelectorUtil.getRowDataSelector(
-            planner.getFlinkContext().getClassLoader(),
-            grouping,
-            InternalTypeInfo.of(inputRowType));
-    transform.setStateKeySelector(selector);
-    transform.setStateKeyType(selector.getProducedType());
-
+    // Keys are owned by the velox side (KeyedStateSpec feeds the C++ keyed 
state

Review Comment:
   @philo-he. Thank you for detailed review. The keyed state is not carried 
through Flink's checkpoint mechanism in this PR, and that is deliberate scoping 
rather than an oversight:
   
   - Checkpointing: keyed operators have never had checkpoint wiring in 
gluten-flink — today only the streaming source and the filesystem writer 
consume snapshot records — so this PR does not change any previously working 
checkpoint behavior.
   - Savepoint compatibility: because keyed state was never included in 
snapshots before this change, there is no pre-change savepoint carrying this 
operator's state that could stop restoring.
   - The redistribution mechanics themselves are implemented and tested in the 
companion velox PR (bigo-sg/velox#86): the backend serializes per key group, 
and restore is key-group aware — each backend picks its own key-group sub-range 
out of a stream written under a different range, maxParallelism must stay fixed 
(it defines the key-group space), and the disjoint covering streams of a 
scale-down restore in order. Pinned by restorePicksSubRange, 
restoreAccumulatesStreams and restoreRejectsKeyGroupRangeMismatch in 
StateBackendTest, plus a task-level round trip 
(testSnapshotRestoreThroughTaskCheckpoint in GroupAggregatorTest).
   - Wiring keyed state into the Flink checkpoint/savepoint machinery — and 
with it the p=2 → p=4 end-to-end test you suggest — is planned follow-up work.



-- 
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]

Reply via email to