neilconway commented on code in PR #21908:
URL: https://github.com/apache/datafusion/pull/21908#discussion_r3228119287
##########
datafusion/optimizer/src/simplify_expressions/unwrap_cast.rs:
##########
@@ -59,46 +59,43 @@ use datafusion_common::{Result, ScalarValue};
use datafusion_common::{internal_err, tree_node::Transformed};
use datafusion_expr::{BinaryExpr, lit};
use datafusion_expr::{Cast, Expr, Operator, TryCast,
simplify::SimplifyContext};
-use datafusion_expr_common::casts::{is_supported_type,
try_cast_literal_to_type};
+use datafusion_expr_common::casts::{
+ CastComparisonRewrite, is_supported_type,
try_cast_literal_for_comparison_unwrap,
+ try_cast_literal_to_type,
+};
pub(super) fn unwrap_cast_in_comparison_for_binary(
info: &SimplifyContext,
- cast_expr: Expr,
- literal: Expr,
+ cast_expr: &Expr,
+ literal: &Expr,
op: Operator,
) -> Result<Transformed<Expr>> {
+ let original = Expr::BinaryExpr(BinaryExpr {
Review Comment:
Doing two clones eagerly here seems unnecessary, especially for the no-op
path; we can move this into where `original` is actually used.
--
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]