2010YOUY01 commented on code in PR #11455:
URL: https://github.com/apache/datafusion/pull/11455#discussion_r1677007472


##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -41,20 +39,23 @@ use datafusion_expr::type_coercion::binary::get_result_type;
 use datafusion_expr::{ColumnarValue, Operator};
 use datafusion_physical_expr_common::datum::{apply, apply_cmp, 
apply_cmp_for_nested};
 
+use datafusion_physical_expr_common::expressions::Literal;
 use kernels::{
     bitwise_and_dyn, bitwise_and_dyn_scalar, bitwise_or_dyn, 
bitwise_or_dyn_scalar,
     bitwise_shift_left_dyn, bitwise_shift_left_dyn_scalar, 
bitwise_shift_right_dyn,
     bitwise_shift_right_dyn_scalar, bitwise_xor_dyn, bitwise_xor_dyn_scalar,
 };
 
 /// Binary expression
-#[derive(Debug, Hash, Clone)]
+#[derive(Debug, Clone)]
 pub struct BinaryExpr {
     left: Arc<dyn PhysicalExpr>,
     op: Operator,
     right: Arc<dyn PhysicalExpr>,
     /// Specifies whether an error is returned on overflow or not
     fail_on_overflow: bool,
+    /// precompiled regexp pattern

Review Comment:
   This comment could also say 'Only used when evaluating regex expressions', 
to make it easier to understand the whole struct.



##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -4120,4 +4187,143 @@ mod tests {
             .contains("Overflow happened on: 2147483647 * 2"));
         Ok(())
     }
+
+    macro_rules! test_regex_match_scalar {
+        (
+            $A_ARRAY:ident, 
+            $A_TYPE:expr, 
+            $A_VEC:expr, 
+            $B_SCALAR:expr, 
+            $OP:expr, 
+            $C_ARRAY:ident, 
+            $C_TYPE:expr, 
+            $VEC:expr,
+        ) => {{
+            let schema = Schema::new(vec![
+                Field::new("a", $A_TYPE, false),
+            ]);
+            let a = $A_ARRAY::from($A_VEC);
+
+            let left = col("a", &schema).unwrap();
+            let right = lit($B_SCALAR);
+
+            // verify that we can construct the expression
+            let expression = binary(left, $OP, right, &schema).unwrap();

Review Comment:
   I think we should do an extra check: the regex is compiled inside the 
expression.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to