alamb commented on code in PR #22908: URL: https://github.com/apache/datafusion/pull/22908#discussion_r3476904205
########## datafusion/functions-variant/src/lib.rs: ########## @@ -0,0 +1,164 @@ +// 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. + +#![doc( + html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg", + html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg" +)] +#![cfg_attr(docsrs, feature(doc_cfg))] +// Make sure fast / cheap clones on Arc are explicit: +// https://github.com/apache/datafusion/issues/11143 +#![deny(clippy::clone_on_ref_ptr)] + +//! Variant type Functions for [DataFusion]. +//! +//! This crate contains a collection of functions that operate on the +//! [Parquet Variant] logical type. Variant values are represented as Arrow +//! `StructArray`s carrying the `VariantType` extension type, with separate +//! `metadata` and `value` binary buffers. +//! +//! [DataFusion]: https://crates.io/crates/datafusion +//! [Parquet Variant]: https://github.com/apache/parquet-format/blob/master/VariantEncoding.md +//! +//! You can register the functions in this crate using the [`register_all`] function. +//! +//! # Example: enabling Parquet Variant features with `SessionStateBuilder` +//! +//! Enable the `core` feature in your `Cargo.toml`: +//! ```toml +//! datafusion-functions-variant = { version = "X", features = ["core"] } +//! ``` +//! +//! Then use the [`SessionStateBuilderVariant`] extension trait to register all +//! Variant scalar functions on a [`SessionStateBuilder`]. +//! +//! [`SessionStateBuilder`]: https://docs.rs/datafusion/latest/datafusion/execution/struct.SessionStateBuilder.html + +mod impl_variant_get; +mod shared; + +#[cfg(feature = "core")] +mod session_state; + +#[cfg(feature = "core")] +pub use session_state::SessionStateBuilderVariant; + +pub mod cast_to_variant; +pub mod is_variant_null; +pub mod json_to_variant; +pub mod variant_contains; +pub mod variant_get; +pub mod variant_list_construct; +pub mod variant_list_delete; +pub mod variant_list_insert; +pub mod variant_normalize; +pub mod variant_object_construct; Review Comment: How did you determine what list of functions to use? Specifically, where did `variant_object_construct`, et al come from? In general I think we should follow existing implementations, which in this case is the spark variant functions: https://downloads.apache.org/spark/docs/4.2.0-preview3/api/sql/variant-functions Spark doesn't seem to have this many functions.... -- 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]
