diff --git a/datafusion-expr/src/accumulator.rs b/datafusion-expr/src/accumulator.rs index 599bd363fb61..d59764957ef5 100644 --- a/datafusion-expr/src/accumulator.rs +++ b/datafusion-expr/src/accumulator.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Accumulator module contains the trait definition for aggregation function's accumulators. + use arrow::array::ArrayRef; use datafusion_common::{Result, ScalarValue}; use std::fmt::Debug; diff --git a/datafusion-expr/src/aggregate_function.rs b/datafusion-expr/src/aggregate_function.rs index 8f12e88bf1a2..dd8efea88460 100644 --- a/datafusion-expr/src/aggregate_function.rs +++ b/datafusion-expr/src/aggregate_function.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Aggregate function module contains all built-in aggregate functions definitions + use datafusion_common::{DataFusionError, Result}; use std::{fmt, str::FromStr}; diff --git a/datafusion-expr/src/built_in_function.rs b/datafusion-expr/src/built_in_function.rs index 0d5ee9792ecb..87626825c3e0 100644 --- a/datafusion-expr/src/built_in_function.rs +++ b/datafusion-expr/src/built_in_function.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -//! Built-in functions +//! Built-in functions module contains all the built-in functions definitions. use crate::Volatility; use datafusion_common::{DataFusionError, Result}; diff --git a/datafusion-expr/src/columnar_value.rs b/datafusion-expr/src/columnar_value.rs index 5e6959d751f8..4867c0e746b3 100644 --- a/datafusion-expr/src/columnar_value.rs +++ b/datafusion-expr/src/columnar_value.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Columnar value module contains a set of types that represent a columnar value. + use arrow::array::ArrayRef; use arrow::array::NullArray; use arrow::datatypes::DataType; diff --git a/datafusion-expr/src/expr.rs b/datafusion-expr/src/expr.rs index e998ebb3714f..d3cbf7059ba4 100644 --- a/datafusion-expr/src/expr.rs +++ b/datafusion-expr/src/expr.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Expr module contains core type definition for `Expr`. + use crate::aggregate_function; use crate::built_in_function; use crate::expr_fn::binary_expr; diff --git a/datafusion-expr/src/expr_fn.rs b/datafusion-expr/src/expr_fn.rs index 2c3a1f42f2cd..d39269cca036 100644 --- a/datafusion-expr/src/expr_fn.rs +++ b/datafusion-expr/src/expr_fn.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Expr fn module contains the functional definitions for expressions. + use crate::{aggregate_function, built_in_function, lit, Expr, Operator}; /// Create a column expression based on a qualified or unqualified column name @@ -22,7 +24,7 @@ pub fn col(ident: &str) -> Expr { Expr::Column(ident.into()) } -/// return a new expression l r +/// Return a new expression l r pub fn binary_expr(l: Expr, op: Operator, r: Expr) -> Expr { Expr::BinaryExpr { left: Box::new(l), @@ -31,7 +33,7 @@ pub fn binary_expr(l: Expr, op: Operator, r: Expr) -> Expr { } } -/// return a new expression with a logical AND +/// Return a new expression with a logical AND pub fn and(left: Expr, right: Expr) -> Expr { Expr::BinaryExpr { left: Box::new(left), @@ -40,7 +42,7 @@ pub fn and(left: Expr, right: Expr) -> Expr { } } -/// return a new expression with a logical OR +/// Return a new expression with a logical OR pub fn or(left: Expr, right: Expr) -> Expr { Expr::BinaryExpr { left: Box::new(left), @@ -265,7 +267,7 @@ scalar_expr!(Upper, upper, string); scalar_expr!(DatePart, date_part, part, date); scalar_expr!(DateTrunc, date_trunc, part, date); -/// returns an array of fixed size with each argument on it. +/// Returns an array of fixed size with each argument on it. pub fn array(args: Vec) -> Expr { Expr::ScalarFunction { fun: built_in_function::BuiltinScalarFunction::Array, diff --git a/datafusion-expr/src/function.rs b/datafusion-expr/src/function.rs index 2bacd6ae6227..3689ff759a8b 100644 --- a/datafusion-expr/src/function.rs +++ b/datafusion-expr/src/function.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Function module contains typing and signature for built-in and user defined functions. + use crate::Accumulator; use crate::ColumnarValue; use arrow::datatypes::DataType; diff --git a/datafusion-expr/src/lib.rs b/datafusion-expr/src/lib.rs index 1d0837f5cff6..709fa634d52d 100644 --- a/datafusion-expr/src/lib.rs +++ b/datafusion-expr/src/lib.rs @@ -37,8 +37,8 @@ pub use columnar_value::{ColumnarValue, NullColumnarValue}; pub use expr::Expr; pub use expr_fn::col; pub use function::{ - AccumulatorFunctionImplementation, ReturnTypeFunction, ScalarFunctionImplementation, - StateTypeFunction, + AccumulatorFunctionImplementation, ReturnTypeFunction, ScalarFunctionImplementation, + StateTypeFunction, }; pub use literal::{lit, lit_timestamp_nano, Literal, TimestampLiteral}; pub use operator::Operator; diff --git a/datafusion-expr/src/literal.rs b/datafusion-expr/src/literal.rs index 02c75af69573..08646b808644 100644 --- a/datafusion-expr/src/literal.rs +++ b/datafusion-expr/src/literal.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Literal module contains foundational types that are used to represent literals in DataFusion. + use crate::Expr; use datafusion_common::ScalarValue; diff --git a/datafusion-expr/src/operator.rs b/datafusion-expr/src/operator.rs index 585627f61316..0d3f17776c7c 100644 --- a/datafusion-expr/src/operator.rs +++ b/datafusion-expr/src/operator.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +//! Operator module contains foundational types that are used to represent operators in DataFusion. + use crate::expr_fn::binary_expr; use crate::Expr; use std::fmt; diff --git a/datafusion-expr/src/signature.rs b/datafusion-expr/src/signature.rs index 5c27f422c105..b347448f7e77 100644 --- a/datafusion-expr/src/signature.rs +++ b/datafusion-expr/src/signature.rs @@ -15,16 +15,24 @@ // specific language governing permissions and limitations // under the License. +//! Signature module contains foundational types that are used to represent signatures, types, +//! and return types of functions in DataFusion. + use arrow::datatypes::DataType; ///A function's volatility, which defines the functions eligibility for certain optimizations #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum Volatility { - /// Immutable - An immutable function will always return the same output when given the same input. An example of this is [BuiltinScalarFunction::Cos]. + /// Immutable - An immutable function will always return the same output when given the same + /// input. An example of this is [BuiltinScalarFunction::Cos]. Immutable, - /// Stable - A stable function may return different values given the same input accross different queries but must return the same value for a given input within a query. An example of this is [BuiltinScalarFunction::Now]. + /// Stable - A stable function may return different values given the same input across different + /// queries but must return the same value for a given input within a query. An example of + /// this is [BuiltinScalarFunction::Now]. Stable, - /// Volatile - A volatile function may change the return value from evaluation to evaluation. Mutiple invocations of a volatile function may return different results when used in the same query. An example of this is [BuiltinScalarFunction::Random]. + /// Volatile - A volatile function may change the return value from evaluation to evaluation. + /// Multiple invocations of a volatile function may return different results when used in the + /// same query. An example of this is [BuiltinScalarFunction::Random]. Volatile, } @@ -92,7 +100,7 @@ impl Signature { volatility, } } - /// exact - Creates a signture which must match the types in exact_types in order. + /// exact - Creates a signature which must match the types in exact_types in order. pub fn exact(exact_types: Vec, volatility: Volatility) -> Self { Signature { type_signature: TypeSignature::Exact(exact_types), diff --git a/datafusion-expr/src/udaf.rs b/datafusion-expr/src/udaf.rs index a39d58b622f3..8c15da40f223 100644 --- a/datafusion-expr/src/udaf.rs +++ b/datafusion-expr/src/udaf.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -//! This module contains functions and structs supporting user-defined aggregate functions. +//! Udaf module contains functions and structs supporting user-defined aggregate functions. use crate::Expr; use crate::{ diff --git a/datafusion-expr/src/udf.rs b/datafusion-expr/src/udf.rs index 79a17a4a2b4b..4d60b2994c6b 100644 --- a/datafusion-expr/src/udf.rs +++ b/datafusion-expr/src/udf.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -//! UDF support +//! Udf module contains foundational types that are used to represent UDFs in DataFusion. use crate::{Expr, ReturnTypeFunction, ScalarFunctionImplementation, Signature}; use std::fmt; diff --git a/datafusion-expr/src/window_frame.rs b/datafusion-expr/src/window_frame.rs index ba65a5088b61..a0d6ed0ebdeb 100644 --- a/datafusion-expr/src/window_frame.rs +++ b/datafusion-expr/src/window_frame.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -//! Window frame +//! Window frame module //! //! The frame-spec determines which output rows are read by an aggregate window function. The frame-spec consists of four parts: //! - A frame type - either ROWS, RANGE or GROUPS, diff --git a/datafusion-expr/src/window_function.rs b/datafusion-expr/src/window_function.rs index 59523d6540b2..bccf653b0ca7 100644 --- a/datafusion-expr/src/window_function.rs +++ b/datafusion-expr/src/window_function.rs @@ -15,6 +15,9 @@ // specific language governing permissions and limitations // under the License. +//! Window function module contains foundational types that are used to represent window functions +//! in DataFusion. + use crate::aggregate_function::AggregateFunction; use datafusion_common::{DataFusionError, Result}; use std::{fmt, str::FromStr};