Skip to main content

datafusion_expr/
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#![doc(
19    html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg",
20    html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
21)]
22#![cfg_attr(docsrs, feature(doc_cfg))]
23// Make sure fast / cheap clones on Arc are explicit:
24// https://github.com/apache/datafusion/issues/11143
25#![deny(clippy::clone_on_ref_ptr)]
26#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
27
28//! [DataFusion](https://github.com/apache/datafusion)
29//! is an extensible query execution framework that uses
30//! [Apache Arrow](https://arrow.apache.org) as its in-memory format.
31//!
32//! This crate is a submodule of DataFusion that provides types representing
33//! logical query plans ([LogicalPlan]) and logical expressions ([Expr]) as well as utilities for
34//! working with these types.
35//!
36//! The [expr_fn] module contains functions for creating expressions.
37
38extern crate core;
39
40mod higher_order_function;
41mod literal;
42mod operation;
43mod partition_evaluator;
44mod table_source;
45mod udaf;
46mod udf;
47mod udwf;
48
49pub mod arguments;
50pub mod conditional_expressions;
51pub mod execution_props;
52pub mod expr;
53pub mod expr_fn;
54pub mod expr_rewriter;
55pub mod expr_schema;
56pub mod extension_types;
57pub mod function;
58pub mod physical_planning_context;
59pub mod select_expr;
60pub mod groups_accumulator {
61    pub use datafusion_expr_common::groups_accumulator::*;
62}
63pub mod interval_arithmetic {
64    pub use datafusion_expr_common::interval_arithmetic::*;
65}
66pub mod logical_plan;
67pub mod dml {
68    //! DML (Data Manipulation Language) types for DELETE, UPDATE operations.
69    pub use crate::logical_plan::dml::*;
70}
71pub mod planner;
72/// Protobuf conversions for [`WindowFrame`], [`WindowFrameBound`],
73/// [`WindowFrameUnits`], [`MergeIntoClauseKind`](dml::MergeIntoClauseKind) and
74/// [`NullTreatment`](expr::NullTreatment), gated on the `proto` feature.
75#[cfg(feature = "proto")]
76mod proto;
77pub mod registry;
78pub mod simplify;
79pub mod sort_properties {
80    pub use datafusion_expr_common::sort_properties::*;
81}
82pub mod async_udf;
83pub mod statistics {
84    pub use datafusion_expr_common::statistics::*;
85}
86mod predicate_bounds;
87pub mod preimage;
88pub mod ptr_eq;
89#[cfg(not(feature = "sql"))]
90pub mod sql;
91pub mod test;
92pub mod tree_node;
93pub mod type_coercion;
94pub mod udf_eq;
95pub mod utils;
96pub mod var_provider;
97pub mod window_frame;
98pub mod window_state;
99
100pub use datafusion_doc::{
101    DocSection, Documentation, DocumentationBuilder, aggregate_doc_sections,
102    scalar_doc_sections, window_doc_sections,
103};
104pub use datafusion_expr_common::accumulator::Accumulator;
105pub use datafusion_expr_common::columnar_value::ColumnarValue;
106pub use datafusion_expr_common::groups_accumulator::{EmitTo, GroupsAccumulator};
107pub use datafusion_expr_common::operator::Operator;
108pub use datafusion_expr_common::placement::ExpressionPlacement;
109pub use datafusion_expr_common::signature::{
110    ArrayFunctionArgument, ArrayFunctionSignature, Coercion, EncodingPreservation,
111    Signature, TIMEZONE_WILDCARD, TypeSignature, TypeSignatureClass, Volatility,
112};
113pub use datafusion_expr_common::type_coercion::binary;
114pub use expr::{
115    Between, BinaryExpr, Case, Cast, Expr, GetFieldAccess, GroupingSet, Like,
116    Sort as SortExpr, TryCast, WindowFunctionDefinition,
117};
118pub use expr_fn::*;
119pub use expr_schema::ExprSchemable;
120pub use function::{
121    AccumulatorFactoryFunction, PartitionEvaluatorFactory, ReturnTypeFunction,
122    ScalarFunctionImplementation, StateTypeFunction,
123};
124pub use higher_order_function::{
125    HigherOrderFunctionArgs, HigherOrderReturnFieldArgs, HigherOrderSignature,
126    HigherOrderTypeSignature, HigherOrderUDF, HigherOrderUDFImpl, LambdaArgument,
127    LambdaParametersProgress, ValueOrLambda,
128};
129pub use literal::{
130    Literal, TimestampLiteral, lit, lit_timestamp_nano, lit_with_metadata,
131};
132pub use logical_plan::*;
133pub use partition_evaluator::PartitionEvaluator;
134#[cfg(feature = "sql")]
135pub use sqlparser;
136pub use table_source::{TableProviderFilterPushDown, TableSource, TableType};
137pub use udaf::{
138    AggregateUDF, AggregateUDFImpl, ReversedUDAF, SetMonotonicity, StatisticsArgs,
139    udaf_default_display_name, udaf_default_human_display, udaf_default_return_field,
140    udaf_default_schema_name, udaf_default_window_function_display_name,
141    udaf_default_window_function_schema_name,
142};
143pub use udf::{
144    ReturnFieldArgs, ScalarFunctionArgs, ScalarUDF, ScalarUDFImpl, StructFieldMapping,
145};
146pub use udwf::{LimitEffect, ReversedUDWF, WindowUDF, WindowUDFImpl};
147pub use window_frame::{WindowFrame, WindowFrameBound, WindowFrameUnits};
148
149#[cfg(test)]
150#[ctor::ctor(unsafe)]
151fn init() {
152    // Enable RUST_LOG logging configuration for test
153    let _ = env_logger::try_init();
154}