Skip to content

Commit

Permalink
add module level comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jimexist committed Feb 9, 2022
1 parent 8375cf6 commit 22a282d
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 14 deletions.
2 changes: 2 additions & 0 deletions datafusion-expr/src/accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions datafusion-expr/src/aggregate_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion datafusion-expr/src/built_in_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions datafusion-expr/src/columnar_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions datafusion-expr/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions datafusion-expr/src/expr_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
// 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
pub fn col(ident: &str) -> Expr {
Expr::Column(ident.into())
}

/// return a new expression l <op> r
/// Return a new expression l <op> r
pub fn binary_expr(l: Expr, op: Operator, r: Expr) -> Expr {
Expr::BinaryExpr {
left: Box::new(l),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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 {
Expr::ScalarFunction {
fun: built_in_function::BuiltinScalarFunction::Array,
Expand Down
2 changes: 2 additions & 0 deletions datafusion-expr/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions datafusion-expr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions datafusion-expr/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions datafusion-expr/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 12 additions & 4 deletions datafusion-expr/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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<DataType>, volatility: Volatility) -> Self {
Signature {
type_signature: TypeSignature::Exact(exact_types),
Expand Down
2 changes: 1 addition & 1 deletion datafusion-expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion datafusion-expr/src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion datafusion-expr/src/window_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions datafusion-expr/src/window_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 22a282d

Please sign in to comment.