File tree Expand file tree Collapse file tree
datafusion/physical-optimizer/src/simplify_expressions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030//!
3131//! Physical expression: `cast(column as INT64) > INT64(10)`
3232//! Optimized to: `column > INT32(10)` (assuming column is INT32)
33- //!
34- //! # Usage
35- //!
36- //! ```rust
37- //! use datafusion_physical_optimizer::simplify_expressions::PhysicalExprSimplifier;
38- //! use arrow::datatypes::Schema;
39- //! use std::sync::Arc;
40- //! use datafusion_physical_plan::PhysicalExpr;
41- //!
42- //! // Apply unwrap cast optimization to a physical expression
43- //! fn optimize_expression(expr: Arc<dyn PhysicalExpr>, schema: &Schema) -> datafusion_common::Result<Arc<dyn PhysicalExpr>> {
44- //! let simplifier = PhysicalExprSimplifier::new(schema);
45- //! let result = simplifier.unwrap_casts(expr)?;
46- //! Ok(result.data)
47- //! }
48- //! ```
4933
5034use arrow:: datatypes:: { DataType , Schema } ;
5135use datafusion_common:: {
@@ -59,7 +43,7 @@ use datafusion_physical_plan::PhysicalExpr;
5943use std:: sync:: Arc ;
6044
6145/// Attempts to unwrap casts in comparison expressions.
62- pub fn unwrap_cast_in_comparison (
46+ pub ( crate ) fn unwrap_cast_in_comparison (
6347 expr : Arc < dyn PhysicalExpr > ,
6448 schema : & Schema ,
6549) -> Result < Transformed < Arc < dyn PhysicalExpr > > > {
You can’t perform that action at this time.
0 commit comments