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/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 16a63e2c [BUG][FOLLOWUP] Fix flaky test of
AQESkewedJoinWithLocalOrderTest (#355)
16a63e2c is described below
commit 16a63e2c21905689519d9db9554e65f600a40031
Author: Junfan Zhang <[email protected]>
AuthorDate: Wed Nov 23 20:10:21 2022 +0800
[BUG][FOLLOWUP] Fix flaky test of AQESkewedJoinWithLocalOrderTest (#355)
### What changes were proposed in this pull request?
Fix flaky test of AQESkewedJoinWithLocalOrderTest
### Why are the changes needed?
1. The sparksession is not closed by `GetReaderTest.java`
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Just test
---
.../org/apache/uniffle/test/SparkIntegrationTestBase.java | 11 ++++++++++-
.../src/test/java/org/apache/uniffle/test/GetReaderTest.java | 2 ++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkIntegrationTestBase.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkIntegrationTestBase.java
index 0cc5a17d..5632ab5e 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkIntegrationTestBase.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkIntegrationTestBase.java
@@ -26,6 +26,7 @@ import org.apache.spark.shuffle.RssSparkConfig;
import org.apache.spark.sql.SparkSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import scala.Option;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -69,8 +70,16 @@ public abstract class SparkIntegrationTestBase extends
IntegrationTestBase {
}
+ private static <T> T getIfExists(Option<T> o) {
+ return o.isDefined() ? o.get() : null;
+ }
+
protected Map runSparkApp(SparkConf sparkConf, String testFileName) throws
Exception {
- SparkSession spark =
SparkSession.builder().config(sparkConf).getOrCreate();
+ SparkSession spark = getIfExists(SparkSession.getActiveSession());
+ if (spark != null) {
+ spark.close();
+ }
+ spark = SparkSession.builder().config(sparkConf).getOrCreate();
Map resultWithRss = runTest(spark, testFileName);
spark.stop();
return resultWithRss;
diff --git
a/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetReaderTest.java
b/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetReaderTest.java
index 814566c4..6e6bbea6 100644
---
a/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetReaderTest.java
+++
b/integration-test/spark3/src/test/java/org/apache/uniffle/test/GetReaderTest.java
@@ -170,6 +170,8 @@ public class GetReaderTest extends IntegrationTestBase {
commonHadoopConf = jsc2.hadoopConfiguration();
assertNull(commonHadoopConf.get("k1"));
assertNull(commonHadoopConf.get("k2"));
+
+ sparkSession.close();
}
private static class MockTaskContext extends TaskContext {