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 Dec 30, 2024
1 parent 64f1448 commit 8c803d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 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 @@ -36,11 +36,11 @@ 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)
}

Expand All @@ -65,7 +65,7 @@ impl MetadataTable {

/// Snapshots table.
pub struct SnapshotsTable<'a> {
metadata_table: &'a MetadataTable,
metadata_table: &'a MetadataTable<'a>,
}

impl<'a> SnapshotsTable<'a> {
Expand Down Expand Up @@ -147,7 +147,7 @@ impl<'a> SnapshotsTable<'a> {
/// `is_current_ancestor` indicates whether the snapshot is an ancestor of the
/// current snapshot. If `false`, then the snapshot was rolled back.
pub struct HistoryTable<'a> {
metadata_table: &'a MetadataTable,
metadata_table: &'a MetadataTable<'a>,
}

impl<'a> HistoryTable<'a> {
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 8c803d2

Please sign in to comment.