ozankabak commented on code in PR #5661:
URL: https://github.com/apache/arrow-datafusion/pull/5661#discussion_r1148423499
##########
datafusion/physical-expr/src/utils.rs:
##########
@@ -115,33 +118,21 @@ pub fn normalize_out_expr_with_alias_schema(
alias_map: &HashMap<Column, Vec<Column>>,
schema: &SchemaRef,
) -> Arc<dyn PhysicalExpr> {
- let expr_clone = expr.clone();
- expr_clone
+ expr.clone()
.transform(&|expr| {
- let normalized_form: Option<Arc<dyn PhysicalExpr>> =
- match expr.as_any().downcast_ref::<Column>() {
- Some(column) => {
- let out = alias_map
- .get(column)
- .map(|c| {
- let out_col: Arc<dyn PhysicalExpr> =
- Arc::new(c[0].clone());
- out_col
- })
- .or_else(|| match schema.index_of(column.name()) {
- // Exactly matching, return None, no need to
do the transform
- Ok(idx) if column.index() == idx => None,
- _ => {
- let out_col: Arc<dyn PhysicalExpr> =
-
Arc::new(UnKnownColumn::new(column.name()));
- Some(out_col)
- }
- });
- out
- }
- None => None,
- };
- Ok(normalized_form)
+ Ok(match expr.as_any().downcast_ref::<Column>() {
Review Comment:
Right
--
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]