public abstract class KeyValueDataFileWriter extends StatsCollectingSingleFileWriter<KeyValue,DataFileMeta>
StatsCollectingSingleFileWriter to write data files containing KeyValues. Also
produces DataFileMeta after writing a file.
NOTE: records given to the writer must be sorted because it does not compare the min max keys
to produce DataFileMeta.
SingleFileWriter.AbortExecutor| Modifier and Type | Field and Description |
|---|---|
protected RowType |
keyType |
protected RowType |
valueType |
closed, fileIO, path| Constructor and Description |
|---|
KeyValueDataFileWriter(FileIO fileIO,
FormatWriterFactory factory,
Path path,
java.util.function.Function<KeyValue,InternalRow> converter,
RowType keyType,
RowType valueType,
RowType writeRowType,
SimpleStatsExtractor simpleStatsExtractor,
long schemaId,
int level,
String compression,
CoreOptions options,
FileSource fileSource,
FileIndexOptions fileIndexOptions) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
DataFileMeta |
result() |
void |
write(KeyValue kv)
Add only one record to this file writer.
|
fieldStats, writeBundleabort, abortExecutor, path, reachTargetSize, recordCount, writeImplclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrite, write, writepublic KeyValueDataFileWriter(FileIO fileIO, FormatWriterFactory factory, Path path, java.util.function.Function<KeyValue,InternalRow> converter, RowType keyType, RowType valueType, RowType writeRowType, @Nullable SimpleStatsExtractor simpleStatsExtractor, long schemaId, int level, String compression, CoreOptions options, FileSource fileSource, FileIndexOptions fileIndexOptions)
public void write(KeyValue kv) throws IOException
FileWriterNOTE: If any exception occurs during writing, the writer should clean up useless files for the user.
write in interface FileWriter<KeyValue,DataFileMeta>write in class StatsCollectingSingleFileWriter<KeyValue,DataFileMeta>kv - to write.IOException - if encounter any IO error.@Nullable public DataFileMeta result() throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class SingleFileWriter<KeyValue,DataFileMeta>IOExceptionCopyright © 2023–2025 The Apache Software Foundation. All rights reserved.