Skip to content

Instantly share code, notes, and snippets.

@SingularBunny
Created November 20, 2019 18:24
Show Gist options
  • Save SingularBunny/1d6cbf9dd7aed3a9a0dcea8ef79448e8 to your computer and use it in GitHub Desktop.
Save SingularBunny/1d6cbf9dd7aed3a9a0dcea8ef79448e8 to your computer and use it in GitHub Desktop.
class DataFrameJoinSuite extends QueryTest with SharedSparkSession {
import testImplicits._
test("join - join using") {
val df = Seq(1, 2, 3).map(i => (i, i.toString)).toDF("int", "str")
val df2 = Seq(1, 2, 3).map(i => (i, (i + 1).toString)).toDF("int", "str")
checkAnswer(
df.join(df2, "int"),
Row(1, "1", "2") :: Row(2, "2", "3") :: Row(3, "3", "4") :: Nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment