Skip to content

Commit

Permalink
[SPARK-44361][SQL][FOLLOWUP] Use PartitionEvaluator API in MapInBatch…
Browse files Browse the repository at this point in the history
…Exec

### What changes were proposed in this pull request?
This is a follow-up of apache#42024, to set the partition index correctly even if it's not used for now.

### Why are the changes needed?
future-proof

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

existing tests

Closes apache#42189 from vinodkc/br_SPARK-44361_Followup.

Authored-by: Vinod KC <vinod.kc.in@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
  • Loading branch information
vinodkc authored and cloud-fan committed Jul 28, 2023
1 parent f235c9f commit 3cf88cb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ trait MapInBatchExec extends UnaryExecNode with PythonSQLMetrics {
if (conf.usePartitionEvaluator) {
rddBarrier.mapPartitionsWithEvaluator(evaluatorFactory)
} else {
rddBarrier.mapPartitions { iter =>
evaluatorFactory.createEvaluator().eval(0, iter)
rddBarrier.mapPartitionsWithIndex { (index, iter) =>
evaluatorFactory.createEvaluator().eval(index, iter)
}
}
} else {
val inputRdd = child.execute()
if (conf.usePartitionEvaluator) {
inputRdd.mapPartitionsWithEvaluator(evaluatorFactory)
} else {
inputRdd.mapPartitionsInternal { iter =>
evaluatorFactory.createEvaluator().eval(0, iter)
inputRdd.mapPartitionsWithIndexInternal { (index, iter) =>
evaluatorFactory.createEvaluator().eval(index, iter)
}
}
}
Expand Down

0 comments on commit 3cf88cb

Please sign in to comment.