Skip to content

Commit

Permalink
feat: not debug field precompiled_regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuliquan committed Jul 25, 2024
1 parent 6f3127d commit a0d3598
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions datafusion/physical-expr/src/expressions/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use kernels::{
};

/// Binary expression
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct BinaryExpr {
left: Arc<dyn PhysicalExpr>,
op: Operator,
Expand Down Expand Up @@ -116,14 +116,14 @@ impl BinaryExpr {
.downcast_ref::<Literal>()
.and_then(|pattern| match pattern.value() {
ScalarValue::Utf8(pattern) | ScalarValue::LargeUtf8(pattern) => {
pattern.as_ref().and_then(|p| {
pattern.as_ref().map(|p| {
let string_value = match op {
Operator::RegexIMatch | Operator::RegexNotIMatch => {
vec!["(?i)", p.as_str()].join("")
["(?i)", p.as_str()].join("")
}
_ => p.clone(),
};
Some(regex::Regex::new(string_value.as_str()).unwrap())
regex::Regex::new(string_value.as_str()).unwrap()
})
}
_ => None,
Expand All @@ -142,6 +142,17 @@ impl std::hash::Hash for BinaryExpr {
}
}

impl std::fmt::Debug for BinaryExpr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("BinaryExpr")
.field("left", &self.left)
.field("op", &self.op)
.field("right", &self.right)
.field("fail_on_overflow", &self.fail_on_overflow)
.finish()
}
}

impl std::fmt::Display for BinaryExpr {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
// Put parentheses around child binary expressions so that we can see the difference
Expand Down

0 comments on commit a0d3598

Please sign in to comment.