From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
Cc: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz> |
Subject: | Re: Abbreviated keys for Numeric |
Date: | 2015-03-24 04:24:18 |
Message-ID: | CAM3SWZT-xHa2Er1-dEC9NzU+D==kNj8+sYYbyoSdVckiq0VNdw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Mar 22, 2015 at 1:01 PM, Andrew Gierth
<andrew(at)tao11(dot)riddles(dot)org(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2015-03-24 04:44:20 | Re: Display of multi-target-table Modify plan nodes in EXPLAIN |
Previous Message | Alvaro Herrera | 2015-03-24 02:46:21 | Re: Table-level log_autovacuum_min_duration |