Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unparse table scan with the projection pushdown #12534

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

goldmedal
Copy link
Contributor

Which issue does this PR close?

no corresponding issue.

Rationale for this change

The projection indices of a TableScan are the index number of its source schema. I used the projected_schema that is the output schema of the table scan in the previous PR. Some cases like the following one will fail because the index is out of the bound.

    let schema = Schema::new(vec![
        Field::new("id", DataType::Utf8, false),
        Field::new("age", DataType::Utf8, false),
    ]);

    let scan_with_projection = table_scan(Some("t1"), &schema, Some(vec![1]))?.build()?;
    let scan_with_projection = plan_to_sql(&scan_with_projection)?;
    assert_eq!(format!("{}", scan_with_projection), "SELECT t1.age FROM t1");

What changes are included in this PR?

  • Use the source schema instead of projected_schema.

Are these changes tested?

yes

Are there any user-facing changes?

no

@github-actions github-actions bot added the sql SQL Planner label Sep 19, 2024
@alamb
Copy link
Contributor

alamb commented Sep 19, 2024

FYI @phillipleblanc and @sgrebnov , do you possibly have time to review this PR?

@sgrebnov
Copy link
Member

@goldmedal , @alamb - the change looks good, thank you!

Copy link
Contributor

@phillipleblanc phillipleblanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching and fixing this.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @goldmedal and for the reviews @phillipleblanc and @sgrebnov 🚀

We can keep the code moving fast with distributed review 🚋

@alamb alamb merged commit f2159e6 into apache:main Sep 20, 2024
24 checks passed
@goldmedal
Copy link
Contributor Author

Thanks @alamb @sgrebnov @phillipleblanc for the review 👍

@goldmedal goldmedal deleted the bugfix/fix-unparse-projection branch September 20, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants