On Thu, Jun 15, 2023 at 5:04 AM Joel Jacobson <joel@compiler.org> wrote:
On Wed, Jun 14, 2023, at 15:16, Tomas Vondra wrote: > On 6/14/23 14:57, Joel Jacobson wrote: >> Would it be feasible to teach the planner to utilize the internal hash table of >> hashset directly? In the case of arrays, the hash table construction is an ... > It's definitely something I'd leave out of v0, personally.
OK, thanks for guidance, I'll stay away from it.
I've been doing some preparatory work on this todo item:
> 3) support for other types (now it only works with int32)
I've renamed the type from "hashset" to "int4hashset", and the SQL-functions are now prefixed with "int4" when necessary. The overloaded functions with int4hashset as input parameters don't need to be prefixed, e.g. hashset_add(int4hashset, int).
Other changes since last update (4e60615):
* Support creation of empty hashset using '{}'::hashset * Introduced a new function hashset_capacity() to return the current capacity of a hashset. * Refactored hashset initialization: - Replaced hashset_init(int) with int4hashset() to initialize an empty hashset with zero capacity. - Added int4hashset_with_capacity(int) to initialize a hashset with a specified capacity. * Improved README.md and testing
As a next step, I'm planning on adding int8 support.
Looks and sounds good?
/Joel
I am not sure the following results are correct.
with cte as (
select hashset(x) as x ,hashset_capacity(hashset(x)) ,hashset_count(hashset(x)) from generate_series(1,10) g(x)) select * ,'|' as delim , hashset_add(x,11111::int) ,hashset_capacity(hashset_add(x,11111::int)) ,hashset_count(hashset_add(x,11111::int))