1717 * under the License.
1818 */
1919
20- String sparkMajorVersion = ' 4.0 '
20+ String sparkMajorVersion = ' 4.1 '
2121String scalaVersion = ' 2.13'
2222
2323JavaVersion javaVersion = JavaVersion . current()
2424if (javaVersion != JavaVersion . VERSION_17 && javaVersion != JavaVersion . VERSION_21 ) {
25- throw new GradleException (" Spark 4.0 build requires JDK 17 or 21 but was executed with JDK " + javaVersion)
25+ throw new GradleException (" Spark 4.1 build requires JDK 17 or 21 but was executed with JDK " + javaVersion)
2626}
2727
2828def sparkProjects = [
@@ -47,6 +47,14 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") {
4747 apply plugin : ' scala'
4848 apply plugin : ' com.github.alisiikh.scalastyle'
4949
50+ // Set target to JDK17 for Spark 4.1 to fix following error
51+ // "spark/v4.1/spark/src/main/scala/org/apache/spark/sql/stats/ThetaSketchAgg.scala:52:12: Class java.lang.Record not found"
52+ tasks. withType(ScalaCompile . class) {
53+ sourceCompatibility = " 17"
54+ targetCompatibility = " 17"
55+ scalaCompileOptions. additionalParameters. add(" -release:17" )
56+ }
57+
5058 sourceSets {
5159 main {
5260 scala. srcDirs = [' src/main/scala' , ' src/main/java' ]
@@ -69,8 +77,9 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") {
6977 implementation(" org.apache.datasketches:datasketches-java:${ libs.versions.datasketches.get()} " )
7078
7179 compileOnly libs. errorprone. annotations
80+ compileOnly libs. jetbrain. annotations
7281 compileOnly libs. avro. avro
73- compileOnly(" org.apache.spark:spark-hive_${ scalaVersion} :${ libs.versions.spark40 .get()} " ) {
82+ compileOnly(" org.apache.spark:spark-hive_${ scalaVersion} :${ libs.versions.spark41 .get()} " ) {
7483 exclude group : ' org.apache.avro' , module : ' avro'
7584 exclude group : ' org.apache.arrow'
7685 exclude group : ' org.apache.parquet'
0 commit comments