-
Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-36796][BUILD][CORE][SQL] Pass all sql/core and dependent modules UTs with JDK 17 except one case in postgreSQL/text.sql
#34153
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
Changes from 3 commits
09fcb3e
adc566d
70fc3bf
2b60264
7e016b3
44c566f
1761e74
3b0f6ed
0bb8df7
0861c5d
86517e6
4981260
32ac109
4aa3643
cfe530f
733a754
f61215f
e70e4cc
8628ed6
4017630
1abe44e
2925783
0e4bba8
ad22526
1fb8fb1
fdd912e
41e73fe
67c041f
2e87bde
ee8b1b8
bc4bad7
40ab4a8
5098d31
e773fc4
2dec62e
c7265c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.util | ||
|
|
||
| import scala.collection.mutable | ||
|
|
||
| import org.apache.commons.lang3.{JavaVersion, SystemUtils} | ||
|
|
||
| import org.apache.spark.SparkConf | ||
| import org.apache.spark.internal.config.{DRIVER_JAVA_OPTIONS, EXECUTOR_JAVA_OPTIONS, OptionalConfigEntry} | ||
|
|
||
| object JavaModuleUtils { | ||
|
|
||
| private val javaModuleOptions = Set("--add-opens java.base/java.nio=ALL-UNNAMED", | ||
|
Member
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. Let's use
Contributor
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. ok |
||
| "--add-opens java.base/sun.nio.ch=ALL-UNNAMED", | ||
| "--add-opens java.base/java.lang.invoke=ALL-UNNAMED", | ||
| "--add-opens java.base/java.nio=ALL-UNNAMED", | ||
| "--add-opens java.base/sun.nio.ch=ALL-UNNAMED", | ||
| "--add-opens java.base/java.lang.invoke=ALL-UNNAMED", | ||
| "--add-opens java.base/java.util=ALL-UNNAMED", | ||
| "--add-opens java.base/sun.security.action=ALL-UNNAMED", | ||
| "--add-opens java.base/sun.util.calendar=ALL-UNNAMED", | ||
| "--add-opens java.base/java.lang=ALL-UNNAMED", | ||
| "--add-opens java.base/sun.nio.cs=ALL-UNNAMED", | ||
| "--add-opens java.base/java.net=ALL-UNNAMED", | ||
| "--add-opens java.base/java.io=ALL-UNNAMED", | ||
| "--add-opens java.base/java.util.concurrent=ALL-UNNAMED", | ||
| "--add-exports java.base/jdk.internal.util.random=ALL-UNNAMED") | ||
|
Member
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. Thank you, @LuciferYang !
Member
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. BTW, I didn't realized that we need
Contributor
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.
But It is needed in modules |
||
|
|
||
| def isJavaVersionAtLeast17: Boolean = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_17) | ||
|
|
||
| def defaultModuleOptions(): String = javaModuleOptions.mkString(" ", " ", " ") | ||
|
|
||
|
|
||
| def supplementJava17ModuleOptsIfNeeded(conf: SparkConf): Unit = { | ||
|
|
||
| def supplementModuleOpts(configEntry: OptionalConfigEntry[String]): Unit = { | ||
| val v = conf.get(configEntry) match { | ||
| case Some(opts) => JavaModuleUtils.defaultModuleOptions() + opts | ||
| case None => JavaModuleUtils.defaultModuleOptions() | ||
| } | ||
| conf.set(configEntry.key, v) | ||
| } | ||
|
|
||
| if (Utils.isTesting && isJavaVersionAtLeast17) { | ||
| supplementModuleOpts(DRIVER_JAVA_OPTIONS) | ||
| supplementModuleOpts(EXECUTOR_JAVA_OPTIONS) | ||
| } | ||
| } | ||
|
|
||
| def supplementJava17ModuleOptsIfNeeded(args: Seq[String]): Seq[String] = { | ||
|
|
||
| def supplementModuleOpts(buffer: mutable.Buffer[String], key: String): Unit = { | ||
| val index = buffer.indexWhere(_.startsWith(s"$key}=")) | ||
| if (index != -1) { | ||
| buffer.update(index, buffer(index) + JavaModuleUtils.defaultModuleOptions()) | ||
| } else { | ||
| buffer.prependAll(Seq("--conf", s"$key=${JavaModuleUtils.defaultModuleOptions()}")) | ||
| } | ||
| } | ||
|
|
||
| if (Utils.isTesting && isJavaVersionAtLeast17) { | ||
| val buffer = args.toBuffer | ||
| supplementModuleOpts(buffer, DRIVER_JAVA_OPTIONS.key) | ||
| supplementModuleOpts(buffer, EXECUTOR_JAVA_OPTIONS.key) | ||
| buffer.toSeq | ||
| } else args | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ import org.scalatest.matchers.should.Matchers._ | |
|
|
||
| import org.apache.spark._ | ||
| import org.apache.spark.internal.config.UI.UI_ENABLED | ||
| import org.apache.spark.util.Utils | ||
| import org.apache.spark.util.{JavaModuleUtils, Utils} | ||
|
|
||
| class LauncherBackendSuite extends SparkFunSuite with Matchers { | ||
|
|
||
|
|
@@ -46,15 +46,22 @@ class LauncherBackendSuite extends SparkFunSuite with Matchers { | |
| private def testWithMaster(master: String): Unit = { | ||
| val env = new java.util.HashMap[String, String]() | ||
| env.put("SPARK_PRINT_LAUNCH_COMMAND", "1") | ||
| val handle = new SparkLauncher(env) | ||
| val launcher = new SparkLauncher(env) | ||
| .setSparkHome(sys.props("spark.test.home")) | ||
| .setConf(SparkLauncher.DRIVER_EXTRA_CLASSPATH, System.getProperty("java.class.path")) | ||
| .setConf(UI_ENABLED.key, "false") | ||
| .setConf(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, s"-Dtest.appender=console") | ||
| .setMaster(master) | ||
| .setAppResource(SparkLauncher.NO_RESOURCE) | ||
| .setMainClass(TestApp.getClass.getName().stripSuffix("$")) | ||
| .startApplication() | ||
|
|
||
| if(JavaModuleUtils.isJavaVersionAtLeast17) { | ||
|
Member
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. Rather than just add these in tests, can we ensure they get added for Java 17 in the non-test code paths? like ensure that these args are always added to the JVM command? that would go a long way to not disrupting users
Member
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. I agree with @LuciferYang (#34153 (comment) ).
Member
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. Agree. We can set it wherever possible.
Member
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. And nit: space after if
Member
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. Thank you, @srowen .
Contributor
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. If we agree to always add |
||
| launcher.setConf(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, | ||
| s"${JavaModuleUtils.defaultModuleOptions()} -Dtest.appender=console") | ||
| } else { | ||
| launcher.setConf(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, s"-Dtest.appender=console") | ||
| } | ||
| val handle = launcher.startApplication() | ||
|
|
||
| try { | ||
| eventually(timeout(30.seconds), interval(100.milliseconds)) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,6 +208,8 @@ | |
|
|
||
| <test.java.home>${java.home}</test.java.home> | ||
|
|
||
| <extraJavaTestArgs></extraJavaTestArgs> | ||
|
|
||
| <!-- Some UI tests require Chrome and Chrome driver installed so those tests are disabled by default. --> | ||
| <test.default.exclude.tags>org.apache.spark.tags.ChromeUITest</test.default.exclude.tags> | ||
| <test.exclude.tags></test.exclude.tags> | ||
|
|
@@ -2686,7 +2688,7 @@ | |
| <include>**/*Suite.java</include> | ||
| </includes> | ||
| <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> | ||
| <argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} -Dio.netty.tryReflectionSetAccessible=true</argLine> | ||
| <argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} ${extraJavaTestArgs} -Dio.netty.tryReflectionSetAccessible=true</argLine> | ||
| <environmentVariables> | ||
| <!-- | ||
| Setting SPARK_DIST_CLASSPATH is a simple way to make sure any child processes | ||
|
|
@@ -2737,7 +2739,7 @@ | |
| <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> | ||
| <junitxml>.</junitxml> | ||
| <filereports>SparkTestSuite.txt</filereports> | ||
| <argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} -Dio.netty.tryReflectionSetAccessible=true</argLine> | ||
| <argLine>-ea -Xmx5g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} ${extraJavaTestArgs} -Dio.netty.tryReflectionSetAccessible=true</argLine> | ||
|
LuciferYang marked this conversation as resolved.
Outdated
|
||
| <stderr/> | ||
| <environmentVariables> | ||
| <!-- | ||
|
|
@@ -3431,6 +3433,26 @@ | |
|
|
||
| </profile> | ||
|
|
||
| <profile> | ||
| <id>jdk-17</id> | ||
|
Member
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. Can we make this active by default on Java 17? Does it cause any conflicts with other profiles currently?
Member
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. I don't think that helps - this just controls whether it's active when built with JDK 17. We're not building with 17 anytime soon |
||
| <properties> | ||
| <extraJavaTestArgs> | ||
| --add-opens java.base/java.nio=ALL-UNNAMED | ||
|
Member
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. Please use
Contributor
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. @dongjoon-hyun this profile already removed |
||
| --add-opens java.base/sun.nio.ch=ALL-UNNAMED | ||
| --add-opens java.base/java.lang.invoke=ALL-UNNAMED | ||
| --add-opens java.base/java.util=ALL-UNNAMED | ||
| --add-opens java.base/sun.security.action=ALL-UNNAMED | ||
| --add-opens java.base/sun.util.calendar=ALL-UNNAMED | ||
| --add-opens java.base/java.lang=ALL-UNNAMED | ||
| --add-opens java.base/java.io=ALL-UNNAMED | ||
| --add-opens java.base/sun.nio.cs=ALL-UNNAMED | ||
| --add-opens java.base/java.net=ALL-UNNAMED | ||
| --add-opens java.base/java.util.concurrent=ALL-UNNAMED | ||
| --add-exports java.base/jdk.internal.util.random=ALL-UNNAMED | ||
| </extraJavaTestArgs> | ||
| </properties> | ||
| </profile> | ||
|
|
||
| <!-- | ||
| This is a profile to enable the use of the ASF snapshot and staging repositories | ||
| during a build. It is useful when testing against nightly or RC releases of dependencies. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,6 +280,7 @@ private object DateTimeFormatterHelper { | |
| // 2.4, the SimpleDateFormat uses Monday as the first day of week. | ||
| final val weekBasedLetters = Set('Y', 'W', 'w', 'u', 'e', 'c') | ||
| final val unsupportedLetters = Set('A', 'n', 'N', 'p') | ||
| final val unknownPatternLetters: Set[Char] = Set('B') | ||
|
LuciferYang marked this conversation as resolved.
Outdated
|
||
| // The quarter fields will also be parsed strangely, e.g. when the pattern contains `yMd` and can | ||
| // be directly resolved then the `q` do check for whether the month is valid, but if the date | ||
| // fields is incomplete, e.g. `yM`, the checking will be bypassed. | ||
|
|
@@ -322,6 +323,9 @@ private object DateTimeFormatterHelper { | |
| (isParsing && unsupportedLettersForParsing.contains(c))) { | ||
| throw new IllegalArgumentException(s"Illegal pattern character: $c") | ||
| } | ||
| for (c <- patternPart if unknownPatternLetters.contains(c)) { | ||
|
Contributor
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. @dongjoon-hyun @wangyum the result of With Java 17 the result is 'B' is used to represent Manual disabled it there for compatibility with Java 8 behavior.
Member
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.
Member
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. SGTM since the pattern is not documented/supported http://spark.apache.org/docs/latest/sql-ref-datetime-pattern.html
Member
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. Could you make this a separate PR please, @LuciferYang ? We can merge that first before this.
Contributor
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.
OK |
||
| throw new IllegalArgumentException(s"Unknown pattern letter: $c") | ||
| } | ||
| for (style <- unsupportedPatternLengths if patternPart.contains(style)) { | ||
| throw new IllegalArgumentException(s"Too many pattern letters: ${style.head}") | ||
| } | ||
|
|
||
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.
Do you have any better suggestions about supplement
--add-opensconfigurations tospark.driver.extraJavaOptionsandspark.executor.extraJavaOptionsfor test cases usinglocaland local-clustermodes.@dongjoon-hyun @wangyum
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.
This call may not be necessary. I'm testing it
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.
No, this is necessary for UTs in the
coremodule