Skip to content

Commit 6378940

Browse files
committed
Add Spark JVM --add-opens for (Nexmark, TPC-DS, PortableJar)
1 parent de21b1c commit 6378940

6 files changed

Lines changed: 50 additions & 1 deletion

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"comment": "Modify this file in a trivial way to cause this test suite to run",
3+
"modification": 1
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"comment": "Modify this file in a trivial way to cause this test suite to run",
3+
"modification": 1
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"comment": "Modify this file in a trivial way to cause this test suite to run",
3+
"modification": 1
4+
}

runners/portability/test_pipeline_jar.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,16 @@ OUTPUT_JAR="test-pipeline-${RUNNER}-$(date +%Y%m%d-%H%M%S).jar"
123123

124124
if [[ "$TEST_EXIT_CODE" -eq 0 ]]; then
125125
# Execute the jar
126-
java -jar $OUTPUT_JAR || TEST_EXIT_CODE=$?
126+
JAVA_ARGS=()
127+
if [[ "$RUNNER" = "SparkRunner" ]]; then
128+
JAVA_ARGS+=(
129+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"
130+
"--add-opens=java.base/java.nio=ALL-UNNAMED"
131+
"--add-opens=java.base/java.util=ALL-UNNAMED"
132+
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
133+
)
134+
fi
135+
java "${JAVA_ARGS[@]}" -jar $OUTPUT_JAR || TEST_EXIT_CODE=$?
127136
fi
128137

129138
rm -rf $ENV_DIR

sdks/java/testing/nexmark/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ if (isSparkRunner) {
114114
}
115115
}
116116

117+
def sparkJvmArgs() {
118+
def testJavaVer = project.findProperty('testJavaVersion') ? (project.property('testJavaVersion') as int) : JavaVersion.current().majorVersion.toInteger()
119+
if (testJavaVer >= 17) {
120+
return [
121+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
122+
"--add-opens=java.base/java.nio=ALL-UNNAMED",
123+
"--add-opens=java.base/java.util=ALL-UNNAMED",
124+
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
125+
]
126+
}
127+
return []
128+
}
129+
117130
def getNexmarkArgs = {
118131
def nexmarkArgsStr = project.findProperty(nexmarkArgsProperty) ?: ""
119132
def nexmarkArgsList = new ArrayList<String>()
@@ -179,6 +192,7 @@ task run(type: JavaExec) {
179192
systemProperty "spark.ui.showConsoleProgress", "false"
180193
// Dataset runner only
181194
systemProperty "spark.sql.shuffle.partitions", "4"
195+
jvmArgs += sparkJvmArgs()
182196
}
183197

184198
mainClass = "org.apache.beam.sdk.nexmark.Main"

sdks/java/testing/tpcds/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ if (isSpark) {
104104
}
105105
}
106106

107+
def sparkJvmArgs() {
108+
def testJavaVer = project.findProperty('testJavaVersion') ? (project.property('testJavaVersion') as int) : JavaVersion.current().majorVersion.toInteger()
109+
if (testJavaVer >= 17) {
110+
return [
111+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
112+
"--add-opens=java.base/java.nio=ALL-UNNAMED",
113+
"--add-opens=java.base/java.util=ALL-UNNAMED",
114+
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
115+
]
116+
}
117+
return []
118+
}
119+
107120
// Execute the TPC-DS queries or suites via Gradle.
108121
//
109122
// Parameters:
@@ -141,6 +154,7 @@ task run(type: JavaExec) {
141154
// Dataset runner only
142155
systemProperty "spark.sql.shuffle.partitions", "4"
143156
systemProperty "spark.sql.adaptive.enabled", "false" // high overhead for complex queries
157+
jvmArgs += sparkJvmArgs()
144158
}
145159

146160
mainClass = "org.apache.beam.sdk.tpcds.BeamTpcds"

0 commit comments

Comments
 (0)