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

Refactor Expr::GetIndexedField to use a struct #3838

Merged
merged 9 commits into from
Oct 18, 2022
Merged

Conversation

ygf11
Copy link
Contributor

@ygf11 ygf11 commented Oct 15, 2022

Which issue does this PR close?

Part of #2175 and #3807

Rationale for this change

Refactor Expr::GetIndexedField to use a struct.

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sql SQL Planner labels Oct 15, 2022
@ygf11 ygf11 marked this pull request as ready for review October 15, 2022 02:03
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.

Thanks @ygf11

Comment on lines 177 to 179
Expr::GetIndexedField(get_indexed_field) => {
let expr = create_physical_name(&get_indexed_field.expr, false)?;
Ok(format!("{}[{}]", expr, get_indexed_field.key))
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend this style so that if we ever change GetIndexedField the compiler will tell us all the places where a new field may be needed

Suggested change
Expr::GetIndexedField(get_indexed_field) => {
let expr = create_physical_name(&get_indexed_field.expr, false)?;
Ok(format!("{}[{}]", expr, get_indexed_field.key))
Expr::GetIndexedField(GetIndexedField { expr, key }) => {
let expr = create_physical_name(expr, false)?;
Ok(format!("{}[{}]", expr, key))

Copy link
Member

@jackwener jackwener left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @ygf11

@andygrove
Copy link
Member

@ygf11 There are some conflicts in this PR now, so I will move to draft until those are resolved - please mark this as ready for review once these are resolved.

@ygf11 ygf11 marked this pull request as ready for review October 18, 2022 01:47
@ygf11
Copy link
Contributor Author

ygf11 commented Oct 18, 2022

@alamb @andygrove @jackwener I resolved comment and conflicts, PTAL.

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.

Thanks @ygf11

@alamb alamb merged commit f93642f into apache:master Oct 18, 2022
@ygf11 ygf11 deleted the dev branch October 18, 2022 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants