sunshone commented on code in PR #13693:
URL: https://github.com/apache/gluten/pull/13693#discussion_r4691115831


##########
gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java:
##########
@@ -139,13 +134,19 @@ protected Transformation<RowData> translateToPlanInternal(
             KeySelectorUtil.getRowDataSelector(
                 planner.getFlinkContext().getClassLoader(), keys, inputType);
         // --- Begin Gluten-specific code changes ---
-        // The gluten exchange optimization below only applies when the input 
is
-        // already a gluten operator wrapped in a OneInputTransformation; other
-        // shapes (e.g. a SourceTransformation feeding the hash exchange in a
-        // plain GROUP BY) must take the vanilla Flink fallback instead of
-        // failing with a ClassCastException.
-        if (inputTransform instanceof OneInputTransformation
-            && ((OneInputTransformation) inputTransform).getOperator() 
instanceof GlutenOperator) {
+        // Key-group routing is always native: the native keyed state backend

Review Comment:
   Restored the shared-path guard: the native exchange applies when the input 
is a gluten operator and everything else takes the vanilla 
KeyGroupStreamPartitioner, as before this PR. One carve-out is kept, with 
runtime evidence: an offloaded gluten source emits StatefulRecord records on a 
source-direct edge, and the vanilla partitioner's RowData key selector cannot 
key them - ClassCastException: StatefulRecord cannot be cast to RowData inside 
KeyGroupStreamPartitioner.selectChannel, reproduced by the values-source 
planner tests when the guard is fully restored. That crash is the #13409 
fallback's own gap (it predates the rank work - a plain GROUP BY over an 
offloaded source hits it), so those source-direct edges route natively. 
Consistent with the interim design, rank plans at parallelism above 1 whose 
input would route vanilla fail loud at translation ("requires its input to be a 
gluten one-input operator") instead of misrouting against the native key-group 
ownership; the keyed-stat
 e integration makes Flink's partitioner and key groups agree and lifts the 
restriction.



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