iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
iceberg::ManifestReader Class Referenceabstract

Read manifest entries from a manifest file. More...

#include <manifest_reader.h>

Public Member Functions

Result< std::vector< ManifestEntry > > Entries ()
 Read all manifest entries in the manifest file.
 
Result< std::vector< ManifestEntry > > LiveEntries ()
 Read only live (non-deleted) manifest entries.
 
virtual Result< ManifestEntryStreamPtr > EntriesStream ()=0
 Lazily read manifest entries.
 
virtual Result< ManifestEntryStreamPtr > LiveEntriesStream ()=0
 Lazily read only live (non-deleted) manifest entries.
 
virtual ManifestReader & Select (const std::vector< std::string > &columns)=0
 Select specific columns of data file to read from the manifest entries.
 
virtual ManifestReader & FilterPartitions (std::shared_ptr< Expression > expr)=0
 Filter manifest entries by partition filter.
 
virtual ManifestReader & FilterPartitions (std::shared_ptr< class PartitionSet > partition_set)=0
 Filter manifest entries to a specific set of partitions.
 
virtual ManifestReader & FilterRows (std::shared_ptr< Expression > expr)=0
 Filter manifest entries by row-level filter.
 
virtual ManifestReader & CaseSensitive (bool case_sensitive)=0
 Set case sensitivity for column name matching.
 
virtual ManifestReader & TryDropStats ()=0
 Try to drop stats from returned DataFile objects.
 
virtual ManifestReader & SkipCounter (std::shared_ptr< Counter > counter)=0
 Set a counter to increment for each entry skipped by per-entry filters.
 

Static Public Member Functions

static bool ShouldDropStats (const std::vector< std::string > &columns)
 Determine whether stats should be dropped based on selected columns.
 
static Result< std::unique_ptr< ManifestReader > > Make (const ManifestFile &manifest, std::shared_ptr< FileIO > file_io, std::shared_ptr< Schema > schema, std::shared_ptr< PartitionSpec > spec, bool is_committed=true)
 Creates a reader for a manifest file.
 
static Result< std::unique_ptr< ManifestReader > > Make (const ManifestFile &manifest, std::shared_ptr< FileIO > file_io, std::shared_ptr< Schema > schema, const std::unordered_map< int32_t, std::shared_ptr< PartitionSpec > > &specs_by_id, bool is_committed=true)
 Creates a reader for a manifest file using specs keyed by ID.
 
static Result< std::unique_ptr< ManifestReader > > Make (std::string_view manifest_location, std::optional< int64_t > manifest_length, std::shared_ptr< FileIO > file_io, std::shared_ptr< Schema > schema, std::shared_ptr< PartitionSpec > spec, std::unique_ptr< InheritableMetadata > inheritable_metadata, std::optional< int64_t > first_row_id=std::nullopt, bool is_committed=true)
 Creates a reader for a manifest file.
 
static std::vector< std::string > WithStatsColumns (const std::vector< std::string > &columns)
 Add stats columns to the column list if needed.
 

Detailed Description

Read manifest entries from a manifest file.

Implementations must override EntriesStream() and LiveEntriesStream(), returning self-contained streams that may outlive the reader. Entries() and LiveEntries() collect these streams into vectors.

Member Function Documentation

◆ Entries()

Result< std::vector< ManifestEntry > > iceberg::ManifestReader::Entries ( )

Read all manifest entries in the manifest file.

Collects EntriesStream() into a vector.

◆ EntriesStream()

virtual Result< ManifestEntryStreamPtr > iceberg::ManifestReader::EntriesStream ( )
pure virtual

Lazily read manifest entries.

The returned stream is fallible and single-pass. It must own all resources required for consumption and must not depend on this reader remaining alive.

◆ FilterPartitions()

virtual ManifestReader & iceberg::ManifestReader::FilterPartitions ( std::shared_ptr< Expression >  expr)
pure virtual

Filter manifest entries by partition filter.

Note
Unlike the Java implementation, this method does not combine new expressions with existing ones. Each call replaces the previous partition filter.

