jonahgao commented on PR #11713: URL: https://github.com/apache/datafusion/pull/11713#issuecomment-2264913915
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 https://github.com/apache/datafusion/pull/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). -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
