orc_rust/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//! A native Rust implementation of the [Apache ORC](https://orc.apache.org) file format,
19//! providing API's to read data into [Apache Arrow](https://arrow.apache.org) in-memory arrays.
20//!
21//! # Example read usage
22//!
23//! ```no_run
24//! # use std::fs::File;
25//! # use orc_rust::arrow_reader::ArrowReaderBuilder;
26//! let file = File::open("/path/to/file.orc").unwrap();
27//! let reader = ArrowReaderBuilder::try_new(file).unwrap().build();
28//! let record_batches = reader.collect::<Result<Vec<_>, _>>().unwrap();
29//! ```
30//!
31//! # Example write usage
32//!
33//! ```no_run
34//! # use std::fs::File;
35//! # use arrow::array::RecordBatch;
36//! # use orc_rust::arrow_writer::ArrowWriterBuilder;
37//! # use orc_rust::compression::CompressionType;
38//! # fn get_record_batch() -> RecordBatch {
39//! # unimplemented!()
40//! # }
41//! let file = File::create("/path/to/file.orc").unwrap();
42//! let batch = get_record_batch();
43//! let mut writer = ArrowWriterBuilder::new(file, batch.schema())
44//! .with_compression(CompressionType::Zstd)
45//! .with_compression_block_size(256 * 1024)
46//! .try_build()
47//! .unwrap();
48//! writer.write(&batch).unwrap();
49//! writer.close().unwrap();
50//! ```
51
52pub mod array_decoder;
53pub mod arrow_reader;
54pub mod arrow_writer;
55#[cfg(feature = "async")]
56pub mod async_arrow_reader;
57pub mod bloom_filter;
58mod column;
59pub mod compression;
60#[allow(dead_code)]
61mod encoding;
62pub mod error;
63mod memory;
64pub mod predicate;
65pub mod projection;
66#[allow(dead_code)]
67pub mod proto;
68pub mod reader;
69pub mod row_group_filter;
70pub mod row_index;
71pub mod row_selection;
72pub mod schema;
73pub mod statistics;
74pub mod stripe;
75mod writer;
76
77pub use arrow_reader::{ArrowReader, ArrowReaderBuilder};
78pub use arrow_writer::{ArrowWriter, ArrowWriterBuilder};
79#[cfg(feature = "async")]
80pub use async_arrow_reader::ArrowStreamReader;
81pub use predicate::{ComparisonOp, Predicate, PredicateValue};
82pub use row_selection::{RowSelection, RowSelector};
83pub use schema::{ArrowSchemaOptions, TimestampPrecision};