Skip to content

Minor: make LeftJoinData into a struct in CrossJoinExec#13227

Merged
Dandandan merged 1 commit intoapache:mainfrom
alamb:alamb/cross_join_struct
Nov 4, 2024
Merged

Minor: make LeftJoinData into a struct in CrossJoinExec#13227
Dandandan merged 1 commit intoapache:mainfrom
alamb:alamb/cross_join_struct

Conversation

@alamb
Copy link
Copy Markdown
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
/// Data of the left side
type JoinLeftData = (RecordBatch, MemoryReservation);
#[derive(Debug)]
struct JoinLeftData {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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