Skip to content

Unify schema usage in Datafusion #10442

@comphead

Description

@comphead

Sometimes DF uses 2 schema sources, which is schema from previous node and current like in example(s) below.

Would be nice to check if we can use only 1 schema, multiple schemas are usually confusing

          I agree it doesn't make sense -- however, it is the same logic as in `with_new_exprs`:

LogicalPlan::Union(Union { schema, .. }) => {
let input_schema = inputs[0].schema();
// If inputs are not pruned do not change schema.
let schema = if schema.fields().len() == input_schema.fields().len() {
schema.clone()
} else {
input_schema.clone()
};
Ok(LogicalPlan::Union(Union {
inputs: inputs.into_iter().map(Arc::new).collect(),
schema,
}))
}

Originally posted by @alamb in #10405 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions