Skip to content

PromoteValue incorrect equality #3641

@hatyo

Description

@hatyo

PromoteValue's equality seems to be underspecified:

final var INT_42 = new LiteralValue<>(Type.primitiveType(Type.TypeCode.INT), 42);
final var p1 = PromoteValue.inject(INT_42, Type.primitiveType(Type.TypeCode.LONG));
final var p2 = PromoteValue.inject(INT_42, Type.primitiveType(Type.TypeCode.DOUBLE));

p1 is deemed equal to p2 which I think is not correct, considering that each PromoteValue is promoting to a different type (one to LONG, and the other to DOUBLE).

This happens because PromoteValue does not override equalsWithoutChildren giving it a chance to take its target type into account when checking for semantic equality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplannerRelated to the query planner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions