Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
qishipengqsp committed Sep 19, 2024
1 parent 4a30958 commit 4595000
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,23 @@ class ActivityGenerator()(implicit spark: SparkSession)
loanRDD: RDD[Loan],
accountRDD: RDD[Account]
): (RDD[Loan]) = {
val sampledAccounts = spark.sparkContext.broadcast(
accountRDD
val numPartition = loanRDD.getNumPartitions
loanRDD.mapPartitionsWithIndex((index, loans) => {
val sampledAccounts = accountRDD
.sample(
withReplacement = false,
DatagenParams.loanInvolvedAccountsFraction,
DatagenParams.loanInvolvedAccountsFraction / numPartition,
sampleRandom.nextLong()
)
.collect()
.toList
)
.asJava

loanRDD.mapPartitionsWithIndex((index, loans) => {
val loanSubEvents = new LoanActivitiesEvents
loanSubEvents
.afterLoanApplied(
loans.toList.asJava,
sampledAccounts.value.asJava,
sampledAccounts,
index
)
.iterator()
Expand Down

0 comments on commit 4595000

Please sign in to comment.