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

LexRequirement as a struct, instead of a type #12583

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

ngli-me
Copy link
Contributor

@ngli-me ngli-me commented Sep 23, 2024

Which issue does this PR close?

Closes #12255.

Rationale for this change

What changes are included in this PR?

Converted LexRequirement type into a struct, with the Vec<PhysicalSortRequirement> as the field labeled inner.
Added two functions for convenience, an iter and push function relating to the struct field.
Added implementations for Deref, FromIterator and IntoIterator.

Are these changes tested?

Adjusted the existing tests

Are there any user-facing changes?

The Vec<PhysicalSortRequirement> needs to be wrapped to initialize the struct insance, and some of the usage needs to be adjusted to get the field from the struct.

@github-actions github-actions bot added physical-expr Physical Expressions core Core DataFusion crate proto Related to proto crate labels Sep 23, 2024
@ngli-me ngli-me marked this pull request as ready for review September 23, 2024 02:01
@ngli-me ngli-me changed the title Feature/struct lex requirement LexRequirement as a struct, instead of a type Sep 23, 2024
Copy link
Contributor

@berkaysynnada berkaysynnada left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @ngli-me

@@ -264,9 +267,55 @@ pub type LexOrdering = Vec<PhysicalSortExpr>;
/// a reference to a lexicographical ordering.
pub type LexOrderingRef<'a> = &'a [PhysicalSortExpr];
Copy link
Contributor

@berkaysynnada berkaysynnada Sep 23, 2024

Choose a reason for hiding this comment

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

Perhaps we could follow a similar pattern for LexOrderingRef, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a separate issue for this, #12591!

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW having a real struct will make printing these structures much easier -- e.g. I had to do some akward workarounds to implement Display or LexOrdering in #12590

…ement was not being converted after the merge.
@ngli-me
Copy link
Contributor Author

ngli-me commented Sep 23, 2024

Made some adjustments, since there was a merge conflict :)

@alamb alamb added the api change Changes the API exposed to users of the crate label Sep 23, 2024
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.

Love it -- thank you @ngli-me and @berkaysynnada

@alamb alamb merged commit bd8960e into apache:main Sep 23, 2024
24 checks passed
@ngli-me ngli-me deleted the feature/struct-lex-requirement branch September 23, 2024 21:37
bgjackma pushed a commit to bgjackma/datafusion that referenced this pull request Sep 25, 2024
* Converted LexRequirement into a struct.

* Adjusted the wrapping to return the correct type, since the LexRequirement was not being converted after the merge.

---------

Co-authored-by: nglime <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate core Core DataFusion crate physical-expr Physical Expressions proto Related to proto crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

making LexRequirement an actual struct
3 participants