More Hashing questions

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: More Hashing questions
Date: 2004-05-04 22:45:37
Message-ID: 87fzafyfou.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Regarding inter-data-type hash joins, would it make sense to make float
datatypes to hash to the same value as integral data types for integral
values?

Conveniently this would cover the existing special case of -0 and +0 hashing
to the same value. Something like this?

Datum
hashfloat4(PG_FUNCTION_ARGS)
{
float4 key = PG_GETARG_FLOAT4(0);

if (key == (int32)key)
PG_RETURN_UINT32(~(int32)key);

return hash_any((unsigned char *) &key, sizeof(key));
}

Incidentally, why do all the floatfoo functions invert the value? It doesn't
seem like that affects the quality of the hash at all.

--
greg

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Carl E. McMillin 2004-05-05 02:17:29 Re: Hacking postgres backend process
Previous Message Simon Riggs 2004-05-04 21:50:05 Re: PITR logging control program