public class KeyValueDataFileWriter extends StatsCollectingSingleFileWriter<KeyValue,DataFileMeta>
StatsCollectingSingleFileWriter
to write data files containing KeyValue
s. 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
.
closed, path
Constructor and Description |
---|
KeyValueDataFileWriter(org.apache.flink.api.common.serialization.BulkWriter.Factory<org.apache.flink.table.data.RowData> factory,
org.apache.flink.core.fs.Path path,
java.util.function.Function<KeyValue,org.apache.flink.table.data.RowData> converter,
org.apache.flink.table.types.logical.RowType keyType,
org.apache.flink.table.types.logical.RowType valueType,
FileStatsExtractor fileStatsExtractor,
long schemaId,
int level) |
Modifier and Type | Method and Description |
---|---|
DataFileMeta |
result() |
void |
write(KeyValue kv)
Add only one record to this file writer.
|
fieldStats
abort, close, length, path, recordCount, writeImpl
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
write, write, write
public KeyValueDataFileWriter(org.apache.flink.api.common.serialization.BulkWriter.Factory<org.apache.flink.table.data.RowData> factory, org.apache.flink.core.fs.Path path, java.util.function.Function<KeyValue,org.apache.flink.table.data.RowData> converter, org.apache.flink.table.types.logical.RowType keyType, org.apache.flink.table.types.logical.RowType valueType, @Nullable FileStatsExtractor fileStatsExtractor, long schemaId, int level)
public void write(KeyValue kv) throws IOException
FileWriter
NOTE: 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
IOException
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.