Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,21 @@ private[parquet] class AppendingParquetOutputFormat(offset: Int)

// override to choose output filename so not overwrite existing ones
override def getDefaultWorkFile(context: TaskAttemptContext, extension: String): Path = {
val taskId: TaskID = context.getTaskAttemptID.getTaskID
val taskId: TaskID = getTaskAttemptID(context).getTaskID
val partition: Int = taskId.getId
val filename = s"part-r-${partition + offset}.parquet"
val committer: FileOutputCommitter =
getOutputCommitter(context).asInstanceOf[FileOutputCommitter]
new Path(committer.getWorkPath, filename)
}

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

/**
Expand Down