Skip to content

Instantly share code, notes, and snippets.

@asm0dey
Created May 15, 2020 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asm0dey/cb1bc2a878d2f926b7ab9d7a77c8522d to your computer and use it in GitHub Desktop.
Save asm0dey/cb1bc2a878d2f926b7ab9d7a77c8522d to your computer and use it in GitHub Desktop.
package org.jetbrains.spark.api.examples
import org.jetbrains.spark.api.*
data class Left(val id: Int, val name: String)
data class Right(val id: Int, val value: Int)
fun main() {
withSpark {
val first = dsOf(Left(1, "a"), Left(2, "b"))
val second = dsOf(Right(1, 100), Right(3, 300))
first
.leftJoin(second, first.col("id").eq(second.col("id")))
.debugCodegen()
.also { it.show() }
.map { c(it.first.id, it.first.name, it.second?.value) }
.show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment