dcoliversun commented on code in PR #36900:
URL: https://github.com/apache/spark/pull/36900#discussion_r901304165


##########
launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java:
##########
@@ -401,8 +401,7 @@ boolean isClientMode(Map<String, String> userProps) {
    * Return whether the given main class represents a thrift server.
    */
   private boolean isThriftServer(String mainClass) {
-    return (mainClass != null &&
-      
mainClass.equals("org.apache.spark.sql.hive.thriftserver.HiveThriftServer2"));
+    return 
("org.apache.spark.sql.hive.thriftserver.HiveThriftServer2".equals(mainClass));

Review Comment:
   It's needed. If remove `mainClass != null`, pyspark test will fail.
   ```plain
   ========================================================================
   Running PySpark tests
   ========================================================================
   Running PySpark tests. Output is in /__w/spark/spark/python/unit-tests.log
   Will test against the following Python executables: ['python3.9', 'pypy3']
   Will test the following Python modules: ['pyspark-sql', 'pyspark-resource', 
'pyspark-mllib']
   python3.9 python_implementation is CPython
   python3.9 version is: Python 3.9.5
   pypy3 python_implementation is PyPy
   pypy3 version is: Python 3.7.12 (7.3.7+dfsg-1~ppa1~ubuntu20.04, Oct 26 2021, 
02:00:43)
   [PyPy 7.3.7 with GCC 9.3.0]
   Starting test(pypy3): pyspark.sql.tests.test_arrow (temp output: 
/tmp/pypy3__pyspark.sql.tests.test_arrow__2_kthvri.log)
   Finished test(pypy3): pyspark.sql.tests.test_arrow (1s) ... 121 tests were 
skipped
   Starting test(pypy3): pyspark.sql.tests.test_arrow_map (temp output: 
/tmp/pypy3__pyspark.sql.tests.test_arrow_map__ot8ujcj9.log)
   Finished test(pypy3): pyspark.sql.tests.test_arrow_map (0s) ... 7 tests were 
skipped
   Starting test(pypy3): pyspark.sql.tests.test_catalog (temp output: 
/tmp/pypy3__pyspark.sql.tests.test_catalog__67s8rrv3.log)
   Exception in thread "main" java.lang.NullPointerException
        at 
org.apache.spark.launcher.SparkSubmitCommandBuilder.isThriftServer(SparkSubmitCommandBuilder.java:404)
        at 
org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitCommand(SparkSubmitCommandBuilder.java:265)
        at 
org.apache.spark.launcher.SparkSubmitCommandBuilder.buildCommand(SparkSubmitCommandBuilder.java:164)
        at org.apache.spark.launcher.Main.buildCommand(Main.java:113)
        at org.apache.spark.launcher.Main.main(Main.java:63)
   ```



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