a-agmon commented on code in PR #259:
URL: https://github.com/apache/iceberg-rust/pull/259#discussion_r1522787615


##########
crates/iceberg/src/static_table.rs:
##########
@@ -0,0 +1,146 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! `StaticTable` is a read-only table struct that can be created from a 
metadata file or from `TableMetaData` without a catalog.
+//! It can only be used to read metadata and for table scan.
+//! For example:
+//! ```rust, compile_fail

Review Comment:
   I added the `compile_fail` flag because the example involves async code that 
requires runtime, and I didn't want to mess up the code example. I will add it. 



##########
crates/iceberg/src/static_table.rs:
##########
@@ -0,0 +1,146 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! `StaticTable` is a read-only table struct that can be created from a 
metadata file or from `TableMetaData` without a catalog.
+//! It can only be used to read metadata and for table scan.
+//! For example:
+//! ```rust, compile_fail
+//! let metadata_file_location = "s3://bucket_name/path/to/metadata.json";
+//! let file_io = FileIO::from_path(&metadata_file_location).unwrap().build()?;
+//! let static_table = 
StaticTable::from_metadata_file(&metadata_file_location, 
file_io).await.unwrap();
+//! let snapshot_id = static_table
+//! .metadata()
+//! .current_snapshot()
+//! .unwrap()
+//! .snapshot_id();
+//! ```
+
+use crate::{
+    io::FileIO,
+    scan::TableScanBuilder,
+    spec::{TableMetadata, TableMetadataRef},
+    table::Table,
+    TableIdent,
+};
+use futures::AsyncReadExt;
+
+/// `StaticTable` is a read-only table struct that can be created from a 
metadata file or from `TableMetaData` without a catalog.
+pub struct StaticTable(Table);
+
+impl StaticTable {
+    /// creates a static table from a given `TableMetadata` and `FileIO`
+    pub async fn from_metadata(metadata: TableMetadata, file_io: FileIO) -> 
anyhow::Result<Self> {
+        let static_identifier = TableIdent::from_strs(["static_ns", 
"static_table"])?;

Review Comment:
   No problem, shall I wrap it in an Option to make it optional? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to