Skip to main content

parquet_variant_compute/
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//! [`VariantArray`] and compute kernels for the [Variant Binary Encoding] from [Apache Parquet].
19//!
20//! ## Main APIs
21//! - [`VariantArray`] : Represents an array of `Variant` values.
22//! - [`VariantArrayBuilder`]: For building [`VariantArray`]
23//!
24//! # Compute Kernels
25//! - [`json_to_variant()`]: Function to convert Arrays of JSON strings to a `VariantArray`.
26//! - [`variant_to_json()`]: Function to convert a `VariantArray` to arrays of JSON strings.
27//! - [`cast_to_variant()`]: Cast Arrow arrays to `VariantArray`.
28//! - [`variant_get()`]: Convert `VariantArray` (or an inner path) to a strongly-typed Arrow array.
29//! - [`shred_variant()`]: Shred a `VariantArray` according to the provided shredding schema
30//! - [`unshred_variant()`]: Unshred a `VariantArray` to pure binary variant.
31//!
32//! ## 🚧 Work In Progress
33//!
34//! This crate is under active development and is not yet ready for production use.
35//! If you are interested in helping, you can find more information on the GitHub [Variant issue]
36//!
37//! [Variant Binary Encoding]: https://github.com/apache/parquet-format/blob/master/VariantEncoding.md
38//! [Apache Parquet]: https://parquet.apache.org/
39//! [`VariantPath`]: parquet_variant::VariantPath
40//! [Variant issue]: https://github.com/apache/arrow-rs/issues/6736
41//!
42//! # Platform Support
43//!
44//! Only little-endian platforms are officially supported and tested in CI.
45//! Big-endian platforms are not tested in CI and may not work correctly.
46//! Fixes for big-endian platforms are welcome and handled on a best-effort basis,
47//! but compatibility is not guaranteed.
48
49mod arrow_to_variant;
50mod cast_to_variant;
51mod from_json;
52mod shred_variant;
53mod to_json;
54mod type_conversion;
55mod unshred_variant;
56mod variant_array;
57mod variant_array_builder;
58mod variant_get;
59mod variant_to_arrow;
60
61pub use variant_array::{ShreddingState, VariantArray, VariantArrayIter, VariantType};
62pub use variant_array_builder::{VariantArrayBuilder, VariantValueArrayBuilder};
63
64pub use cast_to_variant::{cast_to_variant, cast_to_variant_with_options};
65pub use from_json::json_to_variant;
66pub use shred_variant::{IntoShreddingField, ShreddedSchemaBuilder, shred_variant};
67pub use to_json::variant_to_json;
68pub use unshred_variant::unshred_variant;
69pub use variant_get::{GetOptions, variant_get};