Skip to content

from_plan shouldn't create projection by using original schema #6613

@jackwener

Description

@jackwener

Describe the bug

#5821 #6596 is caused by this problem.

In original code, project call from_plan, it will keep original schema even if expression are different.
It's wrong! Because different expression will have different schema.

code is wrong

        LogicalPlan::Projection(Projection { schema, .. }) => {
            Ok(LogicalPlan::Projection(Projection::try_new_with_schema(
                expr.to_vec(),
                Arc::new(inputs[0].clone()),
                schema. Clone(),
            )?))
        }

should be

        LogicalPlan::Projection(_) => Ok(LogicalPlan::Projection(Projection::try_new(
            expr.to_vec(),
            Arc::new(inputs[0].clone()),
        )?)),

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions