Skip to main content

datafusion_expr/
lib.rs

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