FirelyTeam / firely-cql-sdk

BSD 3-Clause "New" or "Revised" License
30 stars 17 forks source link

613 Fix CqlComparer for tuples #614

Open baseTwo opened 1 month ago

baseTwo commented 1 month ago

Fix for

Work

Integration Runner

While working on this PR, I also looked at the integration tests for CMS measure. I found they were flaky, due to the libraries sometimes failing to create. This was due to the CqlTupleMetadata calculating the hashcode in the constructor, and that used Hasher.Instance which uses MD5 to hash a string. For some strange reason, a NullReferenceException is sometimes thrown deep inside the stack trace. I changed the CqlTupleMetadata to do hash calculation lazily.

I also discovered that the KeyValuePairComparer<TKey,TValue> comparer fails when TValue is an object when doing a compare. An error is thrown stating that 'object' is not comparable. I fixed this by using the ICqlComparer on key and value instead.

Test pass rate increased from 68% to 72%