You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/25 23:30:17 UTC
[GitHub] [arrow-datafusion] viirya commented on a diff in pull request #2794: Use coerced type in inlist expr planning
viirya commented on code in PR #2794:
URL: https://github.com/apache/arrow-datafusion/pull/2794#discussion_r906734741
##########
datafusion/physical-expr/src/planner.rs:
##########
@@ -294,43 +292,18 @@ pub fn create_physical_expr(
input_schema,
execution_props,
),
- // TODO refactor the logic of coercion the data type
- // data type in the `list expr` may be conflict with `value expr`,
- // we should not just compare data type between `value expr` with each `list expr`.
- _ => {
- let list_expr = create_physical_expr(
- expr,
- input_dfschema,
- input_schema,
- execution_props,
- )?;
- let list_expr_data_type =
- list_expr.data_type(input_schema)?;
-
- if list_expr_data_type == value_expr_data_type {
- Ok(list_expr)
- } else if can_cast_types(
- &list_expr_data_type,
- &value_expr_data_type,
- ) {
- // TODO: Can't cast from list type to value type directly
- // We should use the coercion rule to get the common data type
- expressions::cast(
- list_expr,
- input_schema,
- value_expr.data_type(input_schema)?,
- )
- } else {
- Err(DataFusionError::Plan(format!(
- "Unsupported CAST from {:?} to {:?}",
- list_expr_data_type, value_expr_data_type
- )))
- }
- }
+ _ => create_physical_expr(
+ expr,
+ input_dfschema,
+ input_schema,
+ execution_props,
+ ),
})
.collect::<Result<Vec<_>>>()?;
- expressions::in_list(value_expr, list_exprs, negated, input_schema)
+ let (cast_expr, cast_list_exprs) =
+ in_list_cast(value_expr, list_exprs, input_schema)?;
Review Comment:
We should check data type casting for in_list during expression planning.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org