Skip to content

Commit

Permalink
delete type coercion for scalar udf in the physical phase (#3735)
Browse files Browse the repository at this point in the history
  • Loading branch information
liukun4515 committed Oct 6, 2022
1 parent 7c5c2e5 commit 88eadc4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions datafusion/physical-expr/src/udf.rs
Expand Up @@ -16,8 +16,6 @@
// under the License.

//! UDF support

use super::type_coercion::coerce;
use crate::{PhysicalExpr, ScalarFunctionExpr};
use arrow::datatypes::Schema;
use datafusion_common::Result;
Expand All @@ -31,18 +29,15 @@ pub fn create_physical_expr(
input_phy_exprs: &[Arc<dyn PhysicalExpr>],
input_schema: &Schema,
) -> Result<Arc<dyn PhysicalExpr>> {
// coerce
let coerced_phy_exprs = coerce(input_phy_exprs, input_schema, &fun.signature)?;

let coerced_exprs_types = coerced_phy_exprs
let input_exprs_types = input_phy_exprs
.iter()
.map(|e| e.data_type(input_schema))
.collect::<Result<Vec<_>>>()?;

Ok(Arc::new(ScalarFunctionExpr::new(
&fun.name,
fun.fun.clone(),
coerced_phy_exprs,
(fun.return_type)(&coerced_exprs_types)?.as_ref(),
input_phy_exprs.to_vec(),
(fun.return_type)(&input_exprs_types)?.as_ref(),
)))
}

0 comments on commit 88eadc4

Please sign in to comment.