◆ FilterRows()

virtual ManifestReader & iceberg::ManifestReader::FilterRows ( std::shared_ptr< Expression >  expr)
pure virtual

Filter manifest entries by row-level filter.

Note
Unlike the Java implementation, this method does not combine new expressions with existing ones. Each call replaces the previous row filter.

◆ LiveEntries()

Result< std::vector< ManifestEntry > > iceberg::ManifestReader::LiveEntries ( )

Read only live (non-deleted) manifest entries.

Collects LiveEntriesStream() into a vector.

◆ LiveEntriesStream()

virtual Result< ManifestEntryStreamPtr > iceberg::ManifestReader::LiveEntriesStream ( )
pure virtual

Lazily read only live (non-deleted) manifest entries.

The returned stream is fallible and single-pass. It must own all resources required for consumption and must not depend on this reader remaining alive.

◆ Make() [1/3]

static Result< std::unique_ptr< ManifestReader > > iceberg::ManifestReader::Make ( const ManifestFile &  manifest,
std::shared_ptr< FileIO >  file_io,
std::shared_ptr< Schema >  schema,
const std::unordered_map< int32_t, std::shared_ptr< PartitionSpec > > &  specs_by_id,
bool  is_committed = true 
)
static

Creates a reader for a manifest file using specs keyed by ID.

Parameters
manifestA ManifestFile object containing metadata about the manifest.
file_ioFile IO implementation to use.
schemaSchema used to bind the partition type.
specs_by_idMapping of partition spec ID to PartitionSpec.
is_committedWhether the manifest was committed by an older snapshot.
Returns
A Result containing the reader or an error.

◆ Make() [2/3]

static Result< std::unique_ptr< ManifestReader > > iceberg::ManifestReader::Make ( const ManifestFile &  manifest,
std::shared_ptr< FileIO >  file_io,
std::shared_ptr< Schema >  schema,
std::shared_ptr< PartitionSpec >  spec,
bool  is_committed = true 
)
static

Creates a reader for a manifest file.

Parameters
manifestA ManifestFile object containing metadata about the manifest.
file_ioFile IO implementation to use.
schemaSchema used to bind the partition type.
specPartition spec used for this manifest file.
is_committedWhether the manifest was committed by an older snapshot.
Returns
A Result containing the reader or an error.

◆ Make() [3/3]

static Result< std::unique_ptr< ManifestReader > > iceberg::ManifestReader::Make ( std::string_view  manifest_location,
std::optional< int64_t >  manifest_length,
std::shared_ptr< FileIO >  file_io,
std::shared_ptr< Schema >  schema,
std::shared_ptr< PartitionSpec >  spec,
std::unique_ptr< InheritableMetadata >  inheritable_metadata,
std::optional< int64_t >  first_row_id = std::nullopt,
bool  is_committed = true 
)
static

Creates a reader for a manifest file.

Parameters
manifest_locationPath to the manifest file.
manifest_lengthLength of the manifest file.
file_ioFile IO implementation to use.
schemaSchema used to bind the partition type.
specPartition spec used for this manifest file.
inheritable_metadataInheritable metadata.
first_row_idFirst row ID to use for the manifest entries.
is_committedWhether the manifest was committed by an older snapshot.
Returns
A Result containing the reader or an error.

◆ Select()

virtual ManifestReader & iceberg::ManifestReader::Select ( const std::vector< std::string > &  columns)
pure virtual

Select specific columns of data file to read from the manifest entries.

Note
Column names should match the names in DataFile schema. Unmatched names will be ignored.
An empty list selects no user columns. A list containing * selects all columns. If this method is not called, all columns are selected.

◆ ShouldDropStats()

static bool iceberg::ManifestReader::ShouldDropStats ( const std::vector< std::string > &  columns)
static

Determine whether stats should be dropped based on selected columns.

Returns true if the selected columns do not include any stats columns, or only include record_count (which is a primitive, not a large map).


The documentation for this class was generated from the following file: