Package org.apache.iceberg
Class ManifestFiles
- java.lang.Object
-
- org.apache.iceberg.ManifestFiles
-
public class ManifestFiles extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ManifestFile
decode(byte[] manifestData)
Decode the binary data into aManifestFile
.static byte[]
encode(ManifestFile manifestFile)
Encode theManifestFile
to a byte array by using avro encoder.static ManifestReader<DataFile>
read(ManifestFile manifest, FileIO io)
Returns a newManifestReader
for aManifestFile
.static ManifestReader<DataFile>
read(ManifestFile manifest, FileIO io, java.util.Map<java.lang.Integer,PartitionSpec> specsById)
Returns a newManifestReader
for aManifestFile
.static ManifestReader<DeleteFile>
readDeleteManifest(ManifestFile manifest, FileIO io, java.util.Map<java.lang.Integer,PartitionSpec> specsById)
Returns a newManifestReader
for aManifestFile
.static CloseableIterable<java.lang.String>
readPaths(ManifestFile manifest, FileIO io)
Returns aCloseableIterable
of file paths in theManifestFile
.static ManifestWriter<DataFile>
write(int formatVersion, PartitionSpec spec, OutputFile outputFile, java.lang.Long snapshotId)
Create a newManifestWriter
for the given format version.static ManifestWriter<DataFile>
write(PartitionSpec spec, OutputFile outputFile)
Create a newManifestWriter
.static ManifestWriter<DeleteFile>
writeDeleteManifest(int formatVersion, PartitionSpec spec, OutputFile outputFile, java.lang.Long snapshotId)
Create a newManifestWriter
for the given format version.
-
-
-
Method Detail
-
readPaths
public static CloseableIterable<java.lang.String> readPaths(ManifestFile manifest, FileIO io)
Returns aCloseableIterable
of file paths in theManifestFile
.- Parameters:
manifest
- a ManifestFileio
- a FileIO- Returns:
- a manifest reader
-
read
public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io)
Returns a newManifestReader
for aManifestFile
.Note: Callers should use
read(ManifestFile, FileIO, Map)
to ensure the schema used by filters is the latest table schema. This should be used only when reading a manifest without filters.- Parameters:
manifest
- a ManifestFileio
- a FileIO- Returns:
- a manifest reader
-
read
public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io, java.util.Map<java.lang.Integer,PartitionSpec> specsById)
Returns a newManifestReader
for aManifestFile
.- Parameters:
manifest
- aManifestFile
io
- aFileIO
specsById
- a Map from spec ID to partition spec- Returns:
- a
ManifestReader
-
write
public static ManifestWriter<DataFile> write(PartitionSpec spec, OutputFile outputFile)
Create a newManifestWriter
.Manifests created by this writer have all entry snapshot IDs set to null. All entries will inherit the snapshot ID that will be assigned to the manifest on commit.
- Parameters:
spec
-PartitionSpec
used to produceDataFile
partition tuplesoutputFile
- the destination file location- Returns:
- a manifest writer
-
write
public static ManifestWriter<DataFile> write(int formatVersion, PartitionSpec spec, OutputFile outputFile, java.lang.Long snapshotId)
Create a newManifestWriter
for the given format version.- Parameters:
formatVersion
- a target format versionspec
- aPartitionSpec
outputFile
- anOutputFile
where the manifest will be writtensnapshotId
- a snapshot ID for the manifest entries, or null for an inherited ID- Returns:
- a manifest writer
-
readDeleteManifest
public static ManifestReader<DeleteFile> readDeleteManifest(ManifestFile manifest, FileIO io, java.util.Map<java.lang.Integer,PartitionSpec> specsById)
Returns a newManifestReader
for aManifestFile
.- Parameters:
manifest
- aManifestFile
io
- aFileIO
specsById
- a Map from spec ID to partition spec- Returns:
- a
ManifestReader
-
writeDeleteManifest
public static ManifestWriter<DeleteFile> writeDeleteManifest(int formatVersion, PartitionSpec spec, OutputFile outputFile, java.lang.Long snapshotId)
Create a newManifestWriter
for the given format version.- Parameters:
formatVersion
- a target format versionspec
- aPartitionSpec
outputFile
- anOutputFile
where the manifest will be writtensnapshotId
- a snapshot ID for the manifest entries, or null for an inherited ID- Returns:
- a manifest writer
-
encode
public static byte[] encode(ManifestFile manifestFile) throws java.io.IOException
Encode theManifestFile
to a byte array by using avro encoder.- Parameters:
manifestFile
- aManifestFile
, which should always be aGenericManifestFile
.- Returns:
- the binary data.
- Throws:
java.io.IOException
- if encounter any IO error when encoding.
-
decode
public static ManifestFile decode(byte[] manifestData) throws java.io.IOException
Decode the binary data into aManifestFile
.- Parameters:
manifestData
- the binary data.- Returns:
- a
ManifestFile
. To be precise, it's aGenericManifestFile
which don't expose to public. - Throws:
java.io.IOException
- if encounter any IO error when decoding.
-
-