Skip to content

Commit 98e9ede

Browse files
committed
comments
1 parent c754b85 commit 98e9ede

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V1FallbackWriters.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ case class AppendDataExecV1(
3838
table: SupportsWrite,
3939
writeOptions: CaseInsensitiveStringMap,
4040
plan: LogicalPlan,
41-
afterWrite: () => Unit) extends V1FallbackWriters {
41+
refreshCache: () => Unit) extends V1FallbackWriters {
4242

4343
override protected def run(): Seq[InternalRow] = {
44-
writeWithV1(newWriteBuilder().buildForV1Write(), afterWrite = afterWrite)
44+
writeWithV1(newWriteBuilder().buildForV1Write(), refreshCache = refreshCache)
4545
}
4646
}
4747

@@ -61,7 +61,7 @@ case class OverwriteByExpressionExecV1(
6161
deleteWhere: Array[Filter],
6262
writeOptions: CaseInsensitiveStringMap,
6363
plan: LogicalPlan,
64-
afterWrite: () => Unit) extends V1FallbackWriters {
64+
refreshCache: () => Unit) extends V1FallbackWriters {
6565

6666
private def isTruncate(filters: Array[Filter]): Boolean = {
6767
filters.length == 1 && filters(0).isInstanceOf[AlwaysTrue]
@@ -70,11 +70,11 @@ case class OverwriteByExpressionExecV1(
7070
override protected def run(): Seq[InternalRow] = {
7171
newWriteBuilder() match {
7272
case builder: SupportsTruncate if isTruncate(deleteWhere) =>
73-
writeWithV1(builder.truncate().asV1Builder.buildForV1Write(), afterWrite = afterWrite)
73+
writeWithV1(builder.truncate().asV1Builder.buildForV1Write(), refreshCache = refreshCache)
7474

7575
case builder: SupportsOverwrite =>
7676
writeWithV1(builder.overwrite(deleteWhere).asV1Builder.buildForV1Write(),
77-
afterWrite = afterWrite)
77+
refreshCache = refreshCache)
7878

7979
case _ =>
8080
throw new SparkException(s"Table does not support overwrite by expression: $table")
@@ -117,11 +117,11 @@ trait SupportsV1Write extends SparkPlan {
117117

118118
protected def writeWithV1(
119119
relation: InsertableRelation,
120-
afterWrite: () => Unit = () => ()): Seq[InternalRow] = {
120+
refreshCache: () => Unit = () => ()): Seq[InternalRow] = {
121121
val session = sqlContext.sparkSession
122122
// The `plan` is already optimized, we should not analyze and optimize it again.
123123
relation.insert(AlreadyOptimized.dataFrame(session, plan), overwrite = false)
124-
afterWrite()
124+
refreshCache()
125125

126126
Nil
127127
}

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ case class AppendDataExec(
216216
table: SupportsWrite,
217217
writeOptions: CaseInsensitiveStringMap,
218218
query: SparkPlan,
219-
afterWrite: () => Unit) extends V2TableWriteExec with BatchWriteHelper {
219+
refreshCache: () => Unit) extends V2TableWriteExec with BatchWriteHelper {
220220

221221
override protected def run(): Seq[InternalRow] = {
222222
val writtenRows = writeWithV2(newWriteBuilder().buildForBatch())
223-
afterWrite()
223+
refreshCache()
224224
writtenRows
225225
}
226226
}
@@ -240,7 +240,7 @@ case class OverwriteByExpressionExec(
240240
deleteWhere: Array[Filter],
241241
writeOptions: CaseInsensitiveStringMap,
242242
query: SparkPlan,
243-
afterWrite: () => Unit) extends V2TableWriteExec with BatchWriteHelper {
243+
refreshCache: () => Unit) extends V2TableWriteExec with BatchWriteHelper {
244244

245245
private def isTruncate(filters: Array[Filter]): Boolean = {
246246
filters.length == 1 && filters(0).isInstanceOf[AlwaysTrue]
@@ -257,7 +257,7 @@ case class OverwriteByExpressionExec(
257257
case _ =>
258258
throw new SparkException(s"Table does not support overwrite by expression: $table")
259259
}
260-
afterWrite()
260+
refreshCache()
261261
writtenRows
262262
}
263263
}
@@ -276,7 +276,7 @@ case class OverwritePartitionsDynamicExec(
276276
table: SupportsWrite,
277277
writeOptions: CaseInsensitiveStringMap,
278278
query: SparkPlan,
279-
afterWrite: () => Unit) extends V2TableWriteExec with BatchWriteHelper {
279+
refreshCache: () => Unit) extends V2TableWriteExec with BatchWriteHelper {
280280

281281
override protected def run(): Seq[InternalRow] = {
282282
val writtenRows = newWriteBuilder() match {
@@ -286,7 +286,7 @@ case class OverwritePartitionsDynamicExec(
286286
case _ =>
287287
throw new SparkException(s"Table does not support dynamic partition overwrite: $table")
288288
}
289-
afterWrite()
289+
refreshCache()
290290
writtenRows
291291
}
292292
}

0 commit comments

Comments
 (0)