You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by su...@apache.org on 2022/07/01 06:18:22 UTC

[spark] branch master updated: [SPARK-37205][FOLLOWUP] Should call non-static setTokensConf method

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ded5981823a [SPARK-37205][FOLLOWUP] Should call non-static setTokensConf method
ded5981823a is described below

commit ded5981823ac8e8e9339291415d9828dfcc6e062
Author: Chao Sun <su...@apple.com>
AuthorDate: Thu Jun 30 23:18:06 2022 -0700

    [SPARK-37205][FOLLOWUP] Should call non-static setTokensConf method
    
    ### What changes were proposed in this pull request?
    
    This fixes a bug in the original SPARK-37205 PR, where we treat the method `setTokensConf` as a static method, but it should be non-static instead.
    
    ### Why are the changes needed?
    
    The method `setTokensConf` is non-static so the current code will fail:
    ```
    06/29/2022 - 17:28:16  - Exception in thread "main" java.lang.IllegalArgumentException: object is not an instance of declaring class
    06/29/2022 - 17:28:16  - at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/29/2022 - 17:28:16  - at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    06/29/2022 - 17:28:16  - at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    06/29/2022 - 17:28:16  - at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    Manually tested this change internally and it now works.
    
    Closes #37037 from sunchao/SPARK-37205-fix.
    
    Authored-by: Chao Sun <su...@apple.com>
    Signed-off-by: Chao Sun <su...@apple.com>
---
 .../yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala b/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
index 99741d9f759..46c3117a14b 100644
--- a/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
+++ b/resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
@@ -391,7 +391,7 @@ private[spark] class Client(
           throw new SparkException(s"Cannot find setTokensConf method in ${amContainer.getClass}." +
               s" Please check YARN version and make sure it is 2.9+ or 3.x")
       }
-      setTokensConfMethod.invoke(ByteBuffer.wrap(dob.getData))
+      setTokensConfMethod.invoke(amContainer, ByteBuffer.wrap(dob.getData))
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org