HyukjinKwon commented on a change in pull request #29667:
URL: https://github.com/apache/spark/pull/29667#discussion_r484627138
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala
##########
@@ -119,6 +125,37 @@ class SQLExecutionSuite extends SparkFunSuite {
spark.stop()
}
+
+ test("SPARK-32813: Table scan should work in different thread") {
+ val executor1 = Executors.newSingleThreadExecutor()
+ val executor2 = Executors.newSingleThreadExecutor()
+ SparkSession.cleanupAnyExistingSession()
+
+ withTempDir { tempDir =>
+ try {
+ val tablePath = tempDir.toString + "/table"
+ val df = ThreadUtils.awaitResult(Future {
+ val session =
SparkSession.builder().appName("test").master("local[*]").getOrCreate()
+
+ session.createDataFrame(
+ session.sparkContext.parallelize(Row(Array(1, 2, 3)) :: Nil),
+ StructType(Seq(
+ StructField("a", ArrayType(IntegerType, containsNull = false),
nullable = false))))
+ .write.parquet(tablePath)
+
+ session.read.parquet(tablePath)
+ }(ExecutionContext.fromExecutorService(executor1)), 1.minute)
+
+ ThreadUtils.awaitResult(Future {
+ assert(df.rdd.collect()(0) === Row(Seq(1, 2, 3)))
+ }(ExecutionContext.fromExecutorService(executor2)), 1.minute)
+
+ } finally {
+ executor1.shutdown()
Review comment:
Shall we stop the `session`?
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala
##########
@@ -119,6 +125,37 @@ class SQLExecutionSuite extends SparkFunSuite {
spark.stop()
}
+
+ test("SPARK-32813: Table scan should work in different thread") {
+ val executor1 = Executors.newSingleThreadExecutor()
+ val executor2 = Executors.newSingleThreadExecutor()
+ SparkSession.cleanupAnyExistingSession()
+
+ withTempDir { tempDir =>
Review comment:
I would just use `withTemPath`
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala
##########
@@ -119,6 +125,37 @@ class SQLExecutionSuite extends SparkFunSuite {
spark.stop()
}
+
+ test("SPARK-32813: Table scan should work in different thread") {
+ val executor1 = Executors.newSingleThreadExecutor()
+ val executor2 = Executors.newSingleThreadExecutor()
+ SparkSession.cleanupAnyExistingSession()
+
+ withTempDir { tempDir =>
+ try {
+ val tablePath = tempDir.toString + "/table"
+ val df = ThreadUtils.awaitResult(Future {
+ val session =
SparkSession.builder().appName("test").master("local[*]").getOrCreate()
+
+ session.createDataFrame(
+ session.sparkContext.parallelize(Row(Array(1, 2, 3)) :: Nil),
+ StructType(Seq(
+ StructField("a", ArrayType(IntegerType, containsNull = false),
nullable = false))))
+ .write.parquet(tablePath)
+
+ session.read.parquet(tablePath)
Review comment:
Should we necessarily write and read it back?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]