Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PostCommit_Java_Nexmark_Spark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"modification": 1
}
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PostCommit_Java_Tpcds_Spark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"modification": 1
}
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PostCommit_PortableJar_Spark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"modification": 1
}
11 changes: 10 additions & 1 deletion runners/portability/test_pipeline_jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,16 @@ OUTPUT_JAR="test-pipeline-${RUNNER}-$(date +%Y%m%d-%H%M%S).jar"

if [[ "$TEST_EXIT_CODE" -eq 0 ]]; then
# Execute the jar
java -jar $OUTPUT_JAR || TEST_EXIT_CODE=$?
JAVA_ARGS=()
if [[ "$RUNNER" = "SparkRunner" ]]; then
JAVA_ARGS+=(
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"
"--add-opens=java.base/java.nio=ALL-UNNAMED"
"--add-opens=java.base/java.util=ALL-UNNAMED"
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
)
fi
java "${JAVA_ARGS[@]}" -jar $OUTPUT_JAR || TEST_EXIT_CODE=$?
fi

rm -rf $ENV_DIR
Expand Down
14 changes: 14 additions & 0 deletions sdks/java/testing/nexmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ if (isSparkRunner) {
}
}

def sparkJvmArgs() {
def testJavaVer = project.findProperty('testJavaVersion') ? (project.property('testJavaVersion') as int) : JavaVersion.current().majorVersion.toInteger()
if (testJavaVer >= 17) {
Comment on lines +118 to +119

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Parsing testJavaVersion directly as an integer using as int can throw a NumberFormatException if the version is specified in a format like "1.8" or "11.0".

Using Gradle's built-in JavaVersion.toVersion() is much more robust as it correctly handles various Java version string formats (e.g., "1.8", "8", "17") and allows for safe comparison using JavaVersion enum constants.

  def testJavaVer = project.findProperty('testJavaVersion') ? JavaVersion.toVersion(project.property('testJavaVersion')) : JavaVersion.current()
  if (testJavaVer >= JavaVersion.VERSION_17) {

return [
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
]
}
return []
}

def getNexmarkArgs = {
def nexmarkArgsStr = project.findProperty(nexmarkArgsProperty) ?: ""
def nexmarkArgsList = new ArrayList<String>()
Expand Down Expand Up @@ -179,6 +192,7 @@ task run(type: JavaExec) {
systemProperty "spark.ui.showConsoleProgress", "false"
// Dataset runner only
systemProperty "spark.sql.shuffle.partitions", "4"
jvmArgs += sparkJvmArgs()
}

mainClass = "org.apache.beam.sdk.nexmark.Main"
Expand Down
14 changes: 14 additions & 0 deletions sdks/java/testing/tpcds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ if (isSpark) {
}
}

def sparkJvmArgs() {
def testJavaVer = project.findProperty('testJavaVersion') ? (project.property('testJavaVersion') as int) : JavaVersion.current().majorVersion.toInteger()
if (testJavaVer >= 17) {
return [
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
]
}
return []
}

// Execute the TPC-DS queries or suites via Gradle.
//
// Parameters:
Expand Down Expand Up @@ -141,6 +154,7 @@ task run(type: JavaExec) {
// Dataset runner only
systemProperty "spark.sql.shuffle.partitions", "4"
systemProperty "spark.sql.adaptive.enabled", "false" // high overhead for complex queries
jvmArgs += sparkJvmArgs()
}

mainClass = "org.apache.beam.sdk.tpcds.BeamTpcds"
Expand Down
Loading