This is an automated email from the ASF dual-hosted git repository.

roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new f27570e0f Fix: Use correct Field object for InputDescriptor className 
(#2445)
f27570e0f is described below

commit f27570e0f81b5660b2edefff747d354295a74c98
Author: Jiale Qi <[email protected]>
AuthorDate: Sun Apr 20 12:13:36 2025 +0800

    Fix: Use correct Field object for InputDescriptor className (#2445)
    
    ### What changes were proposed in this pull request?
    This PR corrects the reflection logic in 
`RssDAGAppMaster.DagInitialCallback` when setting the `className` for 
`InputDescriptor`. It now correctly obtains the `Field` object directly from 
`InputDescriptor`'s class hierarchy, instead of incorrectly reusing the `Field` 
object derived from `OutputDescriptor`.
    
    ### Why are the changes needed?
    The previous code mistakenly used the `Field` for `className` obtained from 
`OutputDescriptor` to modify the `InputDescriptor`.
    
    This **happened to work** likely because both `InputDescriptor` and 
`OutputDescriptor` inherit the `className` field from a common superclass. 
Java's reflection allows applying a `Field` object to any instance that 
possesses that field (often through inheritance), even if the `Field` was 
retrieved via a different related class.
    
    This fix ensures the reflection is used correctly and explicitly for 
`InputDescriptor`, improving code clarity, robustness, and maintainability.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Existing tests.
---
 .../src/main/java/org/apache/tez/dag/app/RssDAGAppMaster.java       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/client-tez/src/main/java/org/apache/tez/dag/app/RssDAGAppMaster.java 
b/client-tez/src/main/java/org/apache/tez/dag/app/RssDAGAppMaster.java
index 0fb41146c..25bf214e7 100644
--- a/client-tez/src/main/java/org/apache/tez/dag/app/RssDAGAppMaster.java
+++ b/client-tez/src/main/java/org/apache/tez/dag/app/RssDAGAppMaster.java
@@ -605,9 +605,9 @@ public class RssDAGAppMaster extends DAGAppMaster {
           // rename input class name
           InputDescriptor inputDescriptor = 
edge.getEdgeProperty().getEdgeDestination();
           Field inputClassNameField =
-              
outputDescriptor.getClass().getSuperclass().getDeclaredField("className");
+              
inputDescriptor.getClass().getSuperclass().getDeclaredField("className");
           inputClassNameField.setAccessible(true);
-          String inputClassName = (String) 
outputClassNameField.get(inputDescriptor);
+          String inputClassName = (String) 
inputClassNameField.get(inputDescriptor);
           String rssInputClassName =
               RssTezUtils.replaceRssInputClassName(
                   inputClassName,
@@ -616,7 +616,7 @@ public class RssDAGAppMaster extends DAGAppMaster {
                       .getBoolean(
                           RssTezConfig.RSS_REMOTE_MERGE_ENABLE,
                           RssTezConfig.RSS_REMOTE_MERGE_ENABLE_DEFAULT));
-          outputClassNameField.set(inputDescriptor, rssInputClassName);
+          inputClassNameField.set(inputDescriptor, rssInputClassName);
         }
       } catch (IOException | IllegalAccessException | NoSuchFieldException e) {
         LOG.error("Reconfigure failed after dag was inited, caused by {}", e);

Reply via email to