Skip to content

Parsing SQL strings to Exprs with the qualified schema - #11562

Merged
jonahgao merged 2 commits into
apache:mainfrom
Lordworms:issue_11551
Jul 25, 2024
Merged

jonahgao merged 2 commits into
apache:mainfrom
Lordworms:issue_11551

Conversation

@Lordworms

@Lordworms Lordworms commented Jul 20, 2024 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #11551

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added sql SQL Planner core Core DataFusion crate labels Jul 20, 2024
@Lordworms
Lordworms marked this pull request as ready for review July 20, 2024 22:46
@github-actions github-actions Bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Jul 20, 2024
@goldmedal

Copy link
Copy Markdown
Contributor

I guess it will close #11551. How about modifying the description to link this issue?

@Lordworms

Copy link
Copy Markdown
Contributor Author

I guess it will close #11551. How about modifying the description to link this issue?

sure

@goldmedal goldmedal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Lordworms. LGTM

Comment thread datafusion/sql/src/expr/identifier.rs Outdated
Comment on lines +55 to +61
let is_unnamed_table = match &qualifier {
TableReference::Bare { table } => table.as_ref() == UNNAMED_TABLE,
TableReference::Partial { table, .. } => {
table.as_ref() == UNNAMED_TABLE
}
TableReference::Full { table, .. } => table.as_ref() == UNNAMED_TABLE,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@alamb alamb changed the title Parsing SQL strings to Exprs wtih the qualified schema Parsing SQL strings to Exprs with the qualified schema Jul 22, 2024
@alamb
alamb requested a review from jonahgao July 22, 2024 18:51
@alamb

alamb commented Jul 22, 2024

Copy link
Copy Markdown
Contributor

Thanks @Lordworms and @goldmedal

Since this changes the logic to resolve identifiers I think it should have a more careful review. Maybe @jonahgao has time. If not I will try and find time later this week

@jonahgao jonahgao left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I left some comments, and overall, it looks good to me. I think determining the qualifiers in advance might be an improvement.

Previously, it always returned unqualified columns, possibly because it didn't search within a schema.
Related PR: #1449 #5593

Comment thread datafusion/sql/src/expr/identifier.rs Resolved
Comment thread datafusion/sql/src/expr/identifier.rs Resolved
@jonahgao
jonahgao merged commit c951824 into apache:main Jul 25, 2024
@jonahgao

Copy link
Copy Markdown
Member

Thanks @Lordworms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate optimizer Optimizer rules sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parsing SQL strings to Exprs wtih the qualified schema

4 participants