1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
-- ----------------------------------------------------------------
-- Regression tests for add aggregate hashval function.
-- ----------------------------------------------------------------
SELECT hll_set_output_version(1);
hll_set_output_version
------------------------
1
(1 row)
DROP TABLE IF EXISTS test_khvengxf;
NOTICE: table "test_khvengxf" does not exist, skipping
CREATE TABLE test_khvengxf (
val integer
);
insert into test_khvengxf(val) values (1), (2), (3);
-- Check default and explicit signatures.
select hll_print(hll_add_agg(hll_hash_integer(val)))
from test_khvengxf;
hll_print
---------------------------------------------------------------------------
EXPLICIT, 3 elements, nregs=2048, nbits=5, expthresh=-1(160), sparseon=1:+
0: -8604791237420463362 +
1: -2734554653617988768 +
2: 5208657608173592891
(1 row)
select hll_print(hll_add_agg(hll_hash_integer(val), 10))
from test_khvengxf;
hll_print
--------------------------------------------------------------------------
EXPLICIT, 3 elements, nregs=1024, nbits=5, expthresh=-1(80), sparseon=1:+
0: -8604791237420463362 +
1: -2734554653617988768 +
2: 5208657608173592891
(1 row)
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4))
from test_khvengxf;
hll_print
--------------------------------------------------------------------------
EXPLICIT, 3 elements, nregs=1024, nbits=4, expthresh=-1(64), sparseon=1:+
0: -8604791237420463362 +
1: -2734554653617988768 +
2: 5208657608173592891
(1 row)
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 512))
from test_khvengxf;
hll_print
-----------------------------------------------------------------------
EXPLICIT, 3 elements, nregs=1024, nbits=4, expthresh=512, sparseon=1:+
0: -8604791237420463362 +
1: -2734554653617988768 +
2: 5208657608173592891
(1 row)
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, -1))
from test_khvengxf;
hll_print
--------------------------------------------------------------------------
EXPLICIT, 3 elements, nregs=1024, nbits=4, expthresh=-1(64), sparseon=1:+
0: -8604791237420463362 +
1: -2734554653617988768 +
2: 5208657608173592891
(1 row)
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 512, 0))
from test_khvengxf;
hll_print
-----------------------------------------------------------------------
EXPLICIT, 3 elements, nregs=1024, nbits=4, expthresh=512, sparseon=0:+
0: -8604791237420463362 +
1: -2734554653617988768 +
2: 5208657608173592891
(1 row)
-- Check range checking.
select hll_print(hll_add_agg(hll_hash_integer(val), -1))
from test_khvengxf;
ERROR: log2m modifier must be between 0 and 17
select hll_print(hll_add_agg(hll_hash_integer(val), 32))
from test_khvengxf;
ERROR: log2m modifier must be between 0 and 17
select hll_print(hll_add_agg(hll_hash_integer(val), 10, -1))
from test_khvengxf;
ERROR: regwidth modifier must be between 0 and 7
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 8))
from test_khvengxf;
ERROR: regwidth modifier must be between 0 and 7
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, -2))
from test_khvengxf;
ERROR: expthresh modifier must be between -1 and 16383
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 8589934592))
from test_khvengxf;
ERROR: expthresh modifier must be between -1 and 16383
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 512, -1))
from test_khvengxf;
ERROR: sparseon modifier must be 0 or 1
select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 512, 2))
from test_khvengxf;
ERROR: sparseon modifier must be 0 or 1
-- Check that we return hll_empty on null input.
select hll_print(hll_add_agg(NULL));
hll_print
-----------------------------------------------------------
EMPTY, nregs=2048, nbits=5, expthresh=-1(160), sparseon=1
(1 row)
select hll_print(hll_add_agg(NULL, 10));
hll_print
----------------------------------------------------------
EMPTY, nregs=1024, nbits=5, expthresh=-1(80), sparseon=1
(1 row)
select hll_print(hll_add_agg(NULL, 10, 4));
hll_print
----------------------------------------------------------
EMPTY, nregs=1024, nbits=4, expthresh=-1(64), sparseon=1
(1 row)
select hll_print(hll_add_agg(NULL, 10, 4, 512));
hll_print
-------------------------------------------------------
EMPTY, nregs=1024, nbits=4, expthresh=512, sparseon=1
(1 row)
select hll_print(hll_add_agg(NULL, 10, 4, -1));
hll_print
----------------------------------------------------------
EMPTY, nregs=1024, nbits=4, expthresh=-1(64), sparseon=1
(1 row)
select hll_print(hll_add_agg(NULL, 10, 4, 512, 0));
hll_print
-------------------------------------------------------
EMPTY, nregs=1024, nbits=4, expthresh=512, sparseon=0
(1 row)
DROP TABLE test_khvengxf;
|