jerryshao commented on a change in pull request #374: Migrate spark table to
iceberg table
URL: https://github.com/apache/incubator-iceberg/pull/374#discussion_r319342815
##########
File path: spark/src/main/scala/org/apache/iceberg/spark/SparkTableUtil.scala
##########
@@ -297,5 +306,104 @@ object SparkTableUtil {
)
}
}
+
+ private def buildManifest(conf: SerializableConfiguration,
+ sparkDataFiles: Seq[SparkDataFile],
+ partitionSpec: PartitionSpec,
+ basePath: String): Iterator[Manifest] = {
+ if (sparkDataFiles.isEmpty) {
+ Seq.empty.iterator
+ }
+
+ val io = new HadoopFileIO(conf.get())
+ val ctx = TaskContext.get()
+ val location = new Path(basePath,
+ s"stage-${ctx.stageId()}-task-${ctx.taskAttemptId()}-manifest")
+ val outputFile =
io.newOutputFile(FileFormat.AVRO.addExtension(location.toString))
+ val writer = ManifestWriter.write(partitionSpec, outputFile)
+ try {
+ sparkDataFiles.foreach { file =>
+ writer.add(file.toDataFile(partitionSpec))
Review comment:
What will be happened if an exception is raised here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]