xanderbailey commented on code in PR #2153: URL: https://github.com/apache/iceberg-rust/pull/2153#discussion_r3088829877
########## crates/examples/src/datafusion_incremental_read.rs: ########## @@ -0,0 +1,157 @@ +// 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. + +//! Example demonstrating incremental reads with DataFusion. +//! +//! Incremental reads allow you to scan only the data that was added between +//! two snapshots. This is useful for: +//! - Change data capture (CDC) pipelines +//! - Incremental data processing +//! - Efficiently reading only new data since last checkpoint +//! +//! # Prerequisites +//! +//! This example requires a running iceberg-rest catalog on port 8181 with +//! a table that has multiple snapshots. You can set this up using the official +//! [quickstart documentation](https://iceberg.apache.org/spark-quickstart/). + +use std::collections::HashMap; +use std::sync::Arc; + +use datafusion::prelude::SessionContext; +use iceberg::{Catalog, CatalogBuilder, TableIdent}; +use iceberg_catalog_rest::{REST_CATALOG_PROP_URI, RestCatalogBuilder}; +use iceberg_datafusion::IcebergStaticTableProvider; + +static REST_URI: &str = "http://localhost:8181"; +static NAMESPACE: &str = "default"; +static TABLE_NAME: &str = "incremental_test"; + +/// This example demonstrates how to perform incremental reads using DataFusion. +/// +/// Incremental reads scan only the data files that were added between two snapshots, +/// which is much more efficient than scanning the entire table when you only need +/// the new data. +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { Review Comment: Happy to remove this if we don't want it, claude wrote it for me. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
