mirror of
https://github.com/langchain-ai/datafusion.git
synced 2026-07-01 21:24:06 -04:00
chore: Replace matches! on fieldless enums with == (#20525)
## Which issue does this PR close? N/A ## Rationale for this change When comparing a value with a field-less enum that implements `PartialEq`, `==` is simpler and more readable than `matches!`. ## What changes are included in this PR? ## Are these changes tested? Yes. ## Are there any user-facing changes? No.
This commit is contained in:
@@ -1265,7 +1265,7 @@ mod tests {
|
||||
col_stats.min_value,
|
||||
Precision::Inexact(ScalarValue::Int32(Some(-10)))
|
||||
);
|
||||
assert!(matches!(col_stats.sum_value, Precision::Absent));
|
||||
assert_eq!(col_stats.sum_value, Precision::Absent);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -499,7 +499,7 @@ impl NativeType {
|
||||
|
||||
#[inline]
|
||||
pub fn is_date(&self) -> bool {
|
||||
matches!(self, NativeType::Date)
|
||||
*self == NativeType::Date
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -524,7 +524,7 @@ impl NativeType {
|
||||
|
||||
#[inline]
|
||||
pub fn is_null(&self) -> bool {
|
||||
matches!(self, NativeType::Null)
|
||||
*self == NativeType::Null
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -1395,7 +1395,7 @@ impl DefaultPhysicalPlanner {
|
||||
|
||||
// TODO: Allow PWMJ to deal with residual equijoin conditions
|
||||
let join: Arc<dyn ExecutionPlan> = if join_on.is_empty() {
|
||||
if join_filter.is_none() && matches!(join_type, JoinType::Inner) {
|
||||
if join_filter.is_none() && *join_type == JoinType::Inner {
|
||||
// cross join if there is no join conditions and no join filter set
|
||||
Arc::new(CrossJoinExec::new(physical_left, physical_right))
|
||||
} else if num_range_filters == 1
|
||||
@@ -1470,9 +1470,7 @@ impl DefaultPhysicalPlanner {
|
||||
|
||||
let left_side = side_of(lhs_logical)?;
|
||||
let right_side = side_of(rhs_logical)?;
|
||||
if matches!(left_side, Side::Both)
|
||||
|| matches!(right_side, Side::Both)
|
||||
{
|
||||
if left_side == Side::Both || right_side == Side::Both {
|
||||
return Ok(Arc::new(NestedLoopJoinExec::try_new(
|
||||
physical_left,
|
||||
physical_right,
|
||||
@@ -3553,12 +3551,12 @@ mod tests {
|
||||
assert!(
|
||||
stringified_plans
|
||||
.iter()
|
||||
.any(|p| matches!(p.plan_type, PlanType::FinalLogicalPlan))
|
||||
.any(|p| p.plan_type == PlanType::FinalLogicalPlan)
|
||||
);
|
||||
assert!(
|
||||
stringified_plans
|
||||
.iter()
|
||||
.any(|p| matches!(p.plan_type, PlanType::InitialPhysicalPlan))
|
||||
.any(|p| p.plan_type == PlanType::InitialPhysicalPlan)
|
||||
);
|
||||
assert!(
|
||||
stringified_plans.iter().any(|p| matches!(
|
||||
@@ -3569,7 +3567,7 @@ mod tests {
|
||||
assert!(
|
||||
stringified_plans
|
||||
.iter()
|
||||
.any(|p| matches!(p.plan_type, PlanType::FinalPhysicalPlan))
|
||||
.any(|p| p.plan_type == PlanType::FinalPhysicalPlan)
|
||||
);
|
||||
} else {
|
||||
panic!(
|
||||
|
||||
@@ -554,7 +554,7 @@ async fn verify_ordered_aggregate(frame: &DataFrame, expected_sort: bool) {
|
||||
InputOrderMode::PartiallySorted(_) | InputOrderMode::Sorted
|
||||
));
|
||||
} else {
|
||||
assert!(matches!(exec.input_order_mode(), InputOrderMode::Linear));
|
||||
assert_eq!(*exec.input_order_mode(), InputOrderMode::Linear);
|
||||
}
|
||||
}
|
||||
Ok(TreeNodeRecursion::Continue)
|
||||
|
||||
@@ -589,7 +589,7 @@ async fn run_window_test(
|
||||
orderby_columns: Vec<&str>,
|
||||
search_mode: InputOrderMode,
|
||||
) -> Result<()> {
|
||||
let is_linear = !matches!(search_mode, Sorted);
|
||||
let is_linear = search_mode != Sorted;
|
||||
let mut rng = StdRng::seed_from_u64(random_seed);
|
||||
let schema = input1[0].schema();
|
||||
let session_config = SessionConfig::new().with_batch_size(50);
|
||||
|
||||
@@ -1416,7 +1416,7 @@ impl Signature {
|
||||
Arity::Variable => {
|
||||
// For UserDefined signatures, allow parameter names
|
||||
// The function implementer is responsible for validating the names match the actual arguments
|
||||
if !matches!(self.type_signature, TypeSignature::UserDefined) {
|
||||
if self.type_signature != TypeSignature::UserDefined {
|
||||
return plan_err!(
|
||||
"Cannot specify parameter names for variable arity signature: {:?}",
|
||||
self.type_signature
|
||||
|
||||
@@ -526,7 +526,7 @@ impl From<&DataType> for TypeCategory {
|
||||
return TypeCategory::Numeric;
|
||||
}
|
||||
|
||||
if matches!(data_type, DataType::Boolean) {
|
||||
if *data_type == DataType::Boolean {
|
||||
return TypeCategory::Boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -1965,7 +1965,7 @@ impl LogicalPlan {
|
||||
.unwrap_or_else(|| "".to_string());
|
||||
let join_type = if filter.is_none()
|
||||
&& keys.is_empty()
|
||||
&& matches!(join_type, JoinType::Inner)
|
||||
&& *join_type == JoinType::Inner
|
||||
{
|
||||
"Cross".to_string()
|
||||
} else {
|
||||
|
||||
@@ -455,7 +455,7 @@ impl AggregateUDFImpl for Regr {
|
||||
}
|
||||
|
||||
fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
|
||||
if matches!(self.regr_type, RegrType::Count) {
|
||||
if self.regr_type == RegrType::Count {
|
||||
Ok(DataType::UInt64)
|
||||
} else {
|
||||
Ok(DataType::Float64)
|
||||
|
||||
@@ -269,7 +269,7 @@ impl WindowUDFImpl for NthValue {
|
||||
kind: self.kind,
|
||||
};
|
||||
|
||||
if !matches!(self.kind, NthValueKind::Nth) {
|
||||
if self.kind != NthValueKind::Nth {
|
||||
return Ok(Box::new(NthValueEvaluator {
|
||||
state,
|
||||
ignore_nulls: partition_evaluator_args.ignore_nulls(),
|
||||
|
||||
@@ -517,7 +517,7 @@ impl ScalarUDFImpl for GetFieldFunc {
|
||||
let all_keys_are_literals = args
|
||||
.iter()
|
||||
.skip(1)
|
||||
.all(|p| matches!(p, ExpressionPlacement::Literal));
|
||||
.all(|p| *p == ExpressionPlacement::Literal);
|
||||
|
||||
if base_is_pushable && all_keys_are_literals {
|
||||
ExpressionPlacement::MoveTowardsLeafNodes
|
||||
|
||||
@@ -461,7 +461,7 @@ fn build_join(
|
||||
//
|
||||
// Additionally, if the join keys are non-nullable on both sides, we don't need
|
||||
// null-aware semantics because NULLs cannot exist in the data.
|
||||
let null_aware = matches!(join_type, JoinType::LeftAnti)
|
||||
let null_aware = join_type == JoinType::LeftAnti
|
||||
&& in_predicate_opt.is_some()
|
||||
&& join_keys_may_be_null(&join_filter, left.schema(), sub_query_alias.schema())?;
|
||||
|
||||
|
||||
@@ -618,7 +618,7 @@ impl InferredPredicates {
|
||||
fn new(join_type: JoinType) -> Self {
|
||||
Self {
|
||||
predicates: vec![],
|
||||
is_inner_join: matches!(join_type, JoinType::Inner),
|
||||
is_inner_join: join_type == JoinType::Inner,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2279,7 +2279,7 @@ mod tests {
|
||||
make_lit_i32(250),
|
||||
));
|
||||
let expr = CaseExpr::try_new(None, vec![(predicate, make_col("c2", 1))], None)?;
|
||||
assert!(matches!(expr.eval_method, EvalMethod::InfallibleExprOrNull));
|
||||
assert_eq!(expr.eval_method, EvalMethod::InfallibleExprOrNull);
|
||||
match expr.evaluate(&batch)? {
|
||||
ColumnarValue::Array(array) => {
|
||||
assert_eq!(1000, array.len());
|
||||
|
||||
@@ -157,7 +157,7 @@ impl PartitioningSatisfaction {
|
||||
}
|
||||
|
||||
pub fn is_subset(&self) -> bool {
|
||||
matches!(self, Self::Subset)
|
||||
*self == Self::Subset
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ impl PhysicalOptimizerRule for CombinePartialFinalAggregate {
|
||||
return Ok(Transformed::no(plan));
|
||||
};
|
||||
|
||||
let transformed = if matches!(input_agg_exec.mode(), AggregateMode::Partial)
|
||||
let transformed = if *input_agg_exec.mode() == AggregateMode::Partial
|
||||
&& can_combine(
|
||||
(
|
||||
agg_exec.group_expr(),
|
||||
|
||||
@@ -498,7 +498,7 @@ pub fn reorder_aggregate_keys(
|
||||
&& !physical_exprs_equal(&output_exprs, parent_required)
|
||||
&& let Some(positions) = expected_expr_positions(&output_exprs, parent_required)
|
||||
&& let Some(agg_exec) = agg_exec.input().as_any().downcast_ref::<AggregateExec>()
|
||||
&& matches!(agg_exec.mode(), &AggregateMode::Partial)
|
||||
&& *agg_exec.mode() == AggregateMode::Partial
|
||||
{
|
||||
let group_exprs = agg_exec.group_expr().expr();
|
||||
let new_group_exprs = positions
|
||||
@@ -625,7 +625,7 @@ pub fn reorder_join_keys_to_inputs(
|
||||
..
|
||||
}) = plan_any.downcast_ref::<HashJoinExec>()
|
||||
{
|
||||
if matches!(mode, PartitionMode::Partitioned) {
|
||||
if *mode == PartitionMode::Partitioned {
|
||||
let (join_keys, positions) = reorder_current_join_keys(
|
||||
extract_join_keys(on),
|
||||
Some(left.output_partitioning()),
|
||||
@@ -1264,7 +1264,7 @@ pub fn ensure_distribution(
|
||||
let is_partitioned_join = plan
|
||||
.as_any()
|
||||
.downcast_ref::<HashJoinExec>()
|
||||
.is_some_and(|join| matches!(join.mode, PartitionMode::Partitioned))
|
||||
.is_some_and(|join| join.mode == PartitionMode::Partitioned)
|
||||
|| plan.as_any().is::<SortMergeJoinExec>();
|
||||
|
||||
let repartition_status_flags =
|
||||
|
||||
@@ -1116,7 +1116,7 @@ impl AggregateExec {
|
||||
/// - If yes, init one inside `AggregateExec`'s `dynamic_filter` field.
|
||||
/// - If not supported, `self.dynamic_filter` should be kept `None`
|
||||
fn init_dynamic_filter(&mut self) {
|
||||
if (!self.group_by.is_empty()) || (!matches!(self.mode, AggregateMode::Partial)) {
|
||||
if (!self.group_by.is_empty()) || (self.mode != AggregateMode::Partial) {
|
||||
debug_assert!(
|
||||
self.dynamic_filter.is_none(),
|
||||
"The current operator node does not support dynamic filter"
|
||||
@@ -1492,7 +1492,7 @@ impl ExecutionPlan for AggregateExec {
|
||||
);
|
||||
|
||||
// Include self dynamic filter when it's possible
|
||||
if matches!(phase, FilterPushdownPhase::Post)
|
||||
if phase == FilterPushdownPhase::Post
|
||||
&& config.optimizer.enable_aggregate_dynamic_filter_pushdown
|
||||
&& let Some(self_dyn_filter) = &self.dynamic_filter
|
||||
{
|
||||
@@ -1515,7 +1515,7 @@ impl ExecutionPlan for AggregateExec {
|
||||
|
||||
// If this node tried to pushdown some dynamic filter before, now we check
|
||||
// if the child accept the filter
|
||||
if matches!(phase, FilterPushdownPhase::Post)
|
||||
if phase == FilterPushdownPhase::Post
|
||||
&& let Some(dyn_filter) = &self.dynamic_filter
|
||||
{
|
||||
// let child_accepts_dyn_filter = child_pushdown_result
|
||||
|
||||
@@ -585,7 +585,7 @@ impl ExecutionPlan for FilterExec {
|
||||
parent_filters: Vec<Arc<dyn PhysicalExpr>>,
|
||||
_config: &ConfigOptions,
|
||||
) -> Result<FilterDescription> {
|
||||
if !matches!(phase, FilterPushdownPhase::Pre) {
|
||||
if phase != FilterPushdownPhase::Pre {
|
||||
let child =
|
||||
ChildFilterDescription::from_child(&parent_filters, self.input())?;
|
||||
return Ok(FilterDescription::new().with_child(child));
|
||||
@@ -608,7 +608,7 @@ impl ExecutionPlan for FilterExec {
|
||||
child_pushdown_result: ChildPushdownResult,
|
||||
_config: &ConfigOptions,
|
||||
) -> Result<FilterPushdownPropagation<Arc<dyn ExecutionPlan>>> {
|
||||
if !matches!(phase, FilterPushdownPhase::Pre) {
|
||||
if phase != FilterPushdownPhase::Pre {
|
||||
return Ok(FilterPushdownPropagation::if_all(child_pushdown_result));
|
||||
}
|
||||
// We absorb any parent filters that were not handled by our children
|
||||
|
||||
@@ -354,7 +354,7 @@ impl HashJoinExecBuilder {
|
||||
|
||||
// Validate null_aware flag
|
||||
if null_aware {
|
||||
if !matches!(join_type, JoinType::LeftAnti) {
|
||||
if join_type != JoinType::LeftAnti {
|
||||
return plan_err!(
|
||||
"null_aware can only be true for LeftAnti joins, got {join_type}"
|
||||
);
|
||||
@@ -1016,7 +1016,7 @@ impl DisplayAs for HashJoinExec {
|
||||
"".to_string()
|
||||
};
|
||||
let display_null_equality =
|
||||
if matches!(self.null_equality(), NullEquality::NullEqualsNull) {
|
||||
if self.null_equality() == NullEquality::NullEqualsNull {
|
||||
", NullsEqual: true"
|
||||
} else {
|
||||
""
|
||||
@@ -1058,7 +1058,7 @@ impl DisplayAs for HashJoinExec {
|
||||
|
||||
writeln!(f, "on={on}")?;
|
||||
|
||||
if matches!(self.null_equality(), NullEquality::NullEqualsNull) {
|
||||
if self.null_equality() == NullEquality::NullEqualsNull {
|
||||
writeln!(f, "NullsEqual: true")?;
|
||||
}
|
||||
|
||||
@@ -1545,7 +1545,7 @@ impl ExecutionPlan for HashJoinExec {
|
||||
};
|
||||
|
||||
// Add dynamic filters in Post phase if enabled
|
||||
if matches!(phase, FilterPushdownPhase::Post)
|
||||
if phase == FilterPushdownPhase::Post
|
||||
&& self.allow_join_dynamic_filter_pushdown(config)
|
||||
{
|
||||
// Add actual dynamic filter to right side (probe side)
|
||||
|
||||
@@ -490,7 +490,7 @@ fn resolve_classic_join(
|
||||
// If we find a match we append all indices and move to the next stream row index
|
||||
match operator {
|
||||
Operator::Gt | Operator::Lt => {
|
||||
if matches!(compare, Ordering::Less) {
|
||||
if compare == Ordering::Less {
|
||||
batch_process_state.found = true;
|
||||
let count = buffered_len - buffer_idx;
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ impl DisplayAs for SortMergeJoinExec {
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ");
|
||||
let display_null_equality =
|
||||
if matches!(self.null_equality(), NullEquality::NullEqualsNull) {
|
||||
if self.null_equality() == NullEquality::NullEqualsNull {
|
||||
", NullsEqual: true"
|
||||
} else {
|
||||
""
|
||||
@@ -386,7 +386,7 @@ impl DisplayAs for SortMergeJoinExec {
|
||||
}
|
||||
writeln!(f, "on={on}")?;
|
||||
|
||||
if matches!(self.null_equality(), NullEquality::NullEqualsNull) {
|
||||
if self.null_equality() == NullEquality::NullEqualsNull {
|
||||
writeln!(f, "NullsEqual: true")?;
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ impl JoinedRecordBatches {
|
||||
/// Maintains invariant: N rows → N metadata entries (nulls)
|
||||
fn push_batch_with_null_metadata(&mut self, batch: RecordBatch, join_type: JoinType) {
|
||||
debug_assert!(
|
||||
matches!(join_type, JoinType::Full),
|
||||
join_type == JoinType::Full,
|
||||
"push_batch_with_null_metadata should only be called for Full joins"
|
||||
);
|
||||
|
||||
@@ -1081,7 +1081,7 @@ impl SortMergeJoinStream {
|
||||
}
|
||||
}
|
||||
Ordering::Greater => {
|
||||
if matches!(self.join_type, JoinType::Full) {
|
||||
if self.join_type == JoinType::Full {
|
||||
join_buffered = !self.buffered_joined;
|
||||
};
|
||||
}
|
||||
@@ -1181,7 +1181,7 @@ impl SortMergeJoinStream {
|
||||
// Applicable only in case of Full join.
|
||||
//
|
||||
fn freeze_buffered(&mut self, batch_count: usize) -> Result<()> {
|
||||
if !matches!(self.join_type, JoinType::Full) {
|
||||
if self.join_type != JoinType::Full {
|
||||
return Ok(());
|
||||
}
|
||||
for buffered_batch in self.buffered_data.batches.range_mut(..batch_count) {
|
||||
@@ -1206,7 +1206,7 @@ impl SortMergeJoinStream {
|
||||
&mut self,
|
||||
buffered_batch: &mut BufferedBatch,
|
||||
) -> Result<()> {
|
||||
if !matches!(self.join_type, JoinType::Full) {
|
||||
if self.join_type != JoinType::Full {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -1294,7 +1294,7 @@ impl SortMergeJoinStream {
|
||||
let filter_columns = if let Some(buffered_batch_idx) =
|
||||
chunk.buffered_batch_idx
|
||||
{
|
||||
if !matches!(self.join_type, JoinType::Right) {
|
||||
if self.join_type != JoinType::Right {
|
||||
if matches!(
|
||||
self.join_type,
|
||||
JoinType::LeftSemi | JoinType::LeftAnti | JoinType::LeftMark
|
||||
@@ -1329,7 +1329,7 @@ impl SortMergeJoinStream {
|
||||
vec![]
|
||||
};
|
||||
|
||||
let columns = if !matches!(self.join_type, JoinType::Right) {
|
||||
let columns = if self.join_type != JoinType::Right {
|
||||
left_columns.extend(right_columns);
|
||||
left_columns
|
||||
} else {
|
||||
@@ -1382,7 +1382,7 @@ impl SortMergeJoinStream {
|
||||
|
||||
if needs_deferred_filtering {
|
||||
// Outer/semi/anti/mark joins: push unfiltered batch with metadata for deferred filtering
|
||||
let mask_to_use = if !matches!(self.join_type, JoinType::Full) {
|
||||
let mask_to_use = if self.join_type != JoinType::Full {
|
||||
&mask
|
||||
} else {
|
||||
pre_mask
|
||||
@@ -1406,7 +1406,7 @@ impl SortMergeJoinStream {
|
||||
// all joined rows are failed on the join filter.
|
||||
// I.e., if all rows joined from a streamed row are failed with the join filter,
|
||||
// we need to join it with nulls as buffered side.
|
||||
if matches!(self.join_type, JoinType::Full) {
|
||||
if self.join_type == JoinType::Full {
|
||||
let buffered_batch = &mut self.buffered_data.batches
|
||||
[chunk.buffered_batch_idx.unwrap()];
|
||||
|
||||
|
||||
@@ -3103,7 +3103,7 @@ fn test_partition_statistics() -> Result<()> {
|
||||
);
|
||||
// Verify that aggregate statistics have a meaningful num_rows (not Absent)
|
||||
assert!(
|
||||
!matches!(stats.num_rows, Precision::Absent),
|
||||
stats.num_rows != Precision::Absent,
|
||||
"Aggregate stats should have meaningful num_rows for {join_type:?}, got {:?}",
|
||||
stats.num_rows
|
||||
);
|
||||
@@ -3121,7 +3121,7 @@ fn test_partition_statistics() -> Result<()> {
|
||||
);
|
||||
// When children return unknown stats, the join's partition stats will be Absent
|
||||
assert!(
|
||||
matches!(partition_stats.num_rows, Precision::Absent),
|
||||
partition_stats.num_rows == Precision::Absent,
|
||||
"Partition stats should have Absent num_rows when children return unknown for {join_type:?}, got {:?}",
|
||||
partition_stats.num_rows
|
||||
);
|
||||
|
||||
@@ -739,7 +739,7 @@ fn max_distinct_count(
|
||||
{
|
||||
let range_dc = range_dc as usize;
|
||||
// Note that the `unwrap` calls in the below statement are safe.
|
||||
return if matches!(result, Precision::Absent)
|
||||
return if result == Precision::Absent
|
||||
|| &range_dc < result.get_value().unwrap()
|
||||
{
|
||||
if stats.min_value.is_exact().unwrap()
|
||||
|
||||
@@ -1411,7 +1411,7 @@ impl ExecutionPlan for SortExec {
|
||||
parent_filters: Vec<Arc<dyn PhysicalExpr>>,
|
||||
config: &datafusion_common::config::ConfigOptions,
|
||||
) -> Result<FilterDescription> {
|
||||
if !matches!(phase, FilterPushdownPhase::Post) {
|
||||
if phase != FilterPushdownPhase::Post {
|
||||
return FilterDescription::from_children(parent_filters, &self.children());
|
||||
}
|
||||
|
||||
|
||||
@@ -383,7 +383,7 @@ impl ExecutionPlan for UnionExec {
|
||||
// children with FilterExec and reporting all filters as handled.
|
||||
// Post phase: use default behavior to let the filter creator decide how to handle
|
||||
// filters that weren't fully pushed down.
|
||||
if !matches!(phase, FilterPushdownPhase::Pre) {
|
||||
if phase != FilterPushdownPhase::Pre {
|
||||
return Ok(FilterPushdownPropagation::if_all(child_pushdown_result));
|
||||
}
|
||||
|
||||
|
||||
@@ -1273,7 +1273,7 @@ fn build_single_column_expr(
|
||||
) -> Option<Arc<dyn PhysicalExpr>> {
|
||||
let field = schema.field_with_name(column.name()).ok()?;
|
||||
|
||||
if matches!(field.data_type(), &DataType::Boolean) {
|
||||
if *field.data_type() == DataType::Boolean {
|
||||
let col_ref = Arc::new(column.clone()) as _;
|
||||
|
||||
let min = required_columns
|
||||
|
||||
@@ -96,9 +96,7 @@ impl ScalarUDFImpl for MapFromArrays {
|
||||
fn map_from_arrays_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
|
||||
let [keys, values] = take_function_args("map_from_arrays", args)?;
|
||||
|
||||
if matches!(keys.data_type(), DataType::Null)
|
||||
|| matches!(values.data_type(), DataType::Null)
|
||||
{
|
||||
if *keys.data_type() == DataType::Null || *values.data_type() == DataType::Null {
|
||||
return Ok(cast(
|
||||
&NullArray::new(keys.len()),
|
||||
&map_type_from_key_value_types(
|
||||
|
||||
@@ -238,11 +238,11 @@ macro_rules! width_bucket_kernel_impl {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if matches!(ord, std::cmp::Ordering::Equal) {
|
||||
if ord == std::cmp::Ordering::Equal {
|
||||
b.append_null();
|
||||
continue;
|
||||
}
|
||||
let asc = matches!(ord, std::cmp::Ordering::Less);
|
||||
let asc = ord == std::cmp::Ordering::Less;
|
||||
|
||||
if asc {
|
||||
if x < l {
|
||||
|
||||
@@ -598,7 +598,7 @@ impl ConversionType {
|
||||
pub fn validate(&self, arg_type: &DataType) -> Result<()> {
|
||||
match self {
|
||||
ConversionType::BooleanLower | ConversionType::BooleanUpper => {
|
||||
if !matches!(arg_type, DataType::Boolean) {
|
||||
if *arg_type != DataType::Boolean {
|
||||
return exec_err!(
|
||||
"Invalid argument type for boolean conversion: {:?}",
|
||||
arg_type
|
||||
|
||||
@@ -122,7 +122,7 @@ impl FunctionArgs {
|
||||
null_treatment: null_treatment.map(|v| v.into()),
|
||||
distinct: false,
|
||||
within_group,
|
||||
function_without_parentheses: matches!(args, FunctionArguments::None),
|
||||
function_without_parentheses: args == FunctionArguments::None,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -713,8 +713,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
|
||||
SQLDataType::Timestamp(precision, tz_info)
|
||||
if precision.is_none() || [0, 3, 6, 9].contains(&precision.unwrap()) =>
|
||||
{
|
||||
let tz = if matches!(tz_info, TimezoneInfo::Tz)
|
||||
|| matches!(tz_info, TimezoneInfo::WithTimeZone)
|
||||
let tz = if *tz_info == TimezoneInfo::Tz
|
||||
|| *tz_info == TimezoneInfo::WithTimeZone
|
||||
{
|
||||
// Timestamp With Time Zone
|
||||
// INPUT : [SQLDataType] TimestampTz + [Config] Time Zone
|
||||
@@ -735,8 +735,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
|
||||
}
|
||||
SQLDataType::Date => Ok(DataType::Date32),
|
||||
SQLDataType::Time(None, tz_info) => {
|
||||
if matches!(tz_info, TimezoneInfo::None)
|
||||
|| matches!(tz_info, TimezoneInfo::WithoutTimeZone)
|
||||
if *tz_info == TimezoneInfo::None
|
||||
|| *tz_info == TimezoneInfo::WithoutTimeZone
|
||||
{
|
||||
Ok(DataType::Time64(TimeUnit::Nanosecond))
|
||||
} else {
|
||||
|
||||
@@ -35,7 +35,7 @@ pub fn from_cast(
|
||||
// only the untyped(a null scalar value) null literal need this special handling
|
||||
// since all other kind of nulls are already typed and can be handled by substrait
|
||||
// e.g. null::<Int32Type> or null::<Utf8Type>
|
||||
if matches!(lit, ScalarValue::Null) {
|
||||
if *lit == ScalarValue::Null {
|
||||
let lit = Literal {
|
||||
nullable: true,
|
||||
type_variation_reference: DEFAULT_TYPE_VARIATION_REF,
|
||||
|
||||
Reference in New Issue
Block a user