Kotlin / kotlin-spark-api

This projects gives Kotlin bindings and several extensions for Apache Spark. We are looking to have this as a part of Apache Spark 3.x
Apache License 2.0
455 stars 34 forks source link

for JVM target 1.8 #190

Closed emesday closed 1 year ago

emesday commented 1 year ago

My existing Scala Spark (using sbt) project which compiled with -source 1.8 -target 1.8 shows

Kotlin: Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

Should I rebuild this project with 8 (which replaces 11 below)

https://github.com/Kotlin/kotlin-spark-api/blob/fd3299b3889e7acb2d02a27124f018d2678efd3f/buildSrc/src/main/kotlin/Versions.kt#L5


I tried:

libraryDependencies ++= Seq(
  "org.jetbrains.kotlin" % "kotlin-stdlib" % "1.7.22",
  "org.jetbrains.kotlinx.spark" % "kotlin-spark-api_3.1.2_2.12" % "1.2.2"
)

and the kotlin code was

fun main() {
    println("hello")
    withSpark {
        dsOf(1, 2, 3).show()
    }
}

.

without withSpark block, it works and shows

hello
Jolanrensen commented 1 year ago

Copy of https://github.com/Kotlin/kotlin-spark-api/issues/186, https://github.com/Kotlin/kotlin-spark-api/issues/183, fixed in https://github.com/Kotlin/kotlin-spark-api/pull/189 Already released the fix in the dev version https://github.com/orgs/Kotlin/packages?tab=packages&q=kotlin-spark-api and I´m in the process right now of releasing version 1.2.3 which will have full java 8 support.

Jolanrensen commented 1 year ago

https://github.com/Kotlin/kotlin-spark-api/releases/tag/1.2.3

emesday commented 1 year ago

It works! Thanks.

I tested with

// in sbt
libraryDependencies ++= Seq("org.jetbrains.kotlinx.spark" % s"kotlin-spark-api_3.1.2_2.12" % "1.2.3")