Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete type coercion for scalar udf in the physical phase #3735

Merged
merged 1 commit into from Oct 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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(),
)))
}