Skip to content

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

Closed

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

Activity

  1. self-assigned this
    on Jun 9, 2023
  2. jackwener commented on Jun 9, 2023

    @jackwener
    MemberAuthor
  3. alamb commented on Jun 9, 2023

    @alamb
    Contributor

    Good catch @jackwener

  4. changed the title [-]`from_plan` should create projection by using original schema[/-] [+]`from_plan` shouldn't create projection by using original schema[/+] on Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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