Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Rust doc fix #1113

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/examples/src/rest_catalog_namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,24 @@ static REST_URI: &str = "http://localhost:8181";
/// [quickstart documentation](https://iceberg.apache.org/spark-quickstart/).
#[tokio::main]
async fn main() {
// ANCHOR: create_catalog
// Create the REST iceberg catalog.
let config = RestCatalogConfig::builder()
.uri(REST_URI.to_string())
.build();
let catalog = RestCatalog::new(config);
// ANCHOR_END: create_catalog

// ANCHOR: list_all_namespace
// List all namespaces already in the catalog.
let existing_namespaces = catalog.list_namespaces(None).await.unwrap();
println!(
"Namespaces alreading in the existing catalog: {:?}",
existing_namespaces
);
// ANCHOR_END: list_all_namespace

// ANCHOR: create_namespace
// Create a new namespace identifier.
let namespace_ident =
NamespaceIdent::from_vec(vec!["ns1".to_string(), "ns11".to_string()]).unwrap();
Expand All @@ -66,4 +71,5 @@ async fn main() {

let loaded_namespace = catalog.get_namespace(&namespace_ident).await.unwrap();
println!("Namespace loaded!\n\nNamespace: {:#?}", loaded_namespace,);
// ANCHOR_END: create_namespace
}
4 changes: 4 additions & 0 deletions crates/examples/src/rest_catalog_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async fn main() {
.build();
let catalog = RestCatalog::new(config);

// ANCHOR: create_table
// Create the table identifier.
let namespace_ident = NamespaceIdent::from_vec(vec![NAMESPACE.to_string()]).unwrap();
let table_ident = TableIdent::new(namespace_ident.clone(), TABLE_NAME.to_string());
Expand Down Expand Up @@ -78,7 +79,9 @@ async fn main() {
.await
.unwrap();
println!("Table {TABLE_NAME} created!");
// ANCHOR_END: create_table

// ANCHOR: load_table
// Ensure that the table is under the correct namespace.
assert!(catalog
.list_tables(&namespace_ident)
Expand All @@ -89,4 +92,5 @@ async fn main() {
// Load the table back from the catalog. It should be identical to the created table.
let loaded_table = catalog.load_table(&table_ident).await.unwrap();
println!("Table {TABLE_NAME} loaded!\n\nTable: {:?}", loaded_table);
// ANCHOR_END: load_table
}
Loading