Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ch-sc committed Feb 6, 2025
1 parent 68784cc commit bc9eb4d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 104 deletions.
120 changes: 24 additions & 96 deletions datafusion/expr-common/src/interval_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2195,10 +2195,7 @@ mod tests {
),
(
Interval::new(Date64(Some(1)), Date64(Some(1))),
Interval::new(
Date64(Some(-1)),
Date64(Some(-1)),
),
Interval::new(Date64(Some(-1)), Date64(Some(-1))),
),
(
Interval::new(
Expand All @@ -2211,14 +2208,8 @@ mod tests {
),
),
(
Interval::new(
DurationSecond(Some(1)),
DurationSecond(Some(10)),
),
Interval::new(
DurationSecond(Some(-10)),
DurationSecond(Some(-1)),
),
Interval::new(DurationSecond(Some(1)), DurationSecond(Some(10))),
Interval::new(DurationSecond(Some(-10)), DurationSecond(Some(-1))),
),
];
for (first, second) in exactly_gt_cases {
Expand Down Expand Up @@ -2258,10 +2249,7 @@ mod tests {
)?,
),
(
Interval::new(
Date64(Some(1)),
Date64(Some(10)),
),
Interval::new(Date64(Some(1)), Date64(Some(10))),
Interval::new(Date64(Some(1)), Date64(Some(1))),
),
(
Expand All @@ -2275,14 +2263,8 @@ mod tests {
),
),
(
Interval::new(
DurationSecond(Some(1)),
DurationSecond(Some(10)),
),
Interval::new(
DurationSecond(Some(1)),
DurationSecond(Some(1)),
),
Interval::new(DurationSecond(Some(1)), DurationSecond(Some(10))),
Interval::new(DurationSecond(Some(1)), DurationSecond(Some(1))),
),
];
for (first, second) in possibly_gt_cases {
Expand Down Expand Up @@ -2322,14 +2304,8 @@ mod tests {
)?,
),
(
Interval::new(
Date64(Some(1)),
Date64(Some(10)),
),
Interval::new(
Date64(Some(10)),
Date64(Some(100)),
),
Interval::new(Date64(Some(1)), Date64(Some(10))),
Interval::new(Date64(Some(10)), Date64(Some(100))),
),
(
Interval::new(
Expand All @@ -2342,14 +2318,8 @@ mod tests {
),
),
(
Interval::new(
DurationSecond(Some(-10)),
DurationSecond(Some(-1)),
),
Interval::new(
DurationSecond(Some(1)),
DurationSecond(Some(1)),
),
Interval::new(DurationSecond(Some(-10)), DurationSecond(Some(-1))),
Interval::new(DurationSecond(Some(1)), DurationSecond(Some(1))),
),
];
for (first, second) in not_gt_cases {
Expand Down Expand Up @@ -2418,14 +2388,8 @@ mod tests {
),
),
(
Interval::new(
DurationSecond(Some(-10)),
DurationSecond(Some(1)),
),
Interval::new(
DurationSecond(Some(-10)),
DurationSecond(Some(-10)),
),
Interval::new(DurationSecond(Some(-10)), DurationSecond(Some(1))),
Interval::new(DurationSecond(Some(-10)), DurationSecond(Some(-10))),
),
];
for (first, second) in exactly_gteq_cases {
Expand Down Expand Up @@ -2485,14 +2449,8 @@ mod tests {
),
),
(
Interval::new(
DurationSecond(Some(-10)),
DurationSecond(Some(1)),
),
Interval::new(
DurationSecond(None),
DurationSecond(Some(0)),
),
Interval::new(DurationSecond(Some(-10)), DurationSecond(Some(1))),
Interval::new(DurationSecond(None), DurationSecond(Some(0))),
),
];
for (first, second) in possibly_gteq_cases {
Expand Down Expand Up @@ -2548,14 +2506,8 @@ mod tests {
),
),
(
Interval::new(
DurationSecond(None),
DurationSecond(Some(-1)),
),
Interval::new(
DurationSecond(Some(0)),
DurationSecond(Some(1)),
),
Interval::new(DurationSecond(None), DurationSecond(Some(-1))),
Interval::new(DurationSecond(Some(0)), DurationSecond(Some(1))),
),
];
for (first, second) in not_gteq_cases {
Expand Down Expand Up @@ -2586,14 +2538,8 @@ mod tests {
Interval::make(Some(f64::MIN), Some(f64::MIN))?,
),
(
Interval::new(
Date64(Some(1000)),
Date64(Some(1000)),
),
Interval::new(
Date64(Some(1000)),
Date64(Some(1000)),
),
Interval::new(Date64(Some(1000)), Date64(Some(1000))),
Interval::new(Date64(Some(1000)), Date64(Some(1000))),
),
(
Interval::new(
Expand All @@ -2606,24 +2552,12 @@ mod tests {
),
),
(
Interval::new(
IntervalYearMonth(Some(10)),
IntervalYearMonth(Some(10)),
),
Interval::new(
IntervalYearMonth(Some(10)),
IntervalYearMonth(Some(10)),
),
Interval::new(IntervalYearMonth(Some(10)), IntervalYearMonth(Some(10))),
Interval::new(IntervalYearMonth(Some(10)), IntervalYearMonth(Some(10))),
),
(
Interval::new(
DurationSecond(Some(10)),
DurationSecond(Some(10)),
),
Interval::new(
DurationSecond(Some(10)),
DurationSecond(Some(10)),
),
Interval::new(DurationSecond(Some(10)), DurationSecond(Some(10))),
Interval::new(DurationSecond(Some(10)), DurationSecond(Some(10))),
),
];
for (first, second) in exactly_eq_cases {
Expand Down Expand Up @@ -2991,14 +2925,8 @@ mod tests {
Interval::CERTAINLY_TRUE,
),
(
Interval::new(
DurationSecond(Some(0)),
DurationSecond(Some(600)),
),
Interval::new(
DurationSecond(Some(1)),
DurationSecond(Some(599)),
),
Interval::new(DurationSecond(Some(0)), DurationSecond(Some(600))),
Interval::new(DurationSecond(Some(1)), DurationSecond(Some(599))),
Interval::CERTAINLY_TRUE,
),
(
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr-common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use datafusion_expr_common::sort_properties::ExprProperties;
use crate::physical_expr::PhysicalExpr;
use crate::sort_expr::{LexOrdering, PhysicalSortExpr};
use crate::tree_node::ExprContext;
use arrow::datatypes::{DataType};
use arrow::datatypes::DataType;

/// Represents a [`PhysicalExpr`] node with associated properties (order and
/// range) in a context where properties are tracked.
Expand Down
5 changes: 4 additions & 1 deletion datafusion/physical-expr/src/expressions/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ impl PhysicalExpr for BinaryExpr {
self.left.data_type(schema.as_ref()),
self.right.data_type(schema.as_ref()),
) {
if BinaryTypeCoercer::new(&lhs, &self.op, &rhs).get_result_type().is_err() {
if BinaryTypeCoercer::new(&lhs, &self.op, &rhs)
.get_result_type()
.is_err()
{
return false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions datafusion/physical-expr/src/expressions/in_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ use datafusion_expr::ColumnarValue;
use datafusion_physical_expr_common::datum::compare_with_eq;

use ahash::RandomState;
use datafusion_expr::interval_arithmetic::Interval;
use datafusion_common::HashMap;
use datafusion_expr::interval_arithmetic::Interval;
use hashbrown::hash_map::RawEntryMut;

/// InList
Expand Down Expand Up @@ -445,9 +445,9 @@ impl PhysicalExpr for InListExpr {
fn supports_bounds_evaluation(&self, schema: &SchemaRef) -> bool {
self.expr.supports_bounds_evaluation(schema)
&& self
.list
.iter()
.all(|expr| expr.supports_bounds_evaluation(schema))
.list
.iter()
.all(|expr| expr.supports_bounds_evaluation(schema))
}
}

Expand Down
6 changes: 4 additions & 2 deletions datafusion/physical-optimizer/src/sanity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ use datafusion_physical_plan::{get_plan_string, ExecutionPlanProperties};

use crate::PhysicalOptimizerRule;
use datafusion_physical_expr_common::sort_expr::format_physical_sort_requirement_list;
use itertools::izip;
use datafusion_physical_expr_common::utils::is_supported_datatype_for_bounds_eval;
use itertools::izip;

/// The SanityCheckPlan rule rejects the following query plans:
/// 1. Invalid plans containing nodes whose order and/or distribution requirements
Expand Down Expand Up @@ -113,7 +113,9 @@ pub fn check_finiteness_requirements(
/// [`Operator`]: datafusion_expr::Operator
fn is_prunable(join: &SymmetricHashJoinExec) -> bool {
join.filter().is_some_and(|filter| {
filter.expression().supports_bounds_evaluation(&join.schema())
filter
.expression()
.supports_bounds_evaluation(&join.schema())
&& filter
.schema()
.fields()
Expand Down

0 comments on commit bc9eb4d

Please sign in to comment.