Skip to content

[Bug] FunctionChange.UpdateDefinition.hashCode omits name and hashes definition twice #8515

Description

@thswlsqls

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version
master @ 0e22fa8 / 2.0-SNAPSHOT

Compute Engine
Engine-agnostic (JavaAPI, paimon-api)

Minimal reproduce step
FunctionChange.UpdateDefinition.hashCode() (paimon-api/src/main/java/org/apache/paimon/function/FunctionChange.java line 302) returns Objects.hash(definition, definition): it hashes definition twice and omits name. Its own equals() compares both name and definition, and the sibling AddDefinition.hashCode() in the same file correctly uses Objects.hash(name, definition).

What doesn't meet your expectations?
Two UpdateDefinition objects with the same definition but different name are unequal, yet collide into the same hash code. This degrades hash-based collections (HashMap/HashSet) that key on these objects.

Anything else?
N/A

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions