On Sun, Mar 22, 2015 at 1:01 PM, Andrew Gierth <and...@tao11.riddles.org.uk> wrote: > So here's a version 3 patch:
By the way, there was another bug in this that I forgot to point out, but removed, here: + if (nss->estimating) + { + uint32 tmp = (uint32)result; + addHyperLogLog(&nss->abbr_card, hash_uint32(tmp)); + } And here: + if (nss->estimating) + { + uint32 tmp = ((uint32)result) ^ (uint32)((uint64) result >> 32); + addHyperLogLog(&nss->abbr_card, hash_uint32(tmp)); + } (I simply operate on the raw Datum when hashing for hyperLogLog, in a similar manner to the text opclass, which is safe with 8 byte datums + pass by value int64). The problem here is that you're not calling hash_uint32() through DatumGetUInt32() - hash_uint32() returns Datum. And yes, that matters - see commit 2c22afaa. You also need to indent this code correctly. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers