Skip to content

Commit

Permalink
adding doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordworms committed Aug 1, 2024
1 parent 0de24c1 commit 176d8de
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,25 @@ fn table_source(table_schema: &Schema) -> Arc<dyn TableSource> {
}

/// Wrap projection for a plan, if the join keys contains normal expression.
///
/// This function ensures that all expressions in `upper_exprs` are included in the output `LogicalPlan`.
/// It handles cases where join keys contain expressions like `CAST` or `TRY_CAST`, which might otherwise
/// result in schema conflicts due to identical field names.
///
/// # Parameters
///
/// - `join_keys`: A slice of expressions representing the join keys. These keys might include expressions
/// like `CAST` or `TRY_CAST`, which need to be aliased to avoid conflicts in the projection schema.
/// - `input`: The input `LogicalPlan` that provides the schema and data for the projection.
/// - `upper_exprs`: A slice of references to expressions required by the parent join. This function
/// ensures that all these expressions are included in the output `LogicalPlan`.
///
/// # Returns
///
/// A `Result` containing a tuple with:
/// - The updated `LogicalPlan` with necessary projections.
/// - A vector of `Column` representing the join columns.
/// - A boolean indicating whether projection was needed.
pub fn wrap_projection_for_join_if_necessary(
join_keys: &[Expr],
input: LogicalPlan,
Expand Down

0 comments on commit 176d8de

Please sign in to comment.