You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`PartitionEvaluator[T, U]` is an [abstraction](#contract) of [partition evaluators](#implementations) that can [compute (_evaluate_) one or more RDD partitions](#eval).
9
+
10
+
## Contract
11
+
12
+
### Evaluate Partitions { #eval }
13
+
14
+
```scala
15
+
eval(
16
+
partitionIndex: Int,
17
+
inputs: Iterator[T]*):Iterator[U]
18
+
```
19
+
20
+
Used when:
21
+
22
+
*`MapPartitionsWithEvaluatorRDD` is requested to [compute a partition](rdd/MapPartitionsWithEvaluatorRDD.md#compute)
23
+
*`ZippedPartitionsWithEvaluatorRDD` is requested to [compute a partition](rdd/ZippedPartitionsWithEvaluatorRDD.md#compute)
24
+
25
+
## Implementations
26
+
27
+
!!! note
28
+
No built-in implementations available in Spark Core (but [Spark SQL]({{ book.spark_sql }})).
*[RDD.mapPartitionsWithEvaluator](RDD.md#mapPartitionsWithEvaluator) operator is used
15
+
*[RDDBarrier.mapPartitionsWithEvaluator](../barrier-execution-mode/RDDBarrier.md#mapPartitionsWithEvaluator) operator is used
16
+
17
+
## Computing Partition { #compute }
18
+
19
+
??? note "RDD"
20
+
21
+
```scala
22
+
compute(
23
+
split: Partition,
24
+
context: TaskContext): Iterator[U]
25
+
```
26
+
27
+
`compute` is part of the [RDD](RDD.md#compute) abstraction.
28
+
29
+
`compute` requests the [PartitionEvaluatorFactory](#evaluatorFactory) to [create a PartitionEvaluator](../PartitionEvaluatorFactory.md#createEvaluator).
30
+
31
+
`compute` requests the [first parent RDD](RDD.md#firstParent) to [iterator](RDD.md#iterator).
32
+
33
+
In the end, `compute` requests the [PartitionEvaluator](../PartitionEvaluator.md) to [evaluate the partition](../PartitionEvaluator.md#eval).
`mapPartitionsWithEvaluator` creates a [MapPartitionsWithEvaluatorRDD](MapPartitionsWithEvaluatorRDD.md) for this `RDD` and the given [PartitionEvaluatorFactory](../PartitionEvaluatorFactory.md).
`zipPartitionsWithEvaluator` creates a [ZippedPartitionsWithEvaluatorRDD](ZippedPartitionsWithEvaluatorRDD.md) for this `RDD` and the given `RDD` and the [PartitionEvaluatorFactory](../PartitionEvaluatorFactory.md).
0 commit comments