Created
June 4, 2019 07:03
-
-
Save dmateusp/4cef1b6d28208e04a16235178189ec8e to your computer and use it in GitHub Desktop.
DataFrame.transform - Spark Function Composition - final functions examples
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
// chain transform calls | |
dfTransactions | |
.transform(extractPayerBeneficiary("details")) | |
.transform(sumAmounts(date_trunc("day", col("ts")), col("details_beneficiary"))) | |
// andThen | |
dfTransactions | |
.transform(extractPayerBeneficiary("details") andThen sumAmounts(date_trunc("day", col("ts")), col("details_beneficiary"))) | |
// compose | |
dfTransactions | |
.transform(sumAmounts(date_trunc("day", col("ts")), col("details_beneficiary")) compose extractPayerBeneficiary("details")) | |
// Function.chain | |
dfTransactions | |
.transform(Function.chain(List(extractPayerBeneficiary("details"), sumAmounts(date_trunc("day", col("ts")), col("details_beneficiary"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment