From eb01f30bd0c610fa60aaad8179095f12176421b3 Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Tue, 23 Sep 2025 14:54:36 +0100 Subject: [PATCH] ci: handle warnings in compileScala as errors Enable the `-Xfatal-warnings` flag for the Scala compiler to turn warnings into errors (i.e. fail the build). Suppress this warning for the case where the spark converter is handling deprecated substrait enum values in the Join relation. We still want the converter to hande this legacy value without throwing an exception. Signed-off-by: Andrew Coleman --- spark/build.gradle.kts | 4 +++- .../main/scala/io/substrait/spark/logical/ToLogicalPlan.scala | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spark/build.gradle.kts b/spark/build.gradle.kts index 41837b386..f4d5c84e1 100644 --- a/spark/build.gradle.kts +++ b/spark/build.gradle.kts @@ -102,7 +102,9 @@ java { withSourcesJar() } -tasks.withType() { scalaCompileOptions.additionalParameters = listOf("-release:17") } +tasks.withType() { + scalaCompileOptions.additionalParameters = listOf("-release:17", "-Xfatal-warnings") +} var SPARKBUNDLE_VERSION = properties.get("sparkbundle.version") diff --git a/spark/src/main/scala/io/substrait/spark/logical/ToLogicalPlan.scala b/spark/src/main/scala/io/substrait/spark/logical/ToLogicalPlan.scala index aaf08ba07..1f3c4e97c 100644 --- a/spark/src/main/scala/io/substrait/spark/logical/ToLogicalPlan.scala +++ b/spark/src/main/scala/io/substrait/spark/logical/ToLogicalPlan.scala @@ -50,6 +50,7 @@ import io.substrait.relation.files.FileFormat import io.substrait.util.EmptyVisitationContext import org.apache.hadoop.fs.Path +import scala.annotation.nowarn import scala.collection.JavaConverters.asScalaBufferConverter import scala.collection.mutable.ArrayBuffer @@ -180,6 +181,7 @@ class ToLogicalPlan(spark: SparkSession = SparkSession.builder().getOrCreate()) } } + @nowarn("cat=deprecation") override def visit(join: relation.Join, context: EmptyVisitationContext): LogicalPlan = { val left = join.getLeft.accept(this, context) val right = join.getRight.accept(this, context)