You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/10/22 07:56:29 UTC

[spark] branch master updated: [SPARK-37073][AVRO][TEST] Pass all UTs in `external/avro` with Java 17

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

gurwls223 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 d355952  [SPARK-37073][AVRO][TEST] Pass all UTs in `external/avro` with Java 17
d355952 is described below

commit d355952b82a542497deeb7c028070b4756e863b5
Author: yangjie01 <ya...@baidu.com>
AuthorDate: Fri Oct 22 16:55:25 2021 +0900

    [SPARK-37073][AVRO][TEST] Pass all UTs in `external/avro` with Java 17
    
    ### What changes were proposed in this pull request?
    The `external/avro` module test with Java 17 has 2 UT failed, the reason for the failure is that the content of the error message  fragment used for assertion has changed from
    
    ```
    Caused by: java.lang.NullPointerException: null of string in string in field Name of test_schema in test_schema
    ```
    to
    
    ```
    Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "datum" is null of string in string in field Name of test_schema in test_schema
    ```
    
    This change should be caused by `JEP 358: Helpful NullPointerExceptions`.
    
    So the change of this pr is  splits one assertion into two assertions to be compatible with different Java versions.
    
    ### Why are the changes needed?
    Pass UT with JDK 17
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    
    - Pass the Jenkins or GitHub Action
    
    - Manual test  use Java 17
    
    `mvn clean install -pl external/avro`
    
    **Before**
    ```
    Run completed in 49 seconds, 212 milliseconds.
    Total number of tests run: 283
    Suites: completed 14, aborted 0
    Tests: succeeded 281, failed 2, canceled 0, ignored 2, pending 0
    *** 2 TESTS FAILED ***
    ```
    
    **After**
    
    ```
    Run completed in 42 seconds, 825 milliseconds.
    Total number of tests run: 283
    Suites: completed 14, aborted 0
    Tests: succeeded 283, failed 0, canceled 0, ignored 2, pending 0
    All tests passed.
    ```
    
    Closes #34364 from LuciferYang/SPARK-37073.
    
    Authored-by: yangjie01 <ya...@baidu.com>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala b/external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala
index 510ddfc..600386b 100644
--- a/external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala
+++ b/external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala
@@ -1071,7 +1071,8 @@ abstract class AvroSuite
           .write.format("avro").option("avroSchema", avroSchema)
           .save(s"$tempDir/${UUID.randomUUID()}")
       }.getCause.getMessage
-      assert(message.contains("Caused by: java.lang.NullPointerException: " +
+      assert(message.contains("Caused by: java.lang.NullPointerException: "))
+      assert(message.contains(
         "null of string in string in field Name of test_schema in test_schema"))
     }
   }

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