More Hashing questions - Mailing list pgsql-hackers

From Greg Stark
Subject More Hashing questions
Date
Msg-id 87fzafyfou.fsf@stark.xeocode.com
Whole thread Raw
Responses Re: More Hashing questions
List 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



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: PITR logging control program
Next
From: "Carl E. McMillin"
Date:
Subject: Re: Hacking postgres backend process