Skip to content

Commit efd3784

Browse files
committed
Add a comment to explain the reason to use reflection.
1 parent ec213c1 commit efd3784

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ private[parquet] class AppendingParquetOutputFormat(offset: Int)
339339
new Path(committer.getWorkPath, filename)
340340
}
341341

342+
// The TaskAttemptContext is a class in hadoop-1 but is an interface in hadoop-2.
343+
// The signatures of the method TaskAttemptContext.getTaskAttemptID for the both versions
344+
// are the same, so the method calls are source-compatible but NOT binary-compatible because
345+
// the opcode of method call for class is INVOKEVIRTUAL and for interface is INVOKEINTERFACE.
342346
private def getTaskAttemptID(context: TaskAttemptContext): TaskAttemptID = {
343347
context.getClass.getMethod("getTaskAttemptID").invoke(context).asInstanceOf[TaskAttemptID]
344348
}

0 commit comments

Comments
 (0)