-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-44121][CONNECT][TESTS] Renable Arrow-based connect tests in Java 21 #42643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,9 +21,7 @@ import java.util.concurrent.TimeUnit | |
|
|
||
| import scala.io.Source | ||
|
|
||
| import org.apache.commons.lang3.{JavaVersion, SystemUtils} | ||
| import org.scalactic.source.Position | ||
| import org.scalatest.{BeforeAndAfterAll, Tag} | ||
| import org.scalatest.BeforeAndAfterAll | ||
| import sys.process._ | ||
|
|
||
| import org.apache.spark.sql.SparkSession | ||
|
|
@@ -180,44 +178,41 @@ trait RemoteSparkSession extends ConnectFunSuite with BeforeAndAfterAll { | |
| protected lazy val serverPort: Int = port | ||
|
|
||
| override def beforeAll(): Unit = { | ||
| // TODO(SPARK-44121) Remove this check condition | ||
| if (SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_17)) { | ||
| super.beforeAll() | ||
| SparkConnectServerUtils.start() | ||
| spark = SparkSession | ||
| .builder() | ||
| .client(SparkConnectClient.builder().port(serverPort).build()) | ||
| .create() | ||
|
|
||
| // Retry and wait for the server to start | ||
| val stop = System.nanoTime() + TimeUnit.MINUTES.toNanos(1) // ~1 min | ||
| var sleepInternalMs = TimeUnit.SECONDS.toMillis(1) // 1s with * 2 backoff | ||
| var success = false | ||
| val error = new RuntimeException(s"Failed to start the test server on port $serverPort.") | ||
|
|
||
| while (!success && System.nanoTime() < stop) { | ||
| try { | ||
| // Run a simple query to verify the server is really up and ready | ||
| val result = spark | ||
| .sql("select val from (values ('Hello'), ('World')) as t(val)") | ||
| .collect() | ||
| assert(result.length == 2) | ||
| success = true | ||
| debug("Spark Connect Server is up.") | ||
| } catch { | ||
| // ignored the error | ||
| case e: Throwable => | ||
| error.addSuppressed(e) | ||
| Thread.sleep(sleepInternalMs) | ||
| sleepInternalMs *= 2 | ||
| } | ||
| super.beforeAll() | ||
| SparkConnectServerUtils.start() | ||
| spark = SparkSession | ||
| .builder() | ||
| .client(SparkConnectClient.builder().port(serverPort).build()) | ||
| .create() | ||
|
|
||
| // Retry and wait for the server to start | ||
| val stop = System.nanoTime() + TimeUnit.MINUTES.toNanos(1) // ~1 min | ||
| var sleepInternalMs = TimeUnit.SECONDS.toMillis(1) // 1s with * 2 backoff | ||
| var success = false | ||
| val error = new RuntimeException(s"Failed to start the test server on port $serverPort.") | ||
|
|
||
| while (!success && System.nanoTime() < stop) { | ||
| try { | ||
| // Run a simple query to verify the server is really up and ready | ||
| val result = spark | ||
| .sql("select val from (values ('Hello'), ('World')) as t(val)") | ||
| .collect() | ||
| assert(result.length == 2) | ||
| success = true | ||
| debug("Spark Connect Server is up.") | ||
| } catch { | ||
| // ignored the error | ||
| case e: Throwable => | ||
| error.addSuppressed(e) | ||
| Thread.sleep(sleepInternalMs) | ||
| sleepInternalMs *= 2 | ||
| } | ||
| } | ||
|
|
||
| // Throw error if failed | ||
| if (!success) { | ||
| debug(error) | ||
| throw error | ||
| } | ||
| // Throw error if failed | ||
| if (!success) { | ||
| debug(error) | ||
| throw error | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -230,17 +225,4 @@ trait RemoteSparkSession extends ConnectFunSuite with BeforeAndAfterAll { | |
| spark = null | ||
| super.afterAll() | ||
| } | ||
|
|
||
| /** | ||
| * SPARK-44259: override test function to skip `RemoteSparkSession-based` tests as default, we | ||
| * should delete this function after SPARK-44121 is completed. | ||
| */ | ||
| override protected def test(testName: String, testTags: Tag*)(testFun: => Any)(implicit | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, please ignore my previous comment.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem at all. Thank you for review! |
||
| pos: Position): Unit = { | ||
| super.test(testName, testTags: _*) { | ||
| // TODO(SPARK-44121) Re-enable Arrow-based connect tests in Java 21 | ||
| assume(SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_17)) | ||
| testFun | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest these changes could be merged into 3.5 to avoid future conflicts. WDYT @dongjoon-hyun
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least the current one related to connect.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this
connectarea, I'll follow your guideline because you are the original author, @LuciferYang . :)