File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
core/src/main/scala/org/apache/spark/util Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -84,10 +84,11 @@ abstract class AccumulatorV2[IN, OUT] extends Serializable {
8484 * Returns the name of this accumulator, can only be called after registration.
8585 */
8686 final def name : Option [String ] = {
87+ assertMetadataNotNull()
88+
8789 if (atDriverSide) {
88- AccumulatorContext .get(id).flatMap(_.metadata.name)
90+ metadata.name.orElse( AccumulatorContext .get(id).flatMap(_.metadata.name) )
8991 } else {
90- assertMetadataNotNull()
9192 metadata.name
9293 }
9394 }
@@ -165,9 +166,7 @@ abstract class AccumulatorV2[IN, OUT] extends Serializable {
165166 }
166167 val copyAcc = copyAndReset()
167168 assert(copyAcc.isZero, " copyAndReset must return a zero value copy" )
168- val isInternalAcc =
169- (name.isDefined && name.get.startsWith(InternalAccumulator .METRICS_PREFIX )) ||
170- getClass.getSimpleName == " SQLMetric"
169+ val isInternalAcc = name.isDefined && name.get.startsWith(InternalAccumulator .METRICS_PREFIX )
171170 if (isInternalAcc) {
172171 // Do not serialize the name of internal accumulator and send it to executor.
173172 copyAcc.metadata = metadata.copy(name = None )
You can’t perform that action at this time.
0 commit comments