Skip to content

Commit ec213c1

Browse files
committed
Use reflection to prevent breaking binary-compatibility.
1 parent 127e97b commit ec213c1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetTableOperations.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,17 @@ private[parquet] class AppendingParquetOutputFormat(offset: Int)
331331

332332
// override to choose output filename so not overwrite existing ones
333333
override def getDefaultWorkFile(context: TaskAttemptContext, extension: String): Path = {
334-
val taskId: TaskID = context.getTaskAttemptID.getTaskID
334+
val taskId: TaskID = getTaskAttemptID(context).getTaskID
335335
val partition: Int = taskId.getId
336336
val filename = s"part-r-${partition + offset}.parquet"
337337
val committer: FileOutputCommitter =
338338
getOutputCommitter(context).asInstanceOf[FileOutputCommitter]
339339
new Path(committer.getWorkPath, filename)
340340
}
341+
342+
private def getTaskAttemptID(context: TaskAttemptContext): TaskAttemptID = {
343+
context.getClass.getMethod("getTaskAttemptID").invoke(context).asInstanceOf[TaskAttemptID]
344+
}
341345
}
342346

343347
/**

0 commit comments

Comments
 (0)