Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdks/julia/LogicalQueryProtocol.jl/src/equality.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions sdks/julia/LogicalQueryProtocol.jl/test/equality_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading