Search in sources :

Example 1 with FilesForCommit

use of org.apache.iceberg.mr.hive.FilesForCommit in project hive by apache.

the class HiveIcebergWriterBase method close.

@Override
public void close(boolean abort) throws IOException {
    writer.close();
    FilesForCommit result = files();
    // If abort then remove the unnecessary files
    if (abort) {
        Tasks.foreach(result.allFiles()).retry(3).suppressFailureWhenFinished().onFailure((file, exception) -> LOG.debug("Failed on to remove file {} on abort", file, exception)).run(file -> io.deleteFile(file.path().toString()));
    }
    LOG.info("HiveIcebergWriter is closed with abort={}. Created {} data files and {} delete files", abort, result.dataFiles().size(), result.deleteFiles().size());
}
Also used : PartitioningWriter(org.apache.iceberg.io.PartitioningWriter) Logger(org.slf4j.Logger) InternalRecordWrapper(org.apache.iceberg.data.InternalRecordWrapper) Maps(org.apache.iceberg.relocated.com.google.common.collect.Maps) LoggerFactory(org.slf4j.LoggerFactory) FilesForCommit(org.apache.iceberg.mr.hive.FilesForCommit) IOException(java.io.IOException) Schema(org.apache.iceberg.Schema) Record(org.apache.iceberg.data.Record) Tasks(org.apache.iceberg.util.Tasks) Map(java.util.Map) PartitionSpec(org.apache.iceberg.PartitionSpec) PartitionKey(org.apache.iceberg.PartitionKey) FileIO(org.apache.iceberg.io.FileIO) FilesForCommit(org.apache.iceberg.mr.hive.FilesForCommit)

Aggregations

IOException (java.io.IOException)1 Map (java.util.Map)1 PartitionKey (org.apache.iceberg.PartitionKey)1 PartitionSpec (org.apache.iceberg.PartitionSpec)1 Schema (org.apache.iceberg.Schema)1 InternalRecordWrapper (org.apache.iceberg.data.InternalRecordWrapper)1 Record (org.apache.iceberg.data.Record)1 FileIO (org.apache.iceberg.io.FileIO)1 PartitioningWriter (org.apache.iceberg.io.PartitioningWriter)1 FilesForCommit (org.apache.iceberg.mr.hive.FilesForCommit)1 Maps (org.apache.iceberg.relocated.com.google.common.collect.Maps)1 Tasks (org.apache.iceberg.util.Tasks)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1