iceberg/lib.rs
1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18//! Apache Iceberg Official Native Rust Implementation
19//!
20//! # Examples
21//!
22//! ## Scan A Table
23//!
24//! ```rust, no_run
25//! use std::collections::HashMap;
26//!
27//! use futures::TryStreamExt;
28//! use iceberg::io::{FileIO, FileIOBuilder};
29//! use iceberg::memory::MemoryCatalogBuilder;
30//! use iceberg::{Catalog, CatalogBuilder, MemoryCatalog, Result, TableIdent};
31//!
32//! #[tokio::main]
33//! async fn main() -> Result<()> {
34//! // Connect to a catalog.
35//! use iceberg::memory::MEMORY_CATALOG_WAREHOUSE;
36//! let catalog = MemoryCatalogBuilder::default()
37//! .load(
38//! "memory",
39//! HashMap::from([(
40//! MEMORY_CATALOG_WAREHOUSE.to_string(),
41//! "file:///path/to/warehouse".to_string(),
42//! )]),
43//! )
44//! .await?;
45//! // Load table from catalog.
46//! let table = catalog
47//! .load_table(&TableIdent::from_strs(["hello", "world"])?)
48//! .await?;
49//! // Build table scan.
50//! let stream = table
51//! .scan()
52//! .select(["name", "id"])
53//! .build()?
54//! .to_arrow()
55//! .await?;
56//!
57//! // Consume this stream like arrow record batch stream.
58//! let _data: Vec<_> = stream.try_collect().await?;
59//! Ok(())
60//! }
61//! ```
62
63#![deny(missing_docs)]
64
65#[macro_use]
66extern crate derive_builder;
67extern crate core;
68
69mod error;
70pub use error::{Error, ErrorKind, Result};
71
72mod catalog;
73
74pub use catalog::*;
75
76pub mod table;
77
78mod avro;
79pub mod cache;
80pub mod io;
81pub mod spec;
82
83pub mod inspect;
84pub mod scan;
85
86pub mod expr;
87pub mod transaction;
88pub mod transform;
89
90mod runtime;
91
92pub mod arrow;
93pub(crate) mod delete_file_index;
94pub mod test_utils;
95mod utils;
96pub mod writer;
97
98mod delete_vector;
99pub mod puffin;