Skip to content

Commit

Permalink
Address comments from #822
Browse files Browse the repository at this point in the history
  • Loading branch information
rshkv committed Jan 2, 2025
1 parent 6e64d88 commit 3875931
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/iceberg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mod avro;
pub mod io;
pub mod spec;

pub mod metadata_scan;
pub mod metadata_table;
pub mod scan;

pub mod expr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,27 @@ use crate::Result;
/// - <https://iceberg.apache.org/docs/latest/spark-queries/#querying-with-sql>
/// - <https://py.iceberg.apache.org/api/#inspecting-tables>
#[derive(Debug)]
pub struct MetadataTable(Table);
pub struct MetadataTable<'a>(&'a Table);

impl MetadataTable {
impl<'a> MetadataTable<'a> {
/// Creates a new metadata scan.
pub(super) fn new(table: Table) -> Self {
pub(super) fn new(table: &'a Table) -> Self {
Self(table)
}

/// Get the history table.
pub fn history(&self) -> HistoryTable {
HistoryTable { table: &self.0 }
HistoryTable { table: self.0 }
}

/// Get the snapshots table.
pub fn snapshots(&self) -> SnapshotsTable {
SnapshotsTable { table: &self.0 }
SnapshotsTable { table: self.0 }
}

/// Get the manifests table.
pub fn manifests(&self) -> ManifestsTable {
ManifestsTable { table: &self.0 }
ManifestsTable { table: self.0 }
}
}

Expand Down Expand Up @@ -591,7 +591,7 @@ mod tests {
partition_summaries: ListArray
[
StructArray
-- validity:
-- validity:
[
valid,
]
Expand Down
4 changes: 2 additions & 2 deletions crates/iceberg/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::sync::Arc;
use crate::arrow::ArrowReaderBuilder;
use crate::io::object_cache::ObjectCache;
use crate::io::FileIO;
use crate::metadata_scan::MetadataTable;
use crate::metadata_table::MetadataTable;
use crate::scan::TableScanBuilder;
use crate::spec::{TableMetadata, TableMetadataRef};
use crate::{Error, ErrorKind, Result, TableIdent};
Expand Down Expand Up @@ -203,7 +203,7 @@ impl Table {

/// Creates a metadata table which provides table-like APIs for inspecting metadata.
/// See [`MetadataTable`] for more details.
pub fn metadata_table(self) -> MetadataTable {
pub fn metadata_table(&self) -> MetadataTable<'_> {
MetadataTable::new(self)
}

Expand Down

0 comments on commit 3875931

Please sign in to comment.