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

Minor: make LeftJoinData into a struct in CrossJoinExec #13227

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Nov 1, 2024

Which issue does this PR close?

Closes #.

Rationale for this change

I was in this code for #13223 and #13203 and noticed the use of the unnamed tuple

By giving the fields names I think it becomes easier to read and comment, as well as more consistent with the other joins (like HashJoinExec):

/// HashTable and input data for the left (build side) of a join
struct JoinLeftData {

What changes are included in this PR?

Change from a tuple to a named struct

Are these changes tested?

By existing CI

Are there any user-facing changes?

@alamb alamb marked this pull request as ready for review November 1, 2024 21:35
@@ -47,7 +47,15 @@ use async_trait::async_trait;
use futures::{ready, Stream, StreamExt, TryStreamExt};

/// Data of the left side
type JoinLeftData = (RecordBatch, MemoryReservation);
#[derive(Debug)]
struct JoinLeftData {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point of the PR is to name this tuple and add comments

Comment on lines +56 to +57
#[allow(dead_code)]
reservation: MemoryReservation,
Copy link
Member

Choose a reason for hiding this comment

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

Apparently this can be also written without disabling a lint:

Suggested change
#[allow(dead_code)]
reservation: MemoryReservation,
_reservation: MemoryReservation,
  • #[allow(dead_code)] has disadvantage that it can be retained in the code even if the field becomes used
  • _reservation has disadvantage that it doesn't look pretty

Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty or not, _reservation is the language-appropriate idiom.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed #13278 to track. Thank you for the suggestion

@Dandandan Dandandan merged commit 2482ff4 into apache:main Nov 4, 2024
25 of 26 checks passed
@alamb alamb deleted the alamb/cross_join_struct branch November 6, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants