Skip to content

Core: Don't override equals() and hashCode() in V4 DeletionVector - #17447

Merged
amogh-jahagirdar merged 1 commit into
apache:mainfrom
gaborkaszab:main_remove_deletionvector_equals
Aug 3, 2026
Merged

Core: Don't override equals() and hashCode() in V4 DeletionVector#17447
amogh-jahagirdar merged 1 commit into
apache:mainfrom
gaborkaszab:main_remove_deletionvector_equals

Conversation

@gaborkaszab

@gaborkaszab gaborkaszab commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The convention for V4 metadata structs like DeletionVectorStruct is that we don't override equals() and hashCode only if it's inevitable. See this comment on a previous PR. These overrides were meant to be removed/not added in that PR, however, somehow went under the radar and made it in.
This PR removes unintentionally adding the overrides.

@github-actions github-actions Bot added the core label Jul 31, 2026
@gaborkaszab
gaborkaszab force-pushed the main_remove_deletionvector_equals branch from 405ddb5 to 544114f Compare July 31, 2026 10:58
@gaborkaszab

Copy link
Copy Markdown
Contributor Author

cc @anoopj @stevenzwu @rdblue

@anoopj anoopj 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.

The change looks good to me. We don't rely on this currently so let's remove it.

@kevinjqliu

Copy link
Copy Markdown
Contributor

im curious, what is the reasoning to remove these? It seems useful. Would it be a surprise later on when comparing DeletionVector?

I see it was added originally in 7c13104#diff-44ec3b66acad90f4f873b3786f55feb62bb03287626b41bd4622c11d5ca9963fR132-R150

}

@Override
public boolean equals(Object other) {

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.

No comment documents the intended equality contract after this change. Equality is now identity-based, and the safety of that choice rests on the invariant that no caller puts DeletionVectorStruct in a Set/Map key or calls .equals() for value comparison. As key_metadata (#17438) and further V4 fields land, a future reader writing dedup/caching code could reasonably assume value equality is in place. A single class-level sentence; e.g. "Equality and hash code are identity-based; DeletionVectorStruct is a projection-backed view, not a value type" would protect this invariant. This is the same documentation gap present in none of the sibling structs (TrackedFileStruct etc.), so adding it here sets a useful precedent for the whole V4 family.

@uros-b uros-b 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.

@gaborkaszab Please note that the PR body is currently empty: no description, no linked issue, no rationale. Iceberg convention expects a description explaining why the override is being removed.

@nssalian

nssalian commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@gaborkaszab the Rationale for this change isn't clear. Please add more details and context since reviewers here might not be aware. Happy to take a look once the reasoning is fleshed out.

@gaborkaszab

Copy link
Copy Markdown
Contributor Author

Thanks for looking, @anoopj , @kevinjqliu , @uros-b , @nssalian !
The reason removing them is that they shouldn't have been added. The agreement is that we don't override them for V4 metadata structs. I added a PR description with more explanation and a link to a previous comment.

@kevinjqliu

Copy link
Copy Markdown
Contributor

thanks for the context! ❤️

@amogh-jahagirdar amogh-jahagirdar 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.

Yeah thanks for cleaning this up @gaborkaszab! I will go ahead and merge

@amogh-jahagirdar
amogh-jahagirdar merged commit 8e8343b into apache:main Aug 3, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants