Skip to content

fix: add equals/hashCode to FullTextQuery concrete subclasses#6674

Open
ivscheianu wants to merge 4 commits intolance-format:mainfrom
ivscheianu:full-text-query-eq-and-hashcode
Open

fix: add equals/hashCode to FullTextQuery concrete subclasses#6674
ivscheianu wants to merge 4 commits intolance-format:mainfrom
ivscheianu:full-text-query-eq-and-hashcode

Conversation

@ivscheianu
Copy link
Copy Markdown
Contributor

Changes

Adding equals() and hashCode() to MatchQuery, PhraseQuery, and MultiMatchQuery in FullTextQuery.

Why

The concrete subclasses currently inherit reference equality from Object. Two independently constructed instances with identical fields are not equals() and produce different hash codes.

This was surfaced while trying to sketch an impl for SQL FTS query support in lance-spark, which allows users to push lance_match, lance_phrase, and lance_multi_match predicates down to the Lance FTS inverted index at query planning time. That work requires transporting FullTextQuery instances across the driver -> executor boundary, serializing them to a stable intermediate form and reconstructing them on the other side. Without structural equality, comparing a reconstructed instance to the original always returns false even when every field is identical, making correct scan identity checks impossible.

More broadly, any consumer that serializes a FullTextQuery and reconstructs it later faces the same problem. The fix is mechanical and non-breaking: callers that never compared these objects structurally are unaffected.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added bug Something isn't working java labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant