@@ -155,9 +155,14 @@ instance NFData RelationTupleSet where rnf = genericRnf
156--the same hash must be generated for equal tuples so that the hashset equality works
156--the same hash must be generated for equal tuples so that the hashset equality works
157instance Hashable RelationTuple where
157instance Hashable RelationTuple where
158+ --sanity check the tuple for attribute and tuple counts
159+ --this bit me when tuples were being hashed before being verified
158− hashWithSalt salt (RelationTuple attrs tupVec) = salt `hashWithSalt`
160+ hashWithSalt salt (RelationTuple attrs tupVec) = if V.length attrs /= V.length tupVec then
161+ error "invalid tuple: attributes and tuple count mismatch"
159− sortedAttrs `hashWithSalt`
164+ sortedAttrs `hashWithSalt`
160− (V.toList sortedTupVec)
165+ (V.toList sortedTupVec)
162 sortedAttrsIndices = sortedAttributesIndices attrs
167 sortedAttrsIndices = sortedAttributesIndices attrs
163 sortedAttrs = map snd sortedAttrsIndices
168 sortedAttrs = map snd sortedAttrsIndices