You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ji...@apache.org on 2022/02/09 05:15:00 UTC

[arrow-datafusion] branch datafusion-expr-fn updated: add module level comments

This is an automated email from the ASF dual-hosted git repository.

jiayuliu pushed a commit to branch datafusion-expr-fn
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/datafusion-expr-fn by this push:
     new 9b6614e  add module level comments
9b6614e is described below

commit 9b6614e8610a44fc54360da363e923177daa7c8f
Author: Jiayu Liu <ji...@hey.com>
AuthorDate: Wed Feb 9 13:14:43 2022 +0800

    add module level comments
---
 datafusion-expr/src/accumulator.rs        |  2 ++
 datafusion-expr/src/aggregate_function.rs |  2 ++
 datafusion-expr/src/built_in_function.rs  |  2 +-
 datafusion-expr/src/columnar_value.rs     |  2 ++
 datafusion-expr/src/expr.rs               |  2 ++
 datafusion-expr/src/expr_fn.rs            | 10 ++++++----
 datafusion-expr/src/function.rs           |  2 ++
 datafusion-expr/src/literal.rs            |  2 ++
 datafusion-expr/src/operator.rs           |  2 ++
 datafusion-expr/src/signature.rs          | 16 ++++++++++++----
 datafusion-expr/src/udaf.rs               |  2 +-
 datafusion-expr/src/udf.rs                |  2 +-
 datafusion-expr/src/window_frame.rs       |  2 +-
 datafusion-expr/src/window_function.rs    |  3 +++
 14 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/datafusion-expr/src/accumulator.rs b/datafusion-expr/src/accumulator.rs
index 599bd36..d597649 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 8f12e88..dd8efea 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 0d5ee97..8762682 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 5e6959d..4867c0e 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 e998ebb..d3cbf70 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 2c3a1f4..d39269c 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 <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),
@@ -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 {
     Expr::ScalarFunction {
         fun: built_in_function::BuiltinScalarFunction::Array,
diff --git a/datafusion-expr/src/function.rs b/datafusion-expr/src/function.rs
index 2bacd6a..3689ff7 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/literal.rs b/datafusion-expr/src/literal.rs
index 02c75af..08646b8 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 585627f..0d3f177 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 5c27f42..b347448 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<DataType>, 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 a39d58b..8c15da4 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 79a17a4..4d60b29 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 ba65a50..a0d6ed0 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 59523d6..bccf653 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};