Skip to content

Commit 5f4be55

Browse files
Use copy to simplify my life
Co-authored-by: Holden Karau <holden@pigscanfly.ca>
1 parent 383ae0b commit 5f4be55

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ case class AttributeReference(
341341
if (nullable == newNullability) {
342342
this
343343
} else {
344-
AttributeReference(name, dataType, newNullability, metadata, determinism)(exprId, qualifier)
344+
this.copy(nullable = newNullability)(exprId, qualifier)
345345
}
346346
}
347347

@@ -352,15 +352,15 @@ case class AttributeReference(
352352
if (determinism == newDeterminism) {
353353
this
354354
} else {
355-
AttributeReference(name, dataType, nullable, metadata, newDeterminism)(exprId, qualifier)
355+
this.copy(determinism = newDeterminism)(exprId, qualifier)
356356
}
357357
}
358358

359359
override def withName(newName: String): AttributeReference = {
360360
if (name == newName) {
361361
this
362362
} else {
363-
AttributeReference(newName, dataType, nullable, metadata, determinism)(exprId, qualifier)
363+
this.copy(name = newName)(exprId, qualifier)
364364
}
365365
}
366366

@@ -371,24 +371,24 @@ case class AttributeReference(
371371
if (newQualifier == qualifier) {
372372
this
373373
} else {
374-
AttributeReference(name, dataType, nullable, metadata, determinism)(exprId, newQualifier)
374+
this.copy()(exprId, newQualifier)
375375
}
376376
}
377377

378378
override def withExprId(newExprId: ExprId): AttributeReference = {
379379
if (exprId == newExprId) {
380380
this
381381
} else {
382-
AttributeReference(name, dataType, nullable, metadata, determinism)(newExprId, qualifier)
382+
this.copy()(newExprId, qualifier)
383383
}
384384
}
385385

386386
override def withMetadata(newMetadata: Metadata): AttributeReference = {
387-
AttributeReference(name, dataType, nullable, newMetadata, determinism)(exprId, qualifier)
387+
this.copy(metadata = newMetadata)(exprId, qualifier)
388388
}
389389

390390
override def withDataType(newType: DataType): AttributeReference = {
391-
AttributeReference(name, newType, nullable, metadata, determinism)(exprId, qualifier)
391+
this.copy(dataType = newType)(exprId, qualifier)
392392
}
393393

394394
override protected final def otherCopyArgs: Seq[AnyRef] = {

0 commit comments

Comments
 (0)