alamb commented on code in PR #11455:
URL: https://github.com/apache/datafusion/pull/11455#discussion_r1678277164
##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -41,20 +39,24 @@ 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,
+ /// Only used when evaluating literal regex expressions. Example regex
expression: c1 ~ '^a'
Review Comment:
I can see why you proceeded down this route. However, I think it is somewhat
strange to have something so regexp specific attached to `BinaryExpr`
I wonder if it is possible to convert regex expressions like `~` to function
calls and then use the existing function call API
https://docs.rs/datafusion/latest/datafusion/logical_expr/trait.ScalarUDFImpl.html#method.simplify
to rewrite to a new regular expression if the argument is a constant
Here is the regexp_like function:
https://github.com/apache/datafusion/blob/main/datafusion/functions/src/regex/regexplike.rs
Though now that I look at this I wonder why there are separate
implementations for `~` and `regexp_like` 🤔
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]