From 654e75e0650dad6ac7332517bab985faa8845a05 Mon Sep 17 00:00:00 2001 From: Kould <2435992353@qq.com> Date: Sun, 24 Sep 2023 02:40:40 +0800 Subject: [PATCH] style: code format --- src/optimizer/rule/pushdown_predicates.rs | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/optimizer/rule/pushdown_predicates.rs b/src/optimizer/rule/pushdown_predicates.rs index 64b3aeb6..1cef28e8 100644 --- a/src/optimizer/rule/pushdown_predicates.rs +++ b/src/optimizer/rule/pushdown_predicates.rs @@ -233,20 +233,23 @@ impl Rule for PushPredicateIntoScan { if let Some(mut binary) = option.take() { binary.scope_aggregation()?; - let mut scan_by_index = child_op.clone(); - - scan_by_index.index_by = Some((meta.clone(), binary.rearrange()?)); - - // The constant expression extracted in prewhere is used to - // reduce the data scanning range and cannot replace the role of Filter. - graph.replace_node( - child_id, - OptExprNode::OperatorRef( - Operator::Scan(scan_by_index) - ) - ); - - return Ok(()) + let rearrange_binaries = binary.rearrange()?; + + if !rearrange_binaries.is_empty() { + let mut scan_by_index = child_op.clone(); + scan_by_index.index_by = Some((meta.clone(), rearrange_binaries)); + + // The constant expression extracted in prewhere is used to + // reduce the data scanning range and cannot replace the role of Filter. + graph.replace_node( + child_id, + OptExprNode::OperatorRef( + Operator::Scan(scan_by_index) + ) + ); + + return Ok(()) + } } } }