Skip to content

Commit

Permalink
Use reflection to prevent breaking binary-compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
ueshin committed Oct 2, 2014
1 parent 127e97b commit ec213c1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,17 @@ 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)
}

private def getTaskAttemptID(context: TaskAttemptContext): TaskAttemptID = {
context.getClass.getMethod("getTaskAttemptID").invoke(context).asInstanceOf[TaskAttemptID]
}
}

/**
Expand Down

0 comments on commit ec213c1

Please sign in to comment.