-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.4+ #218
Draft
Jolanrensen
wants to merge
40
commits into
main
Choose a base branch
from
3.4+
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
3.4+ #218
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…urely in Kotlin. Not complete yet
…he new kotlinEncoderFor<>()
…the expression encoder without spark-connect
… in favor of upcoming IR compiler plugin
… in favor of upcoming IR compiler plugin. Removed spark dependency in scala-helpers
… as separate module
…lass, which can be done with gradle plugin
….NoSuchMethodException: org.jetbrains.kotlinx.spark.api.RddTest$1$1$1$2$2$1.$deserializeLambda$(java.lang.invoke.SerializedLambda)
a) it can build gradle-plugin and compiler-plugin with bootstrap jars without mavenLocal. b) bootstrap jars are updated before the actual build
…lus added test to see if the plugin is enabled in the project
…, and LocalDate, Duration not working
added encoding for KotlinX: DatePeriod, DateTimePeriod, Instant, LocalDateTime, and LocalDate, kotlin.time.Duration is sadly not working as it's a value class. (I think that's the reason) |
…sion for jupyter. Disabled html renderes in favor of just outputting them as text. Notebooks can render them however they like. RDDs are converted to ds before rendering
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #195, which is a fun read if you're interested in the process :)
This is a work-in-progress overhaul of the core parts of the library to support Spark 3.4+.
Why
What has changed
:core
module entirely. No more spark-package injected code that can break at the bytecode level.:scala-helpers
module which doesn't even depend on Spark atm. We just need the VarargUnwrapper class.AgnosticEncoder
as a sort-of intermediate step in building anEncoder
for the data. This non-implementation-specific encoder can be turned into an actual encoder by passing it toExpressionEncoder()
or into something entirely different (which is what makes Spark Connect possible).KotlinTypeInference.encoderFor
implementation is a mix of the Java and Scala types, supporting both Scala/Java lists, primitives, scala Tuples, and most importantly Kotlin data classes.AgnosticEncoder
is that we are limited to theAgnosticEncoders
offered to us by Spark. We cannot write our own (de)serializers anymore if we want to support Spark Connect. So, in order to support data classes, we need to hijackProductEncoder
.ProductEncoder
works fine, but for serializing we hit a snag. In Scala, case classes have a function with the same name as each property. This assumption is used under the hood, so we need to make sure those functions exist in our data classes.Plus, later I found this function to do an actual instance check to see if the value is a
scala.Product
... It's compiler plugin time!to
satisfying both needs from Spark. One downside of this approach is that now you need to annotate each data class you want to encode with
@Sparkify
(else the column names will begetName
andgetAge
). And you cannot annotate external data classes likePair
:/ So I recommend working with tuples from now on (or make your own@Sparkify Pair
).:compiler-plugin
) is going to be applicable to your Gradle project by the gradle plugin (:gradle-plugin
) withid("org.jetbrains.kotlinx.spark.api") version X
or in maven with the<compilerPlugins>
tag (probably).:kotlin-spark-api
and:examples
modules also depend on these two plugins for their tests. This is done with a gradle trick that updates bootstrap jars and adds them to the classpath/repository.freeCompilerArgs.add("-Xlambdas=class")
since Spark cannot serialize lamdas otherwise. If you use the gradle plugin, this is done for you.TODO
Pair
/Triple
Instant
,LocalDateTime
etc.