|
1 | 1 | Types
|
2 | 2 | =====
|
3 | 3 |
|
4 |
| -`hll` - the HLL data structure. Casts between `bytea` and `hll` are supported, should you choose to generate the contents of the `hll` outside of the normal means. See `STORAGE.markdown`. |
| 4 | +`hll` |
| 5 | +----- |
| 6 | + |
| 7 | +The HLL data structure. Casts between `bytea` and `hll` are supported, should you choose to generate the contents of the `hll` outside of the normal means. See `STORAGE.markdown`. |
| 8 | + |
| 9 | +`SELECT hll_cardinality(E'\\xDEADBEEF');` |
| 10 | + |
| 11 | +OR |
5 | 12 |
|
6 |
| -`SELECT hll_cardinality(E'\\xDEADBEEF');` OR |
7 | 13 | `SELECT hll_cardinality(E'\\xDEADBEEF'::hll);`
|
8 | 14 |
|
9 |
| -`hll_hashval` - represents a hashed data value. Backed by a 64-bit integer (`int8in`). Typically only output by the `hll_hash_*` functions. `bigint` and `integer` can both be cast to it if you want to skip hashing those values with the typical `123::hll_hashval`. Note that an `integer` that is cast will also be cast, with sign extension, to a 64-bit integer. |
| 15 | +`hll_hashval` |
| 16 | +------------- |
| 17 | + |
| 18 | +Represents a hashed data value. Backed by a 64-bit integer (`int8in`). Typically only output by the `hll_hash_*` functions. `bigint` and `integer` can both be cast to it if you want to skip hashing those values with the typical `123::hll_hashval`. Note that an `integer` that is cast will also be cast, with sign extension, to a 64-bit integer. |
10 | 19 |
|
11 | 20 | Defaults Functions
|
12 | 21 | ==================
|
13 | 22 |
|
14 | 23 | All defaults for the `hll_empty` and `hll_add_agg` functions are in the C file, not in the SQL control file. The defaults can be changed (per connection) with:
|
15 | 24 |
|
16 |
| -`SELECT hll_set_defaults(log2m, regwidth, expthresh, sparseon);` - returns a 4-tuple with the values of the prior defaults in the same order as the arguments. |
| 25 | +`SELECT hll_set_defaults(log2m, regwidth, expthresh, sparseon);` |
| 26 | + |
| 27 | +This returns a 4-tuple with the values of the prior defaults in the same order as the arguments. |
17 | 28 |
|
18 | 29 | Basic Operational Functions
|
19 | 30 | ===========================
|
@@ -70,8 +81,15 @@ All values inserted into an `hll` should be hashed, and as a result `hll_add` an
|
70 | 81 | All the `hll_hash_*` functions below accept a seed value, which defaults to `0`. We discourage negative seeds in order to maintain hashed-value compatibility with the [Google Guava implementation of the 128-bit version of Murmur3](http://guava-libraries.googlecode.com/git/guava/src/com/google/common/hash/Murmur3_128HashFunction.java). Negative hash seeds will produce a warning when used.
|
71 | 82 |
|
72 | 83 | `hll_hash_boolean(boolean)` - hashes the `boolean` value into a `hll_hashval`.
|
| 84 | + |
73 | 85 | `hll_hash_smallint(smallint)` - hashes the `smallint` value into a `hll_hashval`.
|
| 86 | + |
74 | 87 | `hll_hash_integer(integer)` - hashes the `integer` value into a `hll_hashval`.
|
| 88 | + |
75 | 89 | `hll_hash_bigint(bigint)` - hashes the `bigint` value into a `hll_hashval`.
|
| 90 | + |
76 | 91 | `hll_hash_bytea(bytea)` - hashes the `bytea` value into a `hll_hashval`.
|
77 |
| -`hll_hash_text(text)` - hashes the `text` value into a `hll_hashval`. |
| 92 | + |
| 93 | +`hll_hash_text(text)` - hashes the `text` value into a `hll_hashval`. |
| 94 | + |
| 95 | +`hll_hash_any(scalar)` - hashes any PG data type by resolving the type dynamically and dispatching to the correct function for that type. This is significantly slower than the type-specific hash functions, and should only be used when the input type is not known beforehand. |
0 commit comments