diff --git a/sdks/julia/LogicalQueryProtocol.jl/src/equality.jl b/sdks/julia/LogicalQueryProtocol.jl/src/equality.jl index 39c46cb8..5dea98e8 100644 --- a/sdks/julia/LogicalQueryProtocol.jl/src/equality.jl +++ b/sdks/julia/LogicalQueryProtocol.jl/src/equality.jl @@ -607,9 +607,9 @@ Base.hash(a::CDCTargets, h::UInt) = hash(a.deletes, hash(a.inserts, h)) Base.isequal(a::CDCTargets, b::CDCTargets) = isequal(a.inserts, b.inserts) && isequal(a.deletes, b.deletes) # TargetRelations -Base.:(==)(a::TargetRelations, b::TargetRelations) = a.keys == b.keys && _isequal_oneof(a.body, b.body) -Base.hash(a::TargetRelations, h::UInt) = _hash_oneof(a.body, hash(a.keys, h)) -Base.isequal(a::TargetRelations, b::TargetRelations) = isequal(a.keys, b.keys) && _isequal_oneof(a.body, b.body) +Base.:(==)(a::TargetRelations, b::TargetRelations) = a.keys == b.keys && a.synthetic_key == b.synthetic_key && _isequal_oneof(a.body, b.body) +Base.hash(a::TargetRelations, h::UInt) = _hash_oneof(a.body, hash(a.synthetic_key, hash(a.keys, h))) +Base.isequal(a::TargetRelations, b::TargetRelations) = isequal(a.keys, b.keys) && isequal(a.synthetic_key, b.synthetic_key) && _isequal_oneof(a.body, b.body) # CSVData Base.:(==)(a::CSVData, b::CSVData) = a.locator == b.locator && a.config == b.config && a.columns == b.columns && a.asof == b.asof && a.relations == b.relations diff --git a/sdks/julia/LogicalQueryProtocol.jl/test/equality_tests.jl b/sdks/julia/LogicalQueryProtocol.jl/test/equality_tests.jl index b48cbed6..98f0b542 100644 --- a/sdks/julia/LogicalQueryProtocol.jl/test/equality_tests.jl +++ b/sdks/julia/LogicalQueryProtocol.jl/test/equality_tests.jl @@ -2339,6 +2339,14 @@ end # Different oneof arms are unequal even when they share a relation. @test g1 != cdc1 + + # `synthetic_key` participates in equality and hashing. + s1 = TargetRelations(keys=[], body=plain([rel1]), synthetic_key=true) + s2 = TargetRelations(keys=[], body=plain([rel1]), synthetic_key=true) + @test s1 == s2 + @test hash(s1) == hash(s2) + @test isequal(s1, s2) + @test s1 != g3 # same keys and body, differs only in synthetic_key end @testitem "Equality for CSVData" tags=[:ring1, :unit] begin