Lordworms commented on PR #11713: URL: https://github.com/apache/datafusion/pull/11713#issuecomment-2265833859
> I checked that the final logical plan is correct, but the calling of [expand_wildcard](https://github.com/apache/datafusion/blob/d010ce90f40f2866904a4eea563afbbff72497cc/datafusion/expr/src/logical_plan/builder.rs#L1534) in `wrap_projection_for_join_if_necessary` breaks it. `expand_wildcard` removes duplicate columns in the using join, but this column is needed by the parent plan. > > The use of `expand_wildcard` was introduced in #4443. I speculate that it was a refactor of the following old implementation. > > ```rust > let mut projection = vec![Expr::Wildcard]; > projection.extend(expr_join_keys.into_iter()); > LogicalPlanBuilder::from(input) > .project(projection)? > .build()? > ``` > > Its purpose should be to re-project all the outputs of the input plan. > > So I think another simpler fix might be to replace `expand_wildcard` with [this](https://github.com/jonahgao/datafusion/commit/591f24680a8ef83d18da990baf2d38a51c288f6a). Yes, I am aware of > expand_wildcard I agree, It's is much simpler, I was thinking about how to add missing expressions that are excluded by `expand_wildcard` but haven't thought about replace it directly. Thanks for this. -- 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-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org