Skip to content

Commit ecd0081

Browse files
authored
[split/13] move rest of expr to expr_fn in datafusion-expr module (#1794)
* move expr functions to datafusion-expr expr_fn * add module level comments
1 parent 071f14a commit ecd0081

16 files changed

+484
-446
lines changed

datafusion-expr/src/accumulator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! Accumulator module contains the trait definition for aggregation function's accumulators.
19+
1820
use arrow::array::ArrayRef;
1921
use datafusion_common::{Result, ScalarValue};
2022
use std::fmt::Debug;

datafusion-expr/src/aggregate_function.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! Aggregate function module contains all built-in aggregate functions definitions
19+
1820
use datafusion_common::{DataFusionError, Result};
1921
use std::{fmt, str::FromStr};
2022

datafusion-expr/src/built_in_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
//! Built-in functions
18+
//! Built-in functions module contains all the built-in functions definitions.
1919
2020
use crate::Volatility;
2121
use datafusion_common::{DataFusionError, Result};

datafusion-expr/src/columnar_value.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! Columnar value module contains a set of types that represent a columnar value.
19+
1820
use arrow::array::ArrayRef;
1921
use arrow::array::NullArray;
2022
use arrow::datatypes::DataType;

datafusion-expr/src/expr.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
//! Expr module contains core type definition for `Expr`.
19+
1820
use crate::aggregate_function;
1921
use crate::built_in_function;
2022
use crate::expr_fn::binary_expr;
@@ -696,3 +698,28 @@ fn create_name(e: &Expr, input_schema: &DFSchema) -> Result<String> {
696698
)),
697699
}
698700
}
701+
702+
#[cfg(test)]
703+
mod test {
704+
use crate::expr_fn::col;
705+
use crate::lit;
706+
707+
#[test]
708+
fn test_not() {
709+
assert_eq!(lit(1).not(), !lit(1));
710+
}
711+
712+
#[test]
713+
fn test_partial_ord() {
714+
// Test validates that partial ord is defined for Expr using hashes, not
715+
// intended to exhaustively test all possibilities
716+
let exp1 = col("a") + lit(1);
717+
let exp2 = col("a") + lit(2);
718+
let exp3 = !(col("a") + lit(2));
719+
720+
assert!(exp1 < exp2);
721+
assert!(exp2 > exp1);
722+
assert!(exp2 > exp3);
723+
assert!(exp3 < exp2);
724+
}
725+
}

0 commit comments

Comments
 (0)