Skip to content

Instantly share code, notes, and snippets.

@dmateusp
Last active June 3, 2019 10:07
Show Gist options
  • Save dmateusp/f094e352a3643c998d64db07652cd051 to your computer and use it in GitHub Desktop.
Save dmateusp/f094e352a3643c998d64db07652cd051 to your computer and use it in GitHub Desktop.
DataFrame.transform - Spark Function Composition - Transactions
case class Transaction(details: String, amount: Int, ts: Timestamp)
val dfTransactions: DataFrame = Seq(
Transaction("paid by A to X", 100, Timestamp.valueOf("2018-01-05 08:00:00")),
Transaction("paid by B to X", 10, Timestamp.valueOf("2018-01-05 11:00:00")),
Transaction("paid by C to Y", 15, Timestamp.valueOf("2018-01-06 12:00:00")),
Transaction("paid by D to Z", 50, Timestamp.valueOf("2018-01-06 15:00:00"))
).toDF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment