From 6d7d03cc93b292a25eaa35094c32cd9de0481922 Mon Sep 17 00:00:00 2001 From: Burak Yucesoy Date: Wed, 6 Jun 2018 12:52:10 +0300 Subject: [PATCH] Restructure the codebase according to Citus and PGXS guidelines We still have a lot to do, but this PR accomplishes many things in terms of standardization and also helps our future development. With this PR; - We are starting to use pg_regress testing framework, which is more flexible and especially allows multiple output files (useful for supporting multiple PostgreSQL versions) - We are starting to use Citus' travis scripts, which allows to use test the extension against most recent versions of PostgreSQL without needing to wait travis to support it. - We are organizing the codebase into different folders to make top level directory less crowded. --- .gitignore | 13 +- .travis.yml | 37 +- CHANGELOG.markdown => CHANGELOG.md | 0 DEVELOPER.markdown => DEVELOPER.md | 0 Makefile | 39 +-- README.markdown => README.md | 0 REFERENCE.markdown => REFERENCE.md | 0 regress/add_agg.ref => expected/add_agg.out | 21 +- regress/agg_oob.ref => expected/agg_oob.out | 37 +- .../auto_sparse.out | 0 expected/card_op.out | 63 ++++ regress/card_op.ref => expected/card_op_0.out | 4 +- .../cast_shape.ref => expected/cast_shape.out | 32 +- .../copy_binary.out | 6 +- .../cumulative_add_cardinality_correction.out | 6 +- ...cumulative_add_comprehensive_promotion.out | 6 +- .../cumulative_add_sparse_edge.out | 6 +- .../cumulative_add_sparse_random.out | 6 +- .../cumulative_add_sparse_step.out | 6 +- .../cumulative_union_comprehensive.out | 6 +- .../cumulative_union_explicit_explicit.out | 6 +- .../cumulative_union_explicit_promotion.out | 6 +- ...tive_union_probabilistic_probabilistic.out | 6 +- ...ative_union_sparse_full_representation.out | 6 +- .../cumulative_union_sparse_promotion.out | 6 +- .../cumulative_union_sparse_sparse.out | 6 +- regress/equal.ref => expected/equal.out | 0 .../explicit_thresh.out | 0 regress/hash.ref => expected/hash.out | 22 +- expected/hash_0.out | 328 ++++++++++++++++++ regress/hash_any.ref => expected/hash_any.out | 0 .../meta_func.ref => expected/meta_func.out | 12 +- .../murmur_bigint.out | 6 +- .../murmur_bytea.out | 6 +- regress/nosparse.ref => expected/nosparse.out | 0 regress/notequal.ref => expected/notequal.out | 0 .../scalar_oob.ref => expected/scalar_oob.out | 22 +- expected/setup.out | 1 + .../storedproc.ref => expected/storedproc.out | 1 - .../transaction.out | 4 - expected/typmod.out | 190 ++++++++++ expected/typmod_0.out | 190 ++++++++++ regress/typmod.ref => expected/typmod_1.out | 50 +-- .../typmod_insert.out | 15 +- regress/union_op.ref => expected/union_op.out | 0 hll--2.10.sql => hll.sql | 0 MurmurHash3.h => include/MurmurHash3.h | 0 postgresql-hll.spec | 81 ----- regress/Makefile | 63 ---- {regress => sql}/add_agg.sql | 0 {regress => sql}/agg_oob.sql | 0 {regress => sql}/auto_sparse.sql | 0 {regress => sql}/card_op.sql | 0 {regress => sql}/cast_shape.sql | 0 {regress => sql}/copy_binary.sql | 0 .../cumulative_add_cardinality_correction.sql | 2 +- ...cumulative_add_comprehensive_promotion.sql | 2 +- .../cumulative_add_sparse_edge.sql | 2 +- .../cumulative_add_sparse_random.sql | 2 +- .../cumulative_add_sparse_step.sql | 2 +- .../cumulative_union_comprehensive.sql | 2 +- .../cumulative_union_explicit_explicit.sql | 2 +- .../cumulative_union_explicit_promotion.sql | 2 +- ...tive_union_probabilistic_probabilistic.sql | 2 +- ...ative_union_sparse_full_representation.sql | 2 +- .../cumulative_union_sparse_promotion.sql | 2 +- .../cumulative_union_sparse_sparse.sql | 2 +- {testdata => sql/data}/README.txt | 0 .../cumulative_add_cardinality_correction.csv | 0 ...cumulative_add_comprehensive_promotion.csv | 0 .../data}/cumulative_add_sparse_edge.csv | 0 .../data}/cumulative_add_sparse_random.csv | 0 .../data}/cumulative_add_sparse_step.csv | 0 .../data}/cumulative_union_comprehensive.csv | 0 .../cumulative_union_explicit_explicit.csv | 0 .../cumulative_union_explicit_promotion.csv | 0 ...tive_union_probabilistic_probabilistic.csv | 0 ...ative_union_sparse_full_representation.csv | 0 .../cumulative_union_sparse_promotion.csv | 0 .../data}/cumulative_union_sparse_sparse.csv | 0 {testdata => sql/data}/murmur_bigint.csv | 0 {testdata => sql/data}/murmur_bytea.csv | 0 {regress => sql}/equal.sql | 0 {regress => sql}/explicit_thresh.sql | 0 {regress => sql}/hash.sql | 0 {regress => sql}/hash_any.sql | 0 {regress => sql}/meta_func.sql | 0 {regress => sql}/murmur_bigint.sql | 2 +- {regress => sql}/murmur_bytea.sql | 2 +- {regress => sql}/nosparse.sql | 0 {regress => sql}/notequal.sql | 0 {regress => sql}/scalar_oob.sql | 0 sql/setup.sql | 1 + {regress => sql}/storedproc.sql | 0 {regress => sql}/transaction.sql | 0 {regress => sql}/typmod.sql | 0 {regress => sql}/typmod_insert.sql | 0 {regress => sql}/union_op.sql | 0 MurmurHash3.cpp => src/MurmurHash3.cpp | 0 hll.c => src/hll.c | 16 +- 100 files changed, 954 insertions(+), 406 deletions(-) rename CHANGELOG.markdown => CHANGELOG.md (100%) rename DEVELOPER.markdown => DEVELOPER.md (100%) rename README.markdown => README.md (100%) rename REFERENCE.markdown => REFERENCE.md (100%) rename regress/add_agg.ref => expected/add_agg.out (90%) rename regress/agg_oob.ref => expected/agg_oob.out (98%) rename regress/auto_sparse.ref => expected/auto_sparse.out (100%) create mode 100644 expected/card_op.out rename regress/card_op.ref => expected/card_op_0.out (98%) rename regress/cast_shape.ref => expected/cast_shape.out (95%) rename regress/copy_binary.ref => expected/copy_binary.out (93%) rename regress/cumulative_add_cardinality_correction.ref => expected/cumulative_add_cardinality_correction.out (93%) rename regress/cumulative_add_comprehensive_promotion.ref => expected/cumulative_add_comprehensive_promotion.out (94%) rename regress/cumulative_add_sparse_edge.ref => expected/cumulative_add_sparse_edge.out (93%) rename regress/cumulative_add_sparse_random.ref => expected/cumulative_add_sparse_random.out (93%) rename regress/cumulative_add_sparse_step.ref => expected/cumulative_add_sparse_step.out (93%) rename regress/cumulative_union_comprehensive.ref => expected/cumulative_union_comprehensive.out (99%) rename regress/cumulative_union_explicit_explicit.ref => expected/cumulative_union_explicit_explicit.out (95%) rename regress/cumulative_union_explicit_promotion.ref => expected/cumulative_union_explicit_promotion.out (95%) rename regress/cumulative_union_probabilistic_probabilistic.ref => expected/cumulative_union_probabilistic_probabilistic.out (95%) rename regress/cumulative_union_sparse_full_representation.ref => expected/cumulative_union_sparse_full_representation.out (95%) rename regress/cumulative_union_sparse_promotion.ref => expected/cumulative_union_sparse_promotion.out (95%) rename regress/cumulative_union_sparse_sparse.ref => expected/cumulative_union_sparse_sparse.out (95%) rename regress/equal.ref => expected/equal.out (100%) rename regress/explicit_thresh.ref => expected/explicit_thresh.out (100%) rename regress/hash.ref => expected/hash.out (90%) create mode 100644 expected/hash_0.out rename regress/hash_any.ref => expected/hash_any.out (100%) rename regress/meta_func.ref => expected/meta_func.out (98%) rename regress/murmur_bigint.ref => expected/murmur_bigint.out (83%) rename regress/murmur_bytea.ref => expected/murmur_bytea.out (83%) rename regress/nosparse.ref => expected/nosparse.out (100%) rename regress/notequal.ref => expected/notequal.out (100%) rename regress/scalar_oob.ref => expected/scalar_oob.out (97%) create mode 100644 expected/setup.out rename regress/storedproc.ref => expected/storedproc.out (98%) rename regress/transaction.ref => expected/transaction.out (98%) create mode 100644 expected/typmod.out create mode 100644 expected/typmod_0.out rename regress/typmod.ref => expected/typmod_1.out (86%) rename regress/typmod_insert.ref => expected/typmod_insert.out (88%) rename regress/union_op.ref => expected/union_op.out (100%) rename hll--2.10.sql => hll.sql (100%) rename MurmurHash3.h => include/MurmurHash3.h (100%) delete mode 100644 postgresql-hll.spec delete mode 100644 regress/Makefile rename {regress => sql}/add_agg.sql (100%) rename {regress => sql}/agg_oob.sql (100%) rename {regress => sql}/auto_sparse.sql (100%) rename {regress => sql}/card_op.sql (100%) rename {regress => sql}/cast_shape.sql (100%) rename {regress => sql}/copy_binary.sql (100%) rename {regress => sql}/cumulative_add_cardinality_correction.sql (95%) rename {regress => sql}/cumulative_add_comprehensive_promotion.sql (94%) rename {regress => sql}/cumulative_add_sparse_edge.sql (95%) rename {regress => sql}/cumulative_add_sparse_random.sql (95%) rename {regress => sql}/cumulative_add_sparse_step.sql (95%) rename {regress => sql}/cumulative_union_comprehensive.sql (96%) rename {regress => sql}/cumulative_union_explicit_explicit.sql (96%) rename {regress => sql}/cumulative_union_explicit_promotion.sql (96%) rename {regress => sql}/cumulative_union_probabilistic_probabilistic.sql (95%) rename {regress => sql}/cumulative_union_sparse_full_representation.sql (96%) rename {regress => sql}/cumulative_union_sparse_promotion.sql (96%) rename {regress => sql}/cumulative_union_sparse_sparse.sql (96%) rename {testdata => sql/data}/README.txt (100%) rename {testdata => sql/data}/cumulative_add_cardinality_correction.csv (100%) rename {testdata => sql/data}/cumulative_add_comprehensive_promotion.csv (100%) rename {testdata => sql/data}/cumulative_add_sparse_edge.csv (100%) rename {testdata => sql/data}/cumulative_add_sparse_random.csv (100%) rename {testdata => sql/data}/cumulative_add_sparse_step.csv (100%) rename {testdata => sql/data}/cumulative_union_comprehensive.csv (100%) rename {testdata => sql/data}/cumulative_union_explicit_explicit.csv (100%) rename {testdata => sql/data}/cumulative_union_explicit_promotion.csv (100%) rename {testdata => sql/data}/cumulative_union_probabilistic_probabilistic.csv (100%) rename {testdata => sql/data}/cumulative_union_sparse_full_representation.csv (100%) rename {testdata => sql/data}/cumulative_union_sparse_promotion.csv (100%) rename {testdata => sql/data}/cumulative_union_sparse_sparse.csv (100%) rename {testdata => sql/data}/murmur_bigint.csv (100%) rename {testdata => sql/data}/murmur_bytea.csv (100%) rename {regress => sql}/equal.sql (100%) rename {regress => sql}/explicit_thresh.sql (100%) rename {regress => sql}/hash.sql (100%) rename {regress => sql}/hash_any.sql (100%) rename {regress => sql}/meta_func.sql (100%) rename {regress => sql}/murmur_bigint.sql (85%) rename {regress => sql}/murmur_bytea.sql (85%) rename {regress => sql}/nosparse.sql (100%) rename {regress => sql}/notequal.sql (100%) rename {regress => sql}/scalar_oob.sql (100%) create mode 100644 sql/setup.sql rename {regress => sql}/storedproc.sql (100%) rename {regress => sql}/transaction.sql (100%) rename {regress => sql}/typmod.sql (100%) rename {regress => sql}/typmod_insert.sql (100%) rename {regress => sql}/union_op.sql (100%) rename MurmurHash3.cpp => src/MurmurHash3.cpp (100%) rename hll.c => src/hll.c (99%) diff --git a/.gitignore b/.gitignore index 7661e2e..af553bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ -.gitignore *.o *.so -*.out -*.diff -regress/binary.dat -regress/failures +binary.dat +regression.out +regression.diffs +results + +hll--?.?.sql +hll--?.?-*.sql +!hll--?.?-*--?.?-*.sql diff --git a/.travis.yml b/.travis.yml index 5d9c2d6..41bbd2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,24 @@ sudo: required dist: trusty language: c -env: - - PGVERSION=9.2 - - PGVERSION=9.3 - - PGVERSION=9.4 - - PGVERSION=9.5 - - PGVERSION=9.6 +matrix: + fast_finish: true + include: + - env: PGVERSION=9.4 + - env: PGVERSION=9.5 + - env: PGVERSION=9.6 + - env: PGVERSION=10 + - env: PGVERSION=11 + allow_failures: + - env: PGVERSION=11 +before_install: + - git clone -b v0.7.5 --depth 1 https://github.com/citusdata/tools.git + - sudo make -C tools install + - setup_apt + - nuke_pg +install: + - install_uncrustify + - install_pg before_script: - - export PATH=/usr/lib/postgresql/$PGVERSION/bin:$PATH # Add our chosen PG version to the path - - sudo /etc/init.d/postgresql stop # Stop whichever version of PG that travis started - - sudo /etc/init.d/postgresql start $PGVERSION # Start the version of PG that we want to test - - sudo apt-get update -qq # Retrieves new list of packages - - sudo apt-get install postgresql-server-dev-$PGVERSION # Required for PGXS - - sudo apt-get install postgresql-common # Required for extension support files - - createdb hll_regress # Create the test database -script: - - make && sudo make install - - psql -c "create extension hll" hll_regress - - make -C regress + - config_and_start_cluster +script: pg_travis_test diff --git a/CHANGELOG.markdown b/CHANGELOG.md similarity index 100% rename from CHANGELOG.markdown rename to CHANGELOG.md diff --git a/DEVELOPER.markdown b/DEVELOPER.md similarity index 100% rename from DEVELOPER.markdown rename to DEVELOPER.md diff --git a/Makefile b/Makefile index dff24d3..00a2b58 100644 --- a/Makefile +++ b/Makefile @@ -11,35 +11,26 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -MODULE_big = hll -OBJS = \ - hll.o \ - MurmurHash3.o \ - $(NULL) - EXTENSION = hll -DATA = \ - hll--2.10.sql \ - $(NULL) - -EXTRA_CLEAN += -r $(RPM_BUILD_ROOT) +EXTVERSION = 2.10 -PG_CPPFLAGS += -fPIC -hll.o: override CFLAGS += -std=c99 -MurmurHash3.o: override CC = $(CXX) +DATA_built = $(EXTENSION)--$(EXTVERSION).sql +DATA = $(wildcard $(EXTENSION)--*--*.sql) -ifdef DEBUG -COPT += -O0 -CXXFLAGS += -g -O0 -endif +MODULE_big = $(EXTENSION) +OBJS = src/hll.o \ + src/MurmurHash3.o -SHLIB_LINK += -lstdc++ +PG_CPPFLAGS = -fPIC -Wall -Wextra -Werror -Wno-unused-parameter -Wno-implicit-fallthrough -Iinclude -I$(libpq_srcdir) -ifndef PG_CONFIG -PG_CONFIG = pg_config -endif +REGRESS = setup $(filter-out setup,$(patsubst sql/%.sql,%,$(sort $(wildcard sql/*.sql)))) -PGXS := $(shell $(PG_CONFIG) --pgxs) +PG_CONFIG ?= pg_config +PGXS = $(shell $(PG_CONFIG) --pgxs) include $(PGXS) +src/hll.o: override CFLAGS += -std=c99 + +$(EXTENSION)--2.10.sql: $(EXTENSION).sql + cat $^ > $@ + diff --git a/README.markdown b/README.md similarity index 100% rename from README.markdown rename to README.md diff --git a/REFERENCE.markdown b/REFERENCE.md similarity index 100% rename from REFERENCE.markdown rename to REFERENCE.md diff --git a/regress/add_agg.ref b/expected/add_agg.out similarity index 90% rename from regress/add_agg.ref rename to expected/add_agg.out index 263006d..2bb4601 100644 --- a/regress/add_agg.ref +++ b/expected/add_agg.out @@ -8,13 +8,11 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_khvengxf; -DROP TABLE +NOTICE: table "test_khvengxf" does not exist, skipping CREATE TABLE test_khvengxf ( val integer ); -CREATE TABLE insert into test_khvengxf(val) values (1), (2), (3); -INSERT 0 3 -- Check default and explicit signatures. select hll_print(hll_add_agg(hll_hash_integer(val))) from test_khvengxf; @@ -79,28 +77,28 @@ select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 512, 0)) -- Check range checking. select hll_print(hll_add_agg(hll_hash_integer(val), -1)) from test_khvengxf; -psql:add_agg.sql:38: ERROR: log2m modifier must be between 0 and 31 +ERROR: log2m modifier must be between 0 and 31 select hll_print(hll_add_agg(hll_hash_integer(val), 32)) from test_khvengxf; -psql:add_agg.sql:41: ERROR: log2m modifier must be between 0 and 31 +ERROR: log2m modifier must be between 0 and 31 select hll_print(hll_add_agg(hll_hash_integer(val), 10, -1)) from test_khvengxf; -psql:add_agg.sql:44: ERROR: regwidth modifier must be between 0 and 7 +ERROR: regwidth modifier must be between 0 and 7 select hll_print(hll_add_agg(hll_hash_integer(val), 10, 8)) from test_khvengxf; -psql:add_agg.sql:47: ERROR: regwidth modifier must be between 0 and 7 +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; -psql:add_agg.sql:50: ERROR: expthresh modifier must be between -1 and 2^32 +ERROR: expthresh modifier must be between -1 and 2^32 select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 8589934592)) from test_khvengxf; -psql:add_agg.sql:53: ERROR: expthresh modifier must be between -1 and 2^32 +ERROR: expthresh modifier must be between -1 and 2^32 select hll_print(hll_add_agg(hll_hash_integer(val), 10, 4, 512, -1)) from test_khvengxf; -psql:add_agg.sql:56: ERROR: sparseon modifier must be 0 or 1 +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; -psql:add_agg.sql:59: ERROR: sparseon modifier must be 0 or 1 +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 @@ -139,4 +137,3 @@ select hll_print(hll_add_agg(NULL, 10, 4, 512, 0)); (1 row) DROP TABLE test_khvengxf; -DROP TABLE diff --git a/regress/agg_oob.ref b/expected/agg_oob.out similarity index 98% rename from regress/agg_oob.ref rename to expected/agg_oob.out index d11b697..72c0fae 100644 --- a/regress/agg_oob.ref +++ b/expected/agg_oob.out @@ -10,12 +10,11 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_wdflbzfx; -DROP TABLE +NOTICE: table "test_wdflbzfx" does not exist, skipping CREATE TABLE test_wdflbzfx ( recno SERIAL, v1 hll ); -CREATE TABLE INSERT INTO test_wdflbzfx (recno, v1) VALUES -- NULL -- (0, NULL), @@ -42,7 +41,6 @@ INSERT INTO test_wdflbzfx (recno, v1) VALUES (17, E'\\x138b7f0022'), (18, E'\\x138b7f0041'), (19, E'\\x138b7f0061'); -INSERT 0 20 -- ---------------------------------------------------------------- -- Aggregate Union -- ---------------------------------------------------------------- @@ -50,14 +48,14 @@ INSERT 0 20 SELECT hll_union_agg(v1) FROM test_wdflbzfx WHERE recno > 100; hll_union_agg --------------- - NULL + (1 row) -- NULLs SELECT hll_union_agg(v1) FROM test_wdflbzfx WHERE recno IN (0, 1, 2, 3); hll_union_agg --------------- - NULL + (1 row) -- UNDEFINED @@ -253,7 +251,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) FROM test_wdflbzfx WHERE recno > 100; ceiling --------- - NULL + (1 row) -- NULLs @@ -261,7 +259,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) FROM test_wdflbzfx WHERE recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) -- UNDEFINED @@ -269,7 +267,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) FROM test_wdflbzfx WHERE recno IN (4, 5, 6, 7); ceiling --------- - NULL + (1 row) -- UNDEFINED and NULL @@ -278,7 +276,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) -- EMPTY @@ -304,7 +302,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (4, 5, 6, 7); ceiling --------- - NULL + (1 row) -- EMPTY, UNDEFINED and NULL @@ -314,7 +312,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) -- EXPLICIT @@ -340,7 +338,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (4, 5, 6, 7); ceiling --------- - NULL + (1 row) -- EXPLICIT, UNDEFINED and NULL @@ -350,7 +348,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) -- EXPLICIT and EMPTY @@ -379,7 +377,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (4, 5, 6, 7); ceiling --------- - NULL + (1 row) -- EXPLICIT, EMPTY, UNDEFINED and NULL @@ -390,7 +388,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) -- Don't feel like a full sparse/explicit permuatation is adding @@ -418,7 +416,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (4, 5, 6, 7); ceiling --------- - NULL + (1 row) -- SPARSE, UNDEFINED and NULL @@ -428,7 +426,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) -- SPARSE and EMPTY @@ -457,7 +455,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (4, 5, 6, 7); ceiling --------- - NULL + (1 row) -- SPARSE, EMPTY, UNDEFINED and NULL @@ -468,8 +466,7 @@ SELECT ceiling(hll_cardinality(hll_union_agg(v1))) OR recno IN (0, 1, 2, 3); ceiling --------- - NULL + (1 row) DROP TABLE IF EXISTS test_wdflbzfx; -DROP TABLE diff --git a/regress/auto_sparse.ref b/expected/auto_sparse.out similarity index 100% rename from regress/auto_sparse.ref rename to expected/auto_sparse.out diff --git a/expected/card_op.out b/expected/card_op.out new file mode 100644 index 0000000..f642df4 --- /dev/null +++ b/expected/card_op.out @@ -0,0 +1,63 @@ +-- ---------------------------------------------------------------- +-- Regression tests for cardinality operator. +-- ---------------------------------------------------------------- +SELECT hll_set_output_version(1); + hll_set_output_version +------------------------ + 1 +(1 row) + +SELECT #E'\\x108b49'::hll; + ?column? +---------- + +(1 row) + +SELECT #hll_empty(11,5,256,1); + ?column? +---------- + 0 +(1 row) + +-- # gets evaluated first so || hll_union(double, bigint) fails +SELECT #hll_empty(11,5,256,1) || hll_hash_integer(1,0); +ERROR: operator does not exist: double precision || hll_hashval +LINE 1: SELECT #hll_empty(11,5,256,1) || hll_hash_integer(1,0); + ^ +HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +SELECT #(hll_empty(11,5,256,1) || hll_hash_integer(1,0)); + ?column? +---------- + 1 +(1 row) + +SELECT #E'\\x128b498895a3f5af28cafe'::hll; + ?column? +---------- + 1 +(1 row) + +SELECT #E'\\x128b498895a3f5af28cafeda0ce907e4355b60'::hll; + ?column? +---------- + 2 +(1 row) + +SELECT #E'\\x138b4f0061'::hll; + ?column? +------------------ + 1.00024422012692 +(1 row) + +SELECT #E'\\x148B480800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'::hll; + ?column? +------------------ + 1.00024422012692 +(1 row) + +SELECT #E'\\x148B480842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084210842108421084200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'::hll; + ?column? +------------------ + 545.638878057197 +(1 row) + diff --git a/regress/card_op.ref b/expected/card_op_0.out similarity index 98% rename from regress/card_op.ref rename to expected/card_op_0.out index 89c413a..295423c 100644 --- a/regress/card_op.ref +++ b/expected/card_op_0.out @@ -10,7 +10,7 @@ SELECT hll_set_output_version(1); SELECT #E'\\x108b49'::hll; ?column? ---------- - NULL + (1 row) SELECT #hll_empty(11,5,256,1); @@ -21,7 +21,7 @@ SELECT #hll_empty(11,5,256,1); -- # gets evaluated first so || hll_union(double, bigint) fails SELECT #hll_empty(11,5,256,1) || hll_hash_integer(1,0); -psql:card_op.sql:12: ERROR: operator does not exist: double precision || hll_hashval +ERROR: operator does not exist: double precision || hll_hashval LINE 1: SELECT #hll_empty(11,5,256,1) || hll_hash_integer(1,0); ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. diff --git a/regress/cast_shape.ref b/expected/cast_shape.out similarity index 95% rename from regress/cast_shape.ref rename to expected/cast_shape.out index cf9dc6d..ba92a0a 100644 --- a/regress/cast_shape.ref +++ b/expected/cast_shape.out @@ -22,16 +22,16 @@ SELECT E'\\x118b7f'::hll(11,5,-1,1); -- ERROR: register count does not match: source uses 2048 and dest uses 1024 SELECT E'\\x118b7f'::hll(10,5,-1,1); -psql:cast_shape.sql:14: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register width does not match: source uses 5 and dest uses 4 SELECT E'\\x118b7f'::hll(11,4,-1,1); -psql:cast_shape.sql:17: ERROR: register width does not match: source uses 5 and dest uses 4 +ERROR: register width does not match: source uses 5 and dest uses 4 -- ERROR: explicit threshold does not match: source uses -1 and dest uses 64 SELECT E'\\x118b7f'::hll(11,5,64,1); -psql:cast_shape.sql:20: ERROR: explicit threshold does not match: source uses -1 and dest uses 64 +ERROR: explicit threshold does not match: source uses -1 and dest uses 64 -- ERROR: sparse enable does not match: source uses 1 and dest uses 0 SELECT E'\\x118b7f'::hll(11,5,-1,0); -psql:cast_shape.sql:23: ERROR: sparse enable does not match: source uses 1 and dest uses 0 +ERROR: sparse enable does not match: source uses 1 and dest uses 0 -- Explicit Vector Casts ---- SELECT E'\\x128b7f1111111111111111'::hll; hll @@ -47,16 +47,16 @@ SELECT E'\\x128b7f1111111111111111'::hll(11,5,-1,1); -- ERROR: register count does not match: source uses 2048 and dest uses 1024 SELECT E'\\x128b7f1111111111111111'::hll(10,5,-1,1); -psql:cast_shape.sql:32: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register width does not match: source uses 5 and dest uses 4 SELECT E'\\x128b7f1111111111111111'::hll(11,4,-1,1); -psql:cast_shape.sql:35: ERROR: register width does not match: source uses 5 and dest uses 4 +ERROR: register width does not match: source uses 5 and dest uses 4 -- ERROR: explicit threshold does not match: source uses -1 and dest uses 64 SELECT E'\\x128b7f1111111111111111'::hll(11,5,64,1); -psql:cast_shape.sql:38: ERROR: explicit threshold does not match: source uses -1 and dest uses 64 +ERROR: explicit threshold does not match: source uses -1 and dest uses 64 -- ERROR: sparse enable does not match: source uses 1 and dest uses 0 SELECT E'\\x128b7f1111111111111111'::hll(11,5,-1,0); -psql:cast_shape.sql:41: ERROR: sparse enable does not match: source uses 1 and dest uses 0 +ERROR: sparse enable does not match: source uses 1 and dest uses 0 -- Sparse Vector Casts ---- SELECT E'\\x138b7f0001'::hll; hll @@ -72,16 +72,16 @@ SELECT E'\\x138b7f0001'::hll(11,5,-1,1); -- ERROR: register count does not match: source uses 2048 and dest uses 1024 SELECT E'\\x138b7f0001'::hll(10,5,-1,1); -psql:cast_shape.sql:50: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register width does not match: source uses 5 and dest uses 4 SELECT E'\\x138b7f0001'::hll(11,4,-1,1); -psql:cast_shape.sql:53: ERROR: register width does not match: source uses 5 and dest uses 4 +ERROR: register width does not match: source uses 5 and dest uses 4 -- ERROR: explicit threshold does not match: source uses -1 and dest uses 64 SELECT E'\\x138b7f0001'::hll(11,5,64,1); -psql:cast_shape.sql:56: ERROR: explicit threshold does not match: source uses -1 and dest uses 64 +ERROR: explicit threshold does not match: source uses -1 and dest uses 64 -- ERROR: sparse enable does not match: source uses 1 and dest uses 0 SELECT E'\\x138b7f0001'::hll(11,5,-1,0); -psql:cast_shape.sql:59: ERROR: sparse enable does not match: source uses 1 and dest uses 0 +ERROR: sparse enable does not match: source uses 1 and dest uses 0 -- Compressed Vector Casts ---- SELECT E'\\x148b7f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000'::hll; hll @@ -97,13 +97,13 @@ SELECT E'\\x148b7f00000000000000000000000000000000000000000000000000000000000000 -- ERROR: register count does not match: source uses 2048 and dest uses 1024 SELECT E'\\x148b7f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000'::hll(10,5,-1,1); -psql:cast_shape.sql:67: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register width does not match: source uses 5 and dest uses 4 SELECT E'\\x148b7f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000'::hll(11,4,-1,1); -psql:cast_shape.sql:70: ERROR: register width does not match: source uses 5 and dest uses 4 +ERROR: register width does not match: source uses 5 and dest uses 4 -- ERROR: explicit threshold does not match: source uses -1 and dest uses 64 SELECT E'\\x148b7f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000'::hll(11,5,64,1); -psql:cast_shape.sql:73: ERROR: explicit threshold does not match: source uses -1 and dest uses 64 +ERROR: explicit threshold does not match: source uses -1 and dest uses 64 -- ERROR: sparse enable does not match: source uses 1 and dest uses 0 SELECT E'\\x148b7f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000'::hll(11,5,-1,0); -psql:cast_shape.sql:76: ERROR: sparse enable does not match: source uses 1 and dest uses 0 +ERROR: sparse enable does not match: source uses 1 and dest uses 0 diff --git a/regress/copy_binary.ref b/expected/copy_binary.out similarity index 93% rename from regress/copy_binary.ref rename to expected/copy_binary.out index 85fc3b4..6a70bfc 100644 --- a/regress/copy_binary.ref +++ b/expected/copy_binary.out @@ -5,11 +5,9 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_binary; -DROP TABLE +NOTICE: table "test_binary" does not exist, skipping CREATE TABLE test_binary (id SERIAL, v1 hll); -CREATE TABLE INSERT INTO test_binary(id,v1) VALUES (1, hll_empty() || hll_hash_text('A')); -INSERT 0 1 SELECT hll_cardinality(v1) FROM test_binary; hll_cardinality ----------------- @@ -18,7 +16,6 @@ SELECT hll_cardinality(v1) FROM test_binary; \COPY test_binary TO 'binary.dat' WITH (FORMAT "binary") DELETE FROM test_binary; -DELETE 1 SELECT hll_cardinality(v1) FROM test_binary; hll_cardinality ----------------- @@ -32,4 +29,3 @@ SELECT hll_cardinality(v1) FROM test_binary; (1 row) DROP TABLE test_binary; -DROP TABLE diff --git a/regress/cumulative_add_cardinality_correction.ref b/expected/cumulative_add_cardinality_correction.out similarity index 93% rename from regress/cumulative_add_cardinality_correction.ref rename to expected/cumulative_add_cardinality_correction.out index 7aabed9..3f8a9c5 100644 --- a/regress/cumulative_add_cardinality_correction.ref +++ b/expected/cumulative_add_cardinality_correction.out @@ -17,17 +17,16 @@ SELECT hll_set_max_sparse(0); (1 row) DROP TABLE IF EXISTS test_msgfjqhm; -DROP TABLE +NOTICE: table "test_msgfjqhm" does not exist, skipping CREATE TABLE test_msgfjqhm ( recno SERIAL, cardinality double precision, raw_value bigint, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_msgfjqhm (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_msgfjqhm (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_cardinality_correction.csv with csv header SELECT COUNT(*) FROM test_msgfjqhm; count ------- @@ -66,4 +65,3 @@ SELECT curr.recno, (1 row) DROP TABLE test_msgfjqhm; -DROP TABLE diff --git a/regress/cumulative_add_comprehensive_promotion.ref b/expected/cumulative_add_comprehensive_promotion.out similarity index 94% rename from regress/cumulative_add_comprehensive_promotion.ref rename to expected/cumulative_add_comprehensive_promotion.out index bf65811..ceb6c4e 100644 --- a/regress/cumulative_add_comprehensive_promotion.ref +++ b/expected/cumulative_add_comprehensive_promotion.out @@ -17,17 +17,16 @@ SELECT hll_set_max_sparse(512); (1 row) DROP TABLE IF EXISTS test_ptwysrqk; -DROP TABLE +NOTICE: table "test_ptwysrqk" does not exist, skipping CREATE TABLE test_ptwysrqk ( recno SERIAL, cardinality double precision, raw_value bigint, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_ptwysrqk (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_ptwysrqk (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_comprehensive_promotion.csv with csv header SELECT COUNT(*) FROM test_ptwysrqk; count ------- @@ -80,4 +79,3 @@ SELECT curr.recno, (15 rows) DROP TABLE test_ptwysrqk; -DROP TABLE diff --git a/regress/cumulative_add_sparse_edge.ref b/expected/cumulative_add_sparse_edge.out similarity index 93% rename from regress/cumulative_add_sparse_edge.ref rename to expected/cumulative_add_sparse_edge.out index b290f44..014aad5 100644 --- a/regress/cumulative_add_sparse_edge.ref +++ b/expected/cumulative_add_sparse_edge.out @@ -17,17 +17,16 @@ SELECT hll_set_max_sparse(512); (1 row) DROP TABLE IF EXISTS test_eopzdzwz; -DROP TABLE +NOTICE: table "test_eopzdzwz" does not exist, skipping CREATE TABLE test_eopzdzwz ( recno SERIAL, cardinality double precision, raw_value bigint, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_eopzdzwz (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_eopzdzwz (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_sparse_edge.csv with csv header SELECT COUNT(*) FROM test_eopzdzwz; count ------- @@ -65,4 +64,3 @@ SELECT curr.recno, (0 rows) DROP TABLE test_eopzdzwz; -DROP TABLE diff --git a/regress/cumulative_add_sparse_random.ref b/expected/cumulative_add_sparse_random.out similarity index 93% rename from regress/cumulative_add_sparse_random.ref rename to expected/cumulative_add_sparse_random.out index 48060cc..ef4b5ec 100644 --- a/regress/cumulative_add_sparse_random.ref +++ b/expected/cumulative_add_sparse_random.out @@ -8,17 +8,16 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_beelewuo; -DROP TABLE +NOTICE: table "test_beelewuo" does not exist, skipping CREATE TABLE test_beelewuo ( recno SERIAL, cardinality double precision, raw_value bigint, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_beelewuo (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_beelewuo (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_sparse_random.csv with csv header SELECT COUNT(*) FROM test_beelewuo; count ------- @@ -56,4 +55,3 @@ SELECT curr.recno, (0 rows) DROP TABLE test_beelewuo; -DROP TABLE diff --git a/regress/cumulative_add_sparse_step.ref b/expected/cumulative_add_sparse_step.out similarity index 93% rename from regress/cumulative_add_sparse_step.ref rename to expected/cumulative_add_sparse_step.out index a77d188..14cd3cd 100644 --- a/regress/cumulative_add_sparse_step.ref +++ b/expected/cumulative_add_sparse_step.out @@ -8,17 +8,16 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_lunfjncl; -DROP TABLE +NOTICE: table "test_lunfjncl" does not exist, skipping CREATE TABLE test_lunfjncl ( recno SERIAL, cardinality double precision, raw_value bigint, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_lunfjncl (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_lunfjncl (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_sparse_step.csv with csv header SELECT COUNT(*) FROM test_lunfjncl; count ------- @@ -56,4 +55,3 @@ SELECT curr.recno, (0 rows) DROP TABLE test_lunfjncl; -DROP TABLE diff --git a/regress/cumulative_union_comprehensive.ref b/expected/cumulative_union_comprehensive.out similarity index 99% rename from regress/cumulative_union_comprehensive.ref rename to expected/cumulative_union_comprehensive.out index 67938ab..3d585cc 100644 --- a/regress/cumulative_union_comprehensive.ref +++ b/expected/cumulative_union_comprehensive.out @@ -7,7 +7,7 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_rhswkjtc; -DROP TABLE +NOTICE: table "test_rhswkjtc" does not exist, skipping CREATE TABLE test_rhswkjtc ( recno SERIAL, cardinality double precision, @@ -15,10 +15,9 @@ CREATE TABLE test_rhswkjtc ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_rhswkjtc (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_rhswkjtc (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_comprehensive.csv with csv header SELECT COUNT(*) FROM test_rhswkjtc; count ------- @@ -1121,4 +1120,3 @@ window prev30 as (order by recno asc rows 29 preceding); (1001 rows) DROP TABLE test_rhswkjtc; -DROP TABLE diff --git a/regress/cumulative_union_explicit_explicit.ref b/expected/cumulative_union_explicit_explicit.out similarity index 95% rename from regress/cumulative_union_explicit_explicit.ref rename to expected/cumulative_union_explicit_explicit.out index f9d7495..a934752 100644 --- a/regress/cumulative_union_explicit_explicit.ref +++ b/expected/cumulative_union_explicit_explicit.out @@ -7,7 +7,7 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_swlnhisq; -DROP TABLE +NOTICE: table "test_swlnhisq" does not exist, skipping CREATE TABLE test_swlnhisq ( recno SERIAL, cardinality double precision, @@ -15,10 +15,9 @@ CREATE TABLE test_swlnhisq ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_swlnhisq (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_swlnhisq (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_explicit_explicit.csv with csv header SELECT COUNT(*) FROM test_swlnhisq; count ------- @@ -110,4 +109,3 @@ SELECT v1.recno, (0 rows) DROP TABLE test_swlnhisq; -DROP TABLE diff --git a/regress/cumulative_union_explicit_promotion.ref b/expected/cumulative_union_explicit_promotion.out similarity index 95% rename from regress/cumulative_union_explicit_promotion.ref rename to expected/cumulative_union_explicit_promotion.out index a84f6c1..6cf0862 100644 --- a/regress/cumulative_union_explicit_promotion.ref +++ b/expected/cumulative_union_explicit_promotion.out @@ -16,7 +16,7 @@ SELECT hll_set_max_sparse(512); (1 row) DROP TABLE IF EXISTS test_wsdiietv; -DROP TABLE +NOTICE: table "test_wsdiietv" does not exist, skipping CREATE TABLE test_wsdiietv ( recno SERIAL, cardinality double precision, @@ -24,10 +24,9 @@ CREATE TABLE test_wsdiietv ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_wsdiietv (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_wsdiietv (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_explicit_promotion.csv with csv header SELECT COUNT(*) FROM test_wsdiietv; count ------- @@ -119,4 +118,3 @@ SELECT v1.recno, (0 rows) DROP TABLE test_wsdiietv; -DROP TABLE diff --git a/regress/cumulative_union_probabilistic_probabilistic.ref b/expected/cumulative_union_probabilistic_probabilistic.out similarity index 95% rename from regress/cumulative_union_probabilistic_probabilistic.ref rename to expected/cumulative_union_probabilistic_probabilistic.out index 17bd7ef..638f05a 100644 --- a/regress/cumulative_union_probabilistic_probabilistic.ref +++ b/expected/cumulative_union_probabilistic_probabilistic.out @@ -7,7 +7,7 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_mpuahgwy; -DROP TABLE +NOTICE: table "test_mpuahgwy" does not exist, skipping CREATE TABLE test_mpuahgwy ( recno SERIAL, cardinality double precision, @@ -15,10 +15,9 @@ CREATE TABLE test_mpuahgwy ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_mpuahgwy (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_mpuahgwy (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_probabilistic_probabilistic.csv with csv header SELECT COUNT(*) FROM test_mpuahgwy; count ------- @@ -113,4 +112,3 @@ SELECT v1.recno, (0 rows) DROP TABLE test_mpuahgwy; -DROP TABLE diff --git a/regress/cumulative_union_sparse_full_representation.ref b/expected/cumulative_union_sparse_full_representation.out similarity index 95% rename from regress/cumulative_union_sparse_full_representation.ref rename to expected/cumulative_union_sparse_full_representation.out index 5d2331e..d59739c 100644 --- a/regress/cumulative_union_sparse_full_representation.ref +++ b/expected/cumulative_union_sparse_full_representation.out @@ -16,7 +16,7 @@ SELECT hll_set_max_sparse(512); (1 row) DROP TABLE IF EXISTS test_tagumlbl; -DROP TABLE +NOTICE: table "test_tagumlbl" does not exist, skipping CREATE TABLE test_tagumlbl ( recno SERIAL, cardinality double precision, @@ -24,10 +24,9 @@ CREATE TABLE test_tagumlbl ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_tagumlbl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_tagumlbl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_sparse_full_representation.csv with csv header SELECT COUNT(*) FROM test_tagumlbl; count ------- @@ -119,4 +118,3 @@ SELECT v1.recno, (0 rows) DROP TABLE test_tagumlbl; -DROP TABLE diff --git a/regress/cumulative_union_sparse_promotion.ref b/expected/cumulative_union_sparse_promotion.out similarity index 95% rename from regress/cumulative_union_sparse_promotion.ref rename to expected/cumulative_union_sparse_promotion.out index de92697..c2cc06e 100644 --- a/regress/cumulative_union_sparse_promotion.ref +++ b/expected/cumulative_union_sparse_promotion.out @@ -16,7 +16,7 @@ SELECT hll_set_max_sparse(512); (1 row) DROP TABLE IF EXISTS test_bsnvqefe; -DROP TABLE +NOTICE: table "test_bsnvqefe" does not exist, skipping CREATE TABLE test_bsnvqefe ( recno SERIAL, cardinality double precision, @@ -24,10 +24,9 @@ CREATE TABLE test_bsnvqefe ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_bsnvqefe (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_bsnvqefe (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_sparse_promotion.csv with csv header SELECT COUNT(*) FROM test_bsnvqefe; count ------- @@ -119,4 +118,3 @@ SELECT v1.recno, (0 rows) DROP TABLE test_bsnvqefe; -DROP TABLE diff --git a/regress/cumulative_union_sparse_sparse.ref b/expected/cumulative_union_sparse_sparse.out similarity index 95% rename from regress/cumulative_union_sparse_sparse.ref rename to expected/cumulative_union_sparse_sparse.out index b8022a9..0c72eb2 100644 --- a/regress/cumulative_union_sparse_sparse.ref +++ b/expected/cumulative_union_sparse_sparse.out @@ -7,7 +7,7 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_bmbffonl; -DROP TABLE +NOTICE: table "test_bmbffonl" does not exist, skipping CREATE TABLE test_bmbffonl ( recno SERIAL, cardinality double precision, @@ -15,10 +15,9 @@ CREATE TABLE test_bmbffonl ( union_cardinality double precision, union_compressed_multiset hll ); -CREATE TABLE -- Copy the CSV data into the table -- -\copy test_bmbffonl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_bmbffonl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_sparse_sparse.csv with csv header SELECT COUNT(*) FROM test_bmbffonl; count ------- @@ -110,4 +109,3 @@ SELECT v1.recno, (0 rows) DROP TABLE test_bmbffonl; -DROP TABLE diff --git a/regress/equal.ref b/expected/equal.out similarity index 100% rename from regress/equal.ref rename to expected/equal.out diff --git a/regress/explicit_thresh.ref b/expected/explicit_thresh.out similarity index 100% rename from regress/explicit_thresh.ref rename to expected/explicit_thresh.out diff --git a/regress/hash.ref b/expected/hash.out similarity index 90% rename from regress/hash.ref rename to expected/hash.out index a58d2f0..3201ad1 100644 --- a/regress/hash.ref +++ b/expected/hash.out @@ -153,7 +153,7 @@ SELECT hll_hash_bigint(0, 2147483647); -- WARNING: negative seed values not compatible SELECT hll_hash_bigint(0, -1); -psql:hash.sql:58: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_bigint ---------------------- -8352849679461500862 @@ -161,7 +161,7 @@ psql:hash.sql:58: WARNING: negative seed values not compatible -- WARNING: negative seed values not compatible SELECT hll_hash_bigint(0, -2); -psql:hash.sql:61: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_bigint ---------------------- -8080898605520838299 @@ -169,7 +169,7 @@ psql:hash.sql:61: WARNING: negative seed values not compatible -- WARNING: negative seed values not compatible SELECT hll_hash_bigint(0, -2147483648); -psql:hash.sql:64: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_bigint --------------------- 8620050269462747046 @@ -177,40 +177,40 @@ psql:hash.sql:64: WARNING: negative seed values not compatible -- WARNING: negative seed values not compatible SELECT hll_hash_boolean(0, -1); -psql:hash.sql:67: ERROR: function hll_hash_boolean(integer, integer) does not exist +ERROR: function hll_hash_boolean(integer, integer) does not exist LINE 1: SELECT hll_hash_boolean(0, -1); ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. SELECT hll_hash_smallint(0::smallint, -1); -psql:hash.sql:68: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_smallint --------------------- 1411828310742905942 (1 row) SELECT hll_hash_integer(0, -1); -psql:hash.sql:69: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_integer --------------------- 7867003898269499267 (1 row) SELECT hll_hash_bigint(0, -1); -psql:hash.sql:70: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_bigint ---------------------- -8352849679461500862 (1 row) SELECT hll_hash_bytea(E'\\x', -1); -psql:hash.sql:71: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_bytea --------------------- 7706185961851046380 (1 row) SELECT hll_hash_text('AB', -1); -psql:hash.sql:72: WARNING: negative seed values not compatible +WARNING: negative seed values not compatible hll_hash_text ---------------------- -6228783906452318195 @@ -317,12 +317,12 @@ SELECT hll_empty() || CAST(42 AS bigint)::hll_hashval; -- ERROR: doesn't cast implicitly SELECT hll_empty() || 42; -psql:hash.sql:100: ERROR: operator does not exist: hll || integer +ERROR: operator does not exist: hll || integer LINE 1: SELECT hll_empty() || 42; ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. SELECT hll_empty() || 42::bigint; -psql:hash.sql:101: ERROR: operator does not exist: hll || bigint +ERROR: operator does not exist: hll || bigint LINE 1: SELECT hll_empty() || 42::bigint; ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. diff --git a/expected/hash_0.out b/expected/hash_0.out new file mode 100644 index 0000000..f2ec052 --- /dev/null +++ b/expected/hash_0.out @@ -0,0 +1,328 @@ +-- ---------------------------------------------------------------- +-- Misc Tests on Hash Function +-- ---------------------------------------------------------------- +SELECT hll_set_output_version(1); + hll_set_output_version +------------------------ + 1 +(1 row) + +-- ---------------- boolean +SELECT hll_hash_boolean(FALSE); + hll_hash_boolean +--------------------- + 5048724184180415669 +(1 row) + +SELECT hll_hash_boolean(TRUE); + hll_hash_boolean +--------------------- + 8849112093580131862 +(1 row) + +-- ---------------- smallint +SELECT hll_hash_smallint(0::smallint); + hll_hash_smallint +--------------------- + 3478107235931676136 +(1 row) + +SELECT hll_hash_smallint(100::smallint); + hll_hash_smallint +--------------------- + 4631120266694327276 +(1 row) + +SELECT hll_hash_smallint(-100::smallint); + hll_hash_smallint +--------------------- + 5357168029120347761 +(1 row) + +-- ---------------- integer +SELECT hll_hash_integer(0); + hll_hash_integer +---------------------- + -3485513579396041028 +(1 row) + +SELECT hll_hash_integer(100); + hll_hash_integer +---------------------- + -5003248654201747171 +(1 row) + +SELECT hll_hash_integer(-100); + hll_hash_integer +---------------------- + -2771615523823720964 +(1 row) + +-- ---------------- bigint +SELECT hll_hash_bigint(0); + hll_hash_bigint +--------------------- + 2945182322382062539 +(1 row) + +SELECT hll_hash_bigint(100); + hll_hash_bigint +--------------------- + 8349353095166695771 +(1 row) + +SELECT hll_hash_bigint(-100); + hll_hash_bigint +--------------------- + -886862857196634693 +(1 row) + +-- ---------------- bytea +-- Check some small values. +SELECT hll_hash_bytea(E'\\x'); + hll_hash_bytea +---------------- + 0 +(1 row) + +SELECT hll_hash_bytea(E'\\x41'); + hll_hash_bytea +-------------------- + 243126998722523514 +(1 row) + +SELECT hll_hash_bytea(E'\\x42'); + hll_hash_bytea +---------------------- + -4837624800923759386 +(1 row) + +SELECT hll_hash_bytea(E'\\x4142'); + hll_hash_bytea +--------------------- + 5365230931951287672 +(1 row) + +-- ---------------- text +-- Check some small values. +SELECT hll_hash_text(''); + hll_hash_text +--------------- + 0 +(1 row) + +SELECT hll_hash_text('A'); + hll_hash_text +-------------------- + 243126998722523514 +(1 row) + +SELECT hll_hash_text('B'); + hll_hash_text +---------------------- + -4837624800923759386 +(1 row) + +SELECT hll_hash_text('AB'); + hll_hash_text +--------------------- + 5365230931951287672 +(1 row) + +-- ---------------- seed stuff +-- Seed 0 ok. +SELECT hll_hash_bigint(0, 0); + hll_hash_bigint +--------------------- + 2945182322382062539 +(1 row) + +-- Positive seed ok. +SELECT hll_hash_bigint(0, 1); + hll_hash_bigint +--------------------- + 8297479994805284640 +(1 row) + +-- Max positive seed ok. +SELECT hll_hash_bigint(0, 2147483647); + hll_hash_bigint +---------------------- + -4042198036618575253 +(1 row) + +-- WARNING: negative seed values not compatible +SELECT hll_hash_bigint(0, -1); +WARNING: negative seed values not compatible + hll_hash_bigint +---------------------- + -8352849679461500862 +(1 row) + +-- WARNING: negative seed values not compatible +SELECT hll_hash_bigint(0, -2); +WARNING: negative seed values not compatible + hll_hash_bigint +---------------------- + -8080898605520838299 +(1 row) + +-- WARNING: negative seed values not compatible +SELECT hll_hash_bigint(0, -2147483648); +WARNING: negative seed values not compatible + hll_hash_bigint +--------------------- + 8620050269462747046 +(1 row) + +-- WARNING: negative seed values not compatible +SELECT hll_hash_boolean(0, -1); +ERROR: function hll_hash_boolean(integer, integer) does not exist +LINE 1: SELECT hll_hash_boolean(0, -1); + ^ +HINT: No function matches the given name and argument types. You might need to add explicit type casts. +SELECT hll_hash_smallint(0::smallint, -1); +WARNING: negative seed values not compatible + hll_hash_smallint +--------------------- + 1411828310742905942 +(1 row) + +SELECT hll_hash_integer(0, -1); +WARNING: negative seed values not compatible + hll_hash_integer +--------------------- + 7867003898269499267 +(1 row) + +SELECT hll_hash_bigint(0, -1); +WARNING: negative seed values not compatible + hll_hash_bigint +---------------------- + -8352849679461500862 +(1 row) + +SELECT hll_hash_bytea(E'\\x', -1); +WARNING: negative seed values not compatible + hll_hash_bytea +--------------------- + 7706185961851046380 +(1 row) + +SELECT hll_hash_text('AB', -1); +WARNING: negative seed values not compatible + hll_hash_text +---------------------- + -6228783906452318195 +(1 row) + +-- ---------------- Matches +SELECT hll_hash_boolean(FALSE, 0), hll_hash_bytea(E'\\x00', 0); + hll_hash_boolean | hll_hash_bytea +---------------------+--------------------- + 5048724184180415669 | 5048724184180415669 +(1 row) + +SELECT hll_hash_boolean(TRUE, 0), hll_hash_bytea(E'\\x01', 0); + hll_hash_boolean | hll_hash_bytea +---------------------+--------------------- + 8849112093580131862 | 8849112093580131862 +(1 row) + +SELECT hll_hash_smallint(0::smallint, 0), hll_hash_bytea(E'\\x0000', 0); + hll_hash_smallint | hll_hash_bytea +---------------------+--------------------- + 3478107235931676136 | 3478107235931676136 +(1 row) + +SELECT hll_hash_integer(0, 0), hll_hash_bytea(E'\\x00000000', 0); + hll_hash_integer | hll_hash_bytea +----------------------+---------------------- + -3485513579396041028 | -3485513579396041028 +(1 row) + +SELECT hll_hash_bigint(0, 0), hll_hash_bytea(E'\\x0000000000000000', 0); + hll_hash_bigint | hll_hash_bytea +---------------------+--------------------- + 2945182322382062539 | 2945182322382062539 +(1 row) + +SELECT hll_hash_bytea(E'\\x4142', 0), hll_hash_text('AB', 0); + hll_hash_bytea | hll_hash_text +---------------------+--------------------- + 5365230931951287672 | 5365230931951287672 +(1 row) + +-- ---------------- Default seed = 0 +SELECT hll_hash_boolean(TRUE) = hll_hash_boolean(TRUE, 0); + ?column? +---------- + t +(1 row) + +SELECT hll_hash_smallint(100::smallint) = hll_hash_smallint(100::smallint, 0); + ?column? +---------- + t +(1 row) + +SELECT hll_hash_integer(100) = hll_hash_integer(100, 0); + ?column? +---------- + t +(1 row) + +SELECT hll_hash_bigint(100) = hll_hash_bigint(100, 0); + ?column? +---------- + t +(1 row) + +SELECT hll_hash_bytea(E'\\x42') = hll_hash_bytea(E'\\x42', 0); + ?column? +---------- + t +(1 row) + +SELECT hll_hash_text('AB') = hll_hash_text('AB', 0); + ?column? +---------- + t +(1 row) + +-- ---------------- Explicit casts work for already hashed numbers. +SELECT hll_empty() || 42::hll_hashval; + ?column? +-------------------------- + \x128b7f000000000000002a +(1 row) + +SELECT hll_empty() || CAST(42 AS hll_hashval); + ?column? +-------------------------- + \x128b7f000000000000002a +(1 row) + +SELECT hll_empty() || 42::bigint::hll_hashval; + ?column? +-------------------------- + \x128b7f000000000000002a +(1 row) + +SELECT hll_empty() || CAST(42 AS bigint)::hll_hashval; + ?column? +-------------------------- + \x128b7f000000000000002a +(1 row) + +-- ERROR: doesn't cast implicitly +SELECT hll_empty() || 42; +ERROR: operator does not exist: hll || integer +LINE 1: SELECT hll_empty() || 42; + ^ +HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +SELECT hll_empty() || 42::bigint; +ERROR: operator does not exist: hll || bigint +LINE 1: SELECT hll_empty() || 42::bigint; + ^ +HINT: No operator matches the given name and argument types. You might need to add explicit type casts. diff --git a/regress/hash_any.ref b/expected/hash_any.out similarity index 100% rename from regress/hash_any.ref rename to expected/hash_any.out diff --git a/regress/meta_func.ref b/expected/meta_func.out similarity index 98% rename from regress/meta_func.ref rename to expected/meta_func.out index 42ca52e..f77a266 100644 --- a/regress/meta_func.ref +++ b/expected/meta_func.out @@ -10,7 +10,7 @@ SELECT hll_set_output_version(1); SELECT hll_schema_version(NULL); hll_schema_version -------------------- - NULL + (1 row) SELECT hll_schema_version(E'\\x108b7f'); @@ -52,7 +52,7 @@ SELECT hll_schema_version(E'\\x14857f0840008001000020000008042000062884120021'); SELECT hll_type(NULL); hll_type ---------- - NULL + (1 row) SELECT hll_type(E'\\x108b7f'); @@ -94,7 +94,7 @@ SELECT hll_type(E'\\x14857f0840008001000020000008042000062884120021'); SELECT hll_log2m(NULL); hll_log2m ----------- - NULL + (1 row) SELECT hll_log2m(E'\\x108b7f'); @@ -136,7 +136,7 @@ SELECT hll_log2m(E'\\x14857f0840008001000020000008042000062884120021'); SELECT hll_regwidth(NULL); hll_regwidth -------------- - NULL + (1 row) SELECT hll_regwidth(E'\\x108b7f'); @@ -178,7 +178,7 @@ SELECT hll_regwidth(E'\\x14857f0840008001000020000008042000062884120021'); SELECT hll_expthresh(NULL); hll_expthresh --------------- - NULL + (1 row) SELECT hll_expthresh(E'\\x108b7f'); @@ -220,7 +220,7 @@ SELECT hll_expthresh(E'\\x14857f0840008001000020000008042000062884120021'); SELECT hll_sparseon(NULL); hll_sparseon -------------- - NULL + (1 row) SELECT hll_sparseon(E'\\x108b7f'); diff --git a/regress/murmur_bigint.ref b/expected/murmur_bigint.out similarity index 83% rename from regress/murmur_bigint.ref rename to expected/murmur_bigint.out index fbf7cfe..f79aa0c 100644 --- a/regress/murmur_bigint.ref +++ b/expected/murmur_bigint.out @@ -8,15 +8,14 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_seznjqbb; -DROP TABLE +NOTICE: table "test_seznjqbb" does not exist, skipping CREATE TABLE test_seznjqbb ( recno SERIAL, seed integer, pre_hash_long bigint, post_hash_long bigint ); -CREATE TABLE -\copy test_seznjqbb (seed, pre_hash_long, post_hash_long) from pstdin with csv header +\copy test_seznjqbb (seed, pre_hash_long, post_hash_long) from sql/data/murmur_bigint.csv with csv header SELECT COUNT(*) FROM test_seznjqbb; count ------- @@ -32,4 +31,3 @@ SELECT recno, post_hash_long, hll_hash_bigint(pre_hash_long, seed) (0 rows) DROP TABLE test_seznjqbb; -DROP TABLE diff --git a/regress/murmur_bytea.ref b/expected/murmur_bytea.out similarity index 83% rename from regress/murmur_bytea.ref rename to expected/murmur_bytea.out index ff31759..e00259a 100644 --- a/regress/murmur_bytea.ref +++ b/expected/murmur_bytea.out @@ -8,15 +8,14 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_qfwzdmoy; -DROP TABLE +NOTICE: table "test_qfwzdmoy" does not exist, skipping CREATE TABLE test_qfwzdmoy ( recno SERIAL, seed integer, pre_hash_long bytea, post_hash_long bigint ); -CREATE TABLE -\copy test_qfwzdmoy (seed, pre_hash_long, post_hash_long) from pstdin with csv header +\copy test_qfwzdmoy (seed, pre_hash_long, post_hash_long) from sql/data/murmur_bytea.csv with csv header SELECT COUNT(*) FROM test_qfwzdmoy; count ------- @@ -32,4 +31,3 @@ SELECT recno, post_hash_long, hll_hash_bytea(pre_hash_long, seed) (0 rows) DROP TABLE test_qfwzdmoy; -DROP TABLE diff --git a/regress/nosparse.ref b/expected/nosparse.out similarity index 100% rename from regress/nosparse.ref rename to expected/nosparse.out diff --git a/regress/notequal.ref b/expected/notequal.out similarity index 100% rename from regress/notequal.ref rename to expected/notequal.out diff --git a/regress/scalar_oob.ref b/expected/scalar_oob.out similarity index 97% rename from regress/scalar_oob.ref rename to expected/scalar_oob.out index fd40011..5a5d58d 100644 --- a/regress/scalar_oob.ref +++ b/expected/scalar_oob.out @@ -13,13 +13,13 @@ SELECT hll_set_output_version(1); SELECT hll_cardinality(NULL); hll_cardinality ----------------- - NULL + (1 row) SELECT hll_cardinality(E'\\x108b7f'::hll); hll_cardinality ----------------- - NULL + (1 row) SELECT hll_cardinality(E'\\x118b7f'::hll); @@ -45,38 +45,38 @@ SELECT hll_cardinality(E'\\x138b7f0001'::hll); SELECT hll_union(NULL, NULL); hll_union ----------- - NULL + (1 row) SELECT hll_union(NULL, E'\\x108b7f'::hll); hll_union ----------- - NULL + (1 row) SELECT hll_union(NULL, E'\\x118b7f'::hll); hll_union ----------- - NULL + (1 row) SELECT hll_union(NULL, E'\\x128b7f1111111111111111'::hll); hll_union ----------- - NULL + (1 row) SELECT hll_union(NULL, E'\\x138b7f0001'::hll); hll_union ----------- - NULL + (1 row) -- UNDEFINED SELECT hll_union(E'\\x108b7f'::hll, NULL); hll_union ----------- - NULL + (1 row) SELECT hll_union(E'\\x108b7f'::hll, E'\\x108b7f'::hll); @@ -107,7 +107,7 @@ SELECT hll_union(E'\\x108b7f'::hll, E'\\x138b7f0001'::hll); SELECT hll_union(E'\\x118b7f'::hll, NULL); hll_union ----------- - NULL + (1 row) SELECT hll_union(E'\\x118b7f'::hll, E'\\x108b7f'::hll); @@ -138,7 +138,7 @@ SELECT hll_union(E'\\x118b7f'::hll, E'\\x138b7f0001'::hll); SELECT hll_union(E'\\x128b7f1111111111111111'::hll, NULL); hll_union ----------- - NULL + (1 row) SELECT hll_union(E'\\x128b7f1111111111111111'::hll, E'\\x108b7f'::hll); @@ -169,7 +169,7 @@ SELECT hll_union(E'\\x128b7f1111111111111111'::hll, E'\\x138b7f0001'::hll); SELECT hll_union(E'\\x138b7f0001'::hll, NULL); hll_union ----------- - NULL + (1 row) SELECT hll_union(E'\\x138b7f0001'::hll, E'\\x108b7f'::hll); diff --git a/expected/setup.out b/expected/setup.out new file mode 100644 index 0000000..7f4840a --- /dev/null +++ b/expected/setup.out @@ -0,0 +1 @@ +CREATE EXTENSION hll; diff --git a/regress/storedproc.ref b/expected/storedproc.out similarity index 98% rename from regress/storedproc.ref rename to expected/storedproc.out index 2ae195c..3e0e190 100644 --- a/regress/storedproc.ref +++ b/expected/storedproc.out @@ -22,7 +22,6 @@ PERFORM hll_set_max_sparse(-1); PERFORM hll_set_defaults(11,5,-1,1); END; $$ LANGUAGE plpgsql; -CREATE FUNCTION SELECT hll_set_max_sparse(256); hll_set_max_sparse -------------------- diff --git a/regress/transaction.ref b/expected/transaction.out similarity index 98% rename from regress/transaction.ref rename to expected/transaction.out index 65f7365..a6f60be 100644 --- a/regress/transaction.ref +++ b/expected/transaction.out @@ -28,7 +28,6 @@ SELECT hll_set_defaults(10,4,128,0); -- Inside transaction - should have an affect later. BEGIN; -BEGIN SELECT hll_set_max_sparse(-1); hll_set_max_sparse -------------------- @@ -42,7 +41,6 @@ SELECT hll_set_defaults(11,5,-1,1); (1 row) COMMIT; -COMMIT SELECT hll_set_max_sparse(256); hll_set_max_sparse -------------------- @@ -57,7 +55,6 @@ SELECT hll_set_defaults(10,4,128,0); -- Inside Rolled back transaction, should still have an affect later. BEGIN; -BEGIN SELECT hll_set_max_sparse(-1); hll_set_max_sparse -------------------- @@ -71,7 +68,6 @@ SELECT hll_set_defaults(11,5,-1,1); (1 row) ROLLBACK; -ROLLBACK SELECT hll_set_max_sparse(256); hll_set_max_sparse -------------------- diff --git a/expected/typmod.out b/expected/typmod.out new file mode 100644 index 0000000..e9f65cd --- /dev/null +++ b/expected/typmod.out @@ -0,0 +1,190 @@ +-- ---------------------------------------------------------------- +-- Type Modifier Signature +-- ---------------------------------------------------------------- +SELECT hll_set_output_version(1); + hll_set_output_version +------------------------ + 1 +(1 row) + +DROP TABLE IF EXISTS test_qiundgkm; +NOTICE: table "test_qiundgkm" does not exist, skipping +-- Using all defaults. +CREATE TABLE test_qiundgkm (v1 hll); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+------+-----------+----------+--------- + v1 | hll | | | + +DROP TABLE test_qiundgkm; +-- Partial defaults. +CREATE TABLE test_qiundgkm (v1 hll(10)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(10, 4)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,4,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,4,64,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,4,64,0) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: invalid number of type modifiers +CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); +ERROR: invalid number of type modifiers +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); + ^ +-- ---------------------------------------------------------------- +-- Range Check log2nregs +-- ---------------------------------------------------------------- +-- ERROR: log2m modifier must be between 0 and 31 +CREATE TABLE test_qiundgkm (v1 hll(-1)); +ERROR: log2m modifier must be between 0 and 31 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(-1)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+---------------+-----------+----------+--------- + v1 | hll(0,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(31)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(31,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: log2m modifier must be between 0 and 31 +CREATE TABLE test_qiundgkm (v1 hll(32)); +ERROR: log2m modifier must be between 0 and 31 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(32)); + ^ +-- ---------------------------------------------------------------- +-- Range Check regwidth +-- ---------------------------------------------------------------- +-- ERROR: regwidth modifier must be between 0 and 7 +CREATE TABLE test_qiundgkm (v1 hll(11, -1)); +ERROR: regwidth modifier must be between 0 and 7 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, -1)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(11, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(11,0,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 7)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(11,7,-1,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: regwidth modifier must be between 0 and 7 +CREATE TABLE test_qiundgkm (v1 hll(11, 8)); +ERROR: regwidth modifier must be between 0 and 7 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 8)); + ^ +-- ---------------------------------------------------------------- +-- Range Check expthresh +-- ---------------------------------------------------------------- +-- ERROR: expthresh modifier must be between -1 and 2^32 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, -2)); +ERROR: expthresh modifier must be between -1 and 2^32 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, -2)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(11, 5, -1)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(11,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+---------------+-----------+----------+--------- + v1 | hll(11,5,0,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+-----------------+-----------+----------+--------- + v1 | hll(11,5,128,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 4294967296)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+------------------------+-----------+----------+--------- + v1 | hll(11,5,4294967296,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: expthresh modifier must be between -1 and 2^32 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); +ERROR: expthresh modifier must be between -1 and 2^32 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); + ^ +-- ---------------------------------------------------------------- +-- Range Check nosparse +-- ---------------------------------------------------------------- +-- ERROR: nosparse modifier must be 0 or 1 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, -1)); +ERROR: sparseon modifier must be 0 or 1 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, -1)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+-----------------+-----------+----------+--------- + v1 | hll(11,5,128,0) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 1)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+-----------------+-----------+----------+--------- + v1 | hll(11,5,128,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: nosparse modifier must be 0 or 1 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 2)); +ERROR: sparseon modifier must be 0 or 1 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 2)); + ^ diff --git a/expected/typmod_0.out b/expected/typmod_0.out new file mode 100644 index 0000000..a90fb8c --- /dev/null +++ b/expected/typmod_0.out @@ -0,0 +1,190 @@ +-- ---------------------------------------------------------------- +-- Type Modifier Signature +-- ---------------------------------------------------------------- +SELECT hll_set_output_version(1); + hll_set_output_version +------------------------ + 1 +(1 row) + +DROP TABLE IF EXISTS test_qiundgkm; +NOTICE: table "test_qiundgkm" does not exist, skipping +-- Using all defaults. +CREATE TABLE test_qiundgkm (v1 hll); +\d test_qiundgkm +Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+------+-----------+----------+--------- + v1 | hll | | | + +DROP TABLE test_qiundgkm; +-- Partial defaults. +CREATE TABLE test_qiundgkm (v1 hll(10)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(10, 4)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,4,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,4,64,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(10,4,64,0) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: invalid number of type modifiers +CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); +ERROR: invalid number of type modifiers +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); + ^ +-- ---------------------------------------------------------------- +-- Range Check log2nregs +-- ---------------------------------------------------------------- +-- ERROR: log2m modifier must be between 0 and 31 +CREATE TABLE test_qiundgkm (v1 hll(-1)); +ERROR: log2m modifier must be between 0 and 31 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(-1)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+---------------+-----------+----------+--------- + v1 | hll(0,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(31)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(31,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: log2m modifier must be between 0 and 31 +CREATE TABLE test_qiundgkm (v1 hll(32)); +ERROR: log2m modifier must be between 0 and 31 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(32)); + ^ +-- ---------------------------------------------------------------- +-- Range Check regwidth +-- ---------------------------------------------------------------- +-- ERROR: regwidth modifier must be between 0 and 7 +CREATE TABLE test_qiundgkm (v1 hll(11, -1)); +ERROR: regwidth modifier must be between 0 and 7 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, -1)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(11, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(11,0,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 7)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(11,7,-1,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: regwidth modifier must be between 0 and 7 +CREATE TABLE test_qiundgkm (v1 hll(11, 8)); +ERROR: regwidth modifier must be between 0 and 7 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 8)); + ^ +-- ---------------------------------------------------------------- +-- Range Check expthresh +-- ---------------------------------------------------------------- +-- ERROR: expthresh modifier must be between -1 and 2^32 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, -2)); +ERROR: expthresh modifier must be between -1 and 2^32 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, -2)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(11, 5, -1)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+----------------+-----------+----------+--------- + v1 | hll(11,5,-1,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+---------------+-----------+----------+--------- + v1 | hll(11,5,0,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+-----------------+-----------+----------+--------- + v1 | hll(11,5,128,1) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 4294967296)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+------------------------+-----------+----------+--------- + v1 | hll(11,5,4294967296,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: expthresh modifier must be between -1 and 2^32 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); +ERROR: expthresh modifier must be between -1 and 2^32 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); + ^ +-- ---------------------------------------------------------------- +-- Range Check nosparse +-- ---------------------------------------------------------------- +-- ERROR: nosparse modifier must be 0 or 1 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, -1)); +ERROR: sparseon modifier must be 0 or 1 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, -1)); + ^ +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 0)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+-----------------+-----------+----------+--------- + v1 | hll(11,5,128,0) | | | + +DROP TABLE test_qiundgkm; +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 1)); +\d test_qiundgkm + Table "public.test_qiundgkm" + Column | Type | Collation | Nullable | Default +--------+-----------------+-----------+----------+--------- + v1 | hll(11,5,128,1) | | | + +DROP TABLE test_qiundgkm; +-- ERROR: nosparse modifier must be 0 or 1 +CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 2)); +ERROR: sparseon modifier must be 0 or 1 +LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 2)); + ^ diff --git a/regress/typmod.ref b/expected/typmod_1.out similarity index 86% rename from regress/typmod.ref rename to expected/typmod_1.out index 34bf7c0..aa644a8 100644 --- a/regress/typmod.ref +++ b/expected/typmod_1.out @@ -8,10 +8,9 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_qiundgkm; -DROP TABLE +NOTICE: table "test_qiundgkm" does not exist, skipping -- Using all defaults. CREATE TABLE test_qiundgkm (v1 hll); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -19,10 +18,8 @@ Table "public.test_qiundgkm" v1 | hll | DROP TABLE test_qiundgkm; -DROP TABLE -- Partial defaults. CREATE TABLE test_qiundgkm (v1 hll(10)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -30,9 +27,7 @@ CREATE TABLE v1 | hll(10,5,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(10, 4)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -40,9 +35,7 @@ CREATE TABLE v1 | hll(10,4,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -50,9 +43,7 @@ CREATE TABLE v1 | hll(10,4,64,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -60,10 +51,9 @@ CREATE TABLE v1 | hll(10,4,64,0) | DROP TABLE test_qiundgkm; -DROP TABLE -- ERROR: invalid number of type modifiers CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); -psql:typmod.sql:32: ERROR: invalid number of type modifiers +ERROR: invalid number of type modifiers LINE 1: CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); ^ -- ---------------------------------------------------------------- @@ -71,11 +61,10 @@ LINE 1: CREATE TABLE test_qiundgkm (v1 hll(10, 4, 64, 0, 42)); -- ---------------------------------------------------------------- -- ERROR: log2m modifier must be between 0 and 31 CREATE TABLE test_qiundgkm (v1 hll(-1)); -psql:typmod.sql:39: ERROR: log2m modifier must be between 0 and 31 +ERROR: log2m modifier must be between 0 and 31 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(-1)); ^ CREATE TABLE test_qiundgkm (v1 hll(0)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -83,9 +72,7 @@ CREATE TABLE v1 | hll(0,5,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(31)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -93,10 +80,9 @@ CREATE TABLE v1 | hll(31,5,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE -- ERROR: log2m modifier must be between 0 and 31 CREATE TABLE test_qiundgkm (v1 hll(32)); -psql:typmod.sql:50: ERROR: log2m modifier must be between 0 and 31 +ERROR: log2m modifier must be between 0 and 31 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(32)); ^ -- ---------------------------------------------------------------- @@ -104,11 +90,10 @@ LINE 1: CREATE TABLE test_qiundgkm (v1 hll(32)); -- ---------------------------------------------------------------- -- ERROR: regwidth modifier must be between 0 and 7 CREATE TABLE test_qiundgkm (v1 hll(11, -1)); -psql:typmod.sql:57: ERROR: regwidth modifier must be between 0 and 7 +ERROR: regwidth modifier must be between 0 and 7 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, -1)); ^ CREATE TABLE test_qiundgkm (v1 hll(11, 0)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -116,9 +101,7 @@ CREATE TABLE v1 | hll(11,0,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(11, 7)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -126,10 +109,9 @@ CREATE TABLE v1 | hll(11,7,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE -- ERROR: regwidth modifier must be between 0 and 7 CREATE TABLE test_qiundgkm (v1 hll(11, 8)); -psql:typmod.sql:68: ERROR: regwidth modifier must be between 0 and 7 +ERROR: regwidth modifier must be between 0 and 7 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 8)); ^ -- ---------------------------------------------------------------- @@ -137,11 +119,10 @@ LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 8)); -- ---------------------------------------------------------------- -- ERROR: expthresh modifier must be between -1 and 2^32 CREATE TABLE test_qiundgkm (v1 hll(11, 5, -2)); -psql:typmod.sql:75: ERROR: expthresh modifier must be between -1 and 2^32 +ERROR: expthresh modifier must be between -1 and 2^32 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, -2)); ^ CREATE TABLE test_qiundgkm (v1 hll(11, 5, -1)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -149,9 +130,7 @@ CREATE TABLE v1 | hll(11,5,-1,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(11, 5, 0)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -159,9 +138,7 @@ CREATE TABLE v1 | hll(11,5,0,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -169,9 +146,7 @@ CREATE TABLE v1 | hll(11,5,128,1) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(11, 5, 4294967296)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -179,10 +154,9 @@ CREATE TABLE v1 | hll(11,5,4294967296,1) | DROP TABLE test_qiundgkm; -DROP TABLE -- ERROR: expthresh modifier must be between -1 and 2^32 CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); -psql:typmod.sql:94: ERROR: expthresh modifier must be between -1 and 2^32 +ERROR: expthresh modifier must be between -1 and 2^32 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); ^ -- ---------------------------------------------------------------- @@ -190,11 +164,10 @@ LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 8589934592)); -- ---------------------------------------------------------------- -- ERROR: nosparse modifier must be 0 or 1 CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, -1)); -psql:typmod.sql:101: ERROR: sparseon modifier must be 0 or 1 +ERROR: sparseon modifier must be 0 or 1 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, -1)); ^ CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 0)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -202,9 +175,7 @@ CREATE TABLE v1 | hll(11,5,128,0) | DROP TABLE test_qiundgkm; -DROP TABLE CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 1)); -CREATE TABLE \d test_qiundgkm Table "public.test_qiundgkm" Column | Type | Modifiers @@ -212,9 +183,8 @@ CREATE TABLE v1 | hll(11,5,128,1) | DROP TABLE test_qiundgkm; -DROP TABLE -- ERROR: nosparse modifier must be 0 or 1 CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 2)); -psql:typmod.sql:112: ERROR: sparseon modifier must be 0 or 1 +ERROR: sparseon modifier must be 0 or 1 LINE 1: CREATE TABLE test_qiundgkm (v1 hll(11, 5, 128, 2)); ^ diff --git a/regress/typmod_insert.ref b/expected/typmod_insert.out similarity index 88% rename from regress/typmod_insert.ref rename to expected/typmod_insert.out index 73d4953..7211a20 100644 --- a/regress/typmod_insert.ref +++ b/expected/typmod_insert.out @@ -5,31 +5,26 @@ SELECT hll_set_output_version(1); (1 row) DROP TABLE IF EXISTS test_trsybeqs; -DROP TABLE +NOTICE: table "test_trsybeqs" does not exist, skipping CREATE TABLE test_trsybeqs ( val hll(10) ); -CREATE TABLE -- ERROR: register count does not match: source uses 2048 and dest uses 1024 INSERT INTO test_trsybeqs(val) VALUES ( E'\\x148b7f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000'::hll ); -psql:typmod_insert.sql:12: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register count does not match: source uses 2048 and dest uses 1024 INSERT INTO test_trsybeqs(val) VALUES (hll_empty(11)); -psql:typmod_insert.sql:15: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register count does not match: source uses 2048 and dest uses 1024 INSERT INTO test_trsybeqs(val) VALUES (E'\\x118b7f'); -psql:typmod_insert.sql:18: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- ERROR: register count does not match: source uses 2048 and dest uses 1024 INSERT INTO test_trsybeqs(val) VALUES (E'\\x128b7f1111111111111111'); -psql:typmod_insert.sql:21: ERROR: register count does not match: source uses 2048 and dest uses 1024 +ERROR: register count does not match: source uses 2048 and dest uses 1024 -- These work because they are compatibly sized: INSERT INTO test_trsybeqs(val) VALUES (hll_empty(10)); -INSERT 0 1 INSERT INTO test_trsybeqs(val) VALUES (E'\\x118a7f'); -INSERT 0 1 INSERT INTO test_trsybeqs(val) VALUES (E'\\x128a7f1111111111111111'); -INSERT 0 1 DROP TABLE test_trsybeqs; -DROP TABLE diff --git a/regress/union_op.ref b/expected/union_op.out similarity index 100% rename from regress/union_op.ref rename to expected/union_op.out diff --git a/hll--2.10.sql b/hll.sql similarity index 100% rename from hll--2.10.sql rename to hll.sql diff --git a/MurmurHash3.h b/include/MurmurHash3.h similarity index 100% rename from MurmurHash3.h rename to include/MurmurHash3.h diff --git a/postgresql-hll.spec b/postgresql-hll.spec deleted file mode 100644 index 12cc5f6..0000000 --- a/postgresql-hll.spec +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2013 Aggregate Knowledge, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# The following lines are from the postgresql90 spec file, postgresql-9.0.spec -%define shortversion 93 -%define majorversion 9.3 -%define pgbaseinstdir /usr/pgsql-%{majorversion} - -Summary: Aggregate Knowledge HyperLogLog PostgreSQL extension. -Name: postgresql%{shortversion}-hll -Version: 2.10.0 -Release: 0 -License: Apache License, Version 2.0 -URL: https://github.com/aggregateknowledge/postgresql-hll -Vendor: Aggregate Knowledge, Inc. -Group: System Environment/Base -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: postgresql%{shortversion}-devel - -%description -Aggregate Knowledge HyperLogLog PostgreSQL extension. - -%prep -%setup -q -n %{name} - -%build - -make - -%install -rm -rf $RPM_BUILD_ROOT - -# Make a new build root. -mkdir -p $RPM_BUILD_ROOT - -mkdir -p $RPM_BUILD_ROOT%{pgbaseinstdir}/share/extension -install -m644 hll.control $RPM_BUILD_ROOT%{pgbaseinstdir}/share/extension -install -m644 hll--2.10.0.sql $RPM_BUILD_ROOT%{pgbaseinstdir}/share/extension - -mkdir -p $RPM_BUILD_ROOT%{pgbaseinstdir}/lib -install -m755 hll.so $RPM_BUILD_ROOT%{pgbaseinstdir}/lib - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root,-) -%doc README.markdown - -%dir %{pgbaseinstdir}/share/extension -%{pgbaseinstdir}/share/extension/hll.control -%{pgbaseinstdir}/share/extension/hll--2.10.0.sql - -%{pgbaseinstdir}/lib/hll.so - -%changelog -* Fri Jan 10 2014 Timon Karnezos - 2.10.0-0 -- added binary IO type for hll -* Mon Dec 16 2013 Timon Karnezos - 2.9.0-0 -- bitstream_pack fixed to write one byte at a time to avoid writing to unallocated memory -* Tue Jul 16 2013 Timon Karnezos - 2.8.0-0 -- hll_add_agg now returns hll_empty on input of an empty set -* Wed Jun 12 2013 Timon Karnezos - 2.7.1-0 -- Build fixes for OS X and Debian. -- Documentation fixes. -- Small changes to test format to improve stability across psql versions. -* Tue Dec 11 2012 Ken Sedgwick - 2.7-0 -- Initial version. diff --git a/regress/Makefile b/regress/Makefile deleted file mode 100644 index 8c943d8..0000000 --- a/regress/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2013 Aggregate Knowledge, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# For each file name "foo": -# -# foo.sql - test script -# foo.ref - expected output -# ../testdata/foo.csv - (optional data file for \copy from pstdin) -# foo.out - actual output - -PSQL = psql -TEST_DB = hll_regress - -SQL = $(wildcard *.sql) -OUT := $(SQL:%.sql=%.out) - -PSQLOPTS = -X --echo-all -P null=NULL # Print NULL values explicitly. -PGOPTIONS = --client-min-messages=warning # Output WARNINGS - -all: $(OUT) - @find . -maxdepth 1 -name '*.diff' -print -quit > failures - @if test -s failures; then \ - echo ERROR: `ls -1 *.diff | wc -l` / `ls -1 *.sql | wc -l` tests failed; \ - echo; \ - cat *.diff; \ - exit 1; \ - else \ - rm failures; \ - echo `ls -1 *.out | wc -l` / `ls -1 *.sql | wc -l` tests passed; \ - fi - -clean: - rm -f binary.dat *.out *.diff - -# If a matching testdata file exists use it as standard input. -# Otherwise the test doesn't need data on stdin. -# -%.out: %.sql %.ref - @echo -n $* - @if test -f ../testdata/$*.csv; then \ - PGOPTIONS=$(PGOPTIONS) $(PSQL) $(PSQLOPTS) $(TEST_DB) -f $*.sql < ../testdata/$*.csv > $*.out 2>&1; \ - else \ - PGOPTIONS=$(PGOPTIONS) $(PSQL) $(PSQLOPTS) $(TEST_DB) -f $*.sql > $*.out 2>&1; \ - fi - @diff -u -I "^COPY.*" $*.ref $*.out >> $*.diff || status=1 - @if test -s $*.diff; then \ - echo " .. FAIL"; \ - else \ - echo " .. PASS"; \ - rm -f $*.diff; \ - fi - diff --git a/regress/add_agg.sql b/sql/add_agg.sql similarity index 100% rename from regress/add_agg.sql rename to sql/add_agg.sql diff --git a/regress/agg_oob.sql b/sql/agg_oob.sql similarity index 100% rename from regress/agg_oob.sql rename to sql/agg_oob.sql diff --git a/regress/auto_sparse.sql b/sql/auto_sparse.sql similarity index 100% rename from regress/auto_sparse.sql rename to sql/auto_sparse.sql diff --git a/regress/card_op.sql b/sql/card_op.sql similarity index 100% rename from regress/card_op.sql rename to sql/card_op.sql diff --git a/regress/cast_shape.sql b/sql/cast_shape.sql similarity index 100% rename from regress/cast_shape.sql rename to sql/cast_shape.sql diff --git a/regress/copy_binary.sql b/sql/copy_binary.sql similarity index 100% rename from regress/copy_binary.sql rename to sql/copy_binary.sql diff --git a/regress/cumulative_add_cardinality_correction.sql b/sql/cumulative_add_cardinality_correction.sql similarity index 95% rename from regress/cumulative_add_cardinality_correction.sql rename to sql/cumulative_add_cardinality_correction.sql index 220637a..6292d06 100644 --- a/regress/cumulative_add_cardinality_correction.sql +++ b/sql/cumulative_add_cardinality_correction.sql @@ -20,7 +20,7 @@ CREATE TABLE test_msgfjqhm ( -- Copy the CSV data into the table -- -\copy test_msgfjqhm (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_msgfjqhm (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_cardinality_correction.csv with csv header SELECT COUNT(*) FROM test_msgfjqhm; diff --git a/regress/cumulative_add_comprehensive_promotion.sql b/sql/cumulative_add_comprehensive_promotion.sql similarity index 94% rename from regress/cumulative_add_comprehensive_promotion.sql rename to sql/cumulative_add_comprehensive_promotion.sql index b83b228..348e960 100644 --- a/regress/cumulative_add_comprehensive_promotion.sql +++ b/sql/cumulative_add_comprehensive_promotion.sql @@ -20,7 +20,7 @@ CREATE TABLE test_ptwysrqk ( -- Copy the CSV data into the table -- -\copy test_ptwysrqk (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_ptwysrqk (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_comprehensive_promotion.csv with csv header SELECT COUNT(*) FROM test_ptwysrqk; diff --git a/regress/cumulative_add_sparse_edge.sql b/sql/cumulative_add_sparse_edge.sql similarity index 95% rename from regress/cumulative_add_sparse_edge.sql rename to sql/cumulative_add_sparse_edge.sql index b35268c..4987d80 100644 --- a/regress/cumulative_add_sparse_edge.sql +++ b/sql/cumulative_add_sparse_edge.sql @@ -20,7 +20,7 @@ CREATE TABLE test_eopzdzwz ( -- Copy the CSV data into the table -- -\copy test_eopzdzwz (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_eopzdzwz (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_sparse_edge.csv with csv header SELECT COUNT(*) FROM test_eopzdzwz; diff --git a/regress/cumulative_add_sparse_random.sql b/sql/cumulative_add_sparse_random.sql similarity index 95% rename from regress/cumulative_add_sparse_random.sql rename to sql/cumulative_add_sparse_random.sql index 72b41e9..198560f 100644 --- a/regress/cumulative_add_sparse_random.sql +++ b/sql/cumulative_add_sparse_random.sql @@ -15,7 +15,7 @@ CREATE TABLE test_beelewuo ( -- Copy the CSV data into the table -- -\copy test_beelewuo (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_beelewuo (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_sparse_random.csv with csv header SELECT COUNT(*) FROM test_beelewuo; diff --git a/regress/cumulative_add_sparse_step.sql b/sql/cumulative_add_sparse_step.sql similarity index 95% rename from regress/cumulative_add_sparse_step.sql rename to sql/cumulative_add_sparse_step.sql index b589004..edde1c0 100644 --- a/regress/cumulative_add_sparse_step.sql +++ b/sql/cumulative_add_sparse_step.sql @@ -15,7 +15,7 @@ CREATE TABLE test_lunfjncl ( -- Copy the CSV data into the table -- -\copy test_lunfjncl (cardinality, raw_value, union_compressed_multiset) from pstdin with csv header +\copy test_lunfjncl (cardinality, raw_value, union_compressed_multiset) from sql/data/cumulative_add_sparse_step.csv with csv header SELECT COUNT(*) FROM test_lunfjncl; diff --git a/regress/cumulative_union_comprehensive.sql b/sql/cumulative_union_comprehensive.sql similarity index 96% rename from regress/cumulative_union_comprehensive.sql rename to sql/cumulative_union_comprehensive.sql index 974924d..964ead1 100644 --- a/regress/cumulative_union_comprehensive.sql +++ b/sql/cumulative_union_comprehensive.sql @@ -15,7 +15,7 @@ CREATE TABLE test_rhswkjtc ( -- Copy the CSV data into the table -- -\copy test_rhswkjtc (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_rhswkjtc (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_comprehensive.csv with csv header SELECT COUNT(*) FROM test_rhswkjtc; diff --git a/regress/cumulative_union_explicit_explicit.sql b/sql/cumulative_union_explicit_explicit.sql similarity index 96% rename from regress/cumulative_union_explicit_explicit.sql rename to sql/cumulative_union_explicit_explicit.sql index a9af524..27eae6a 100644 --- a/regress/cumulative_union_explicit_explicit.sql +++ b/sql/cumulative_union_explicit_explicit.sql @@ -15,7 +15,7 @@ CREATE TABLE test_swlnhisq ( -- Copy the CSV data into the table -- -\copy test_swlnhisq (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_swlnhisq (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_explicit_explicit.csv with csv header SELECT COUNT(*) FROM test_swlnhisq; diff --git a/regress/cumulative_union_explicit_promotion.sql b/sql/cumulative_union_explicit_promotion.sql similarity index 96% rename from regress/cumulative_union_explicit_promotion.sql rename to sql/cumulative_union_explicit_promotion.sql index fccd529..80b6f21 100644 --- a/regress/cumulative_union_explicit_promotion.sql +++ b/sql/cumulative_union_explicit_promotion.sql @@ -20,7 +20,7 @@ CREATE TABLE test_wsdiietv ( -- Copy the CSV data into the table -- -\copy test_wsdiietv (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_wsdiietv (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_explicit_promotion.csv with csv header SELECT COUNT(*) FROM test_wsdiietv; diff --git a/regress/cumulative_union_probabilistic_probabilistic.sql b/sql/cumulative_union_probabilistic_probabilistic.sql similarity index 95% rename from regress/cumulative_union_probabilistic_probabilistic.sql rename to sql/cumulative_union_probabilistic_probabilistic.sql index ac81adb..90d05db 100644 --- a/regress/cumulative_union_probabilistic_probabilistic.sql +++ b/sql/cumulative_union_probabilistic_probabilistic.sql @@ -15,7 +15,7 @@ CREATE TABLE test_mpuahgwy ( -- Copy the CSV data into the table -- -\copy test_mpuahgwy (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_mpuahgwy (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_probabilistic_probabilistic.csv with csv header SELECT COUNT(*) FROM test_mpuahgwy; diff --git a/regress/cumulative_union_sparse_full_representation.sql b/sql/cumulative_union_sparse_full_representation.sql similarity index 96% rename from regress/cumulative_union_sparse_full_representation.sql rename to sql/cumulative_union_sparse_full_representation.sql index db1c93d..729fe3c 100644 --- a/regress/cumulative_union_sparse_full_representation.sql +++ b/sql/cumulative_union_sparse_full_representation.sql @@ -20,7 +20,7 @@ CREATE TABLE test_tagumlbl ( -- Copy the CSV data into the table -- -\copy test_tagumlbl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_tagumlbl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_sparse_full_representation.csv with csv header SELECT COUNT(*) FROM test_tagumlbl; diff --git a/regress/cumulative_union_sparse_promotion.sql b/sql/cumulative_union_sparse_promotion.sql similarity index 96% rename from regress/cumulative_union_sparse_promotion.sql rename to sql/cumulative_union_sparse_promotion.sql index 3a9ad3a..11222a5 100644 --- a/regress/cumulative_union_sparse_promotion.sql +++ b/sql/cumulative_union_sparse_promotion.sql @@ -20,7 +20,7 @@ CREATE TABLE test_bsnvqefe ( -- Copy the CSV data into the table -- -\copy test_bsnvqefe (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_bsnvqefe (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_sparse_promotion.csv with csv header SELECT COUNT(*) FROM test_bsnvqefe; diff --git a/regress/cumulative_union_sparse_sparse.sql b/sql/cumulative_union_sparse_sparse.sql similarity index 96% rename from regress/cumulative_union_sparse_sparse.sql rename to sql/cumulative_union_sparse_sparse.sql index 909c1c8..5c8e49c 100644 --- a/regress/cumulative_union_sparse_sparse.sql +++ b/sql/cumulative_union_sparse_sparse.sql @@ -15,7 +15,7 @@ CREATE TABLE test_bmbffonl ( -- Copy the CSV data into the table -- -\copy test_bmbffonl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from pstdin with csv header +\copy test_bmbffonl (cardinality,compressed_multiset,union_cardinality,union_compressed_multiset) from sql/data/cumulative_union_sparse_sparse.csv with csv header SELECT COUNT(*) FROM test_bmbffonl; diff --git a/testdata/README.txt b/sql/data/README.txt similarity index 100% rename from testdata/README.txt rename to sql/data/README.txt diff --git a/testdata/cumulative_add_cardinality_correction.csv b/sql/data/cumulative_add_cardinality_correction.csv similarity index 100% rename from testdata/cumulative_add_cardinality_correction.csv rename to sql/data/cumulative_add_cardinality_correction.csv diff --git a/testdata/cumulative_add_comprehensive_promotion.csv b/sql/data/cumulative_add_comprehensive_promotion.csv similarity index 100% rename from testdata/cumulative_add_comprehensive_promotion.csv rename to sql/data/cumulative_add_comprehensive_promotion.csv diff --git a/testdata/cumulative_add_sparse_edge.csv b/sql/data/cumulative_add_sparse_edge.csv similarity index 100% rename from testdata/cumulative_add_sparse_edge.csv rename to sql/data/cumulative_add_sparse_edge.csv diff --git a/testdata/cumulative_add_sparse_random.csv b/sql/data/cumulative_add_sparse_random.csv similarity index 100% rename from testdata/cumulative_add_sparse_random.csv rename to sql/data/cumulative_add_sparse_random.csv diff --git a/testdata/cumulative_add_sparse_step.csv b/sql/data/cumulative_add_sparse_step.csv similarity index 100% rename from testdata/cumulative_add_sparse_step.csv rename to sql/data/cumulative_add_sparse_step.csv diff --git a/testdata/cumulative_union_comprehensive.csv b/sql/data/cumulative_union_comprehensive.csv similarity index 100% rename from testdata/cumulative_union_comprehensive.csv rename to sql/data/cumulative_union_comprehensive.csv diff --git a/testdata/cumulative_union_explicit_explicit.csv b/sql/data/cumulative_union_explicit_explicit.csv similarity index 100% rename from testdata/cumulative_union_explicit_explicit.csv rename to sql/data/cumulative_union_explicit_explicit.csv diff --git a/testdata/cumulative_union_explicit_promotion.csv b/sql/data/cumulative_union_explicit_promotion.csv similarity index 100% rename from testdata/cumulative_union_explicit_promotion.csv rename to sql/data/cumulative_union_explicit_promotion.csv diff --git a/testdata/cumulative_union_probabilistic_probabilistic.csv b/sql/data/cumulative_union_probabilistic_probabilistic.csv similarity index 100% rename from testdata/cumulative_union_probabilistic_probabilistic.csv rename to sql/data/cumulative_union_probabilistic_probabilistic.csv diff --git a/testdata/cumulative_union_sparse_full_representation.csv b/sql/data/cumulative_union_sparse_full_representation.csv similarity index 100% rename from testdata/cumulative_union_sparse_full_representation.csv rename to sql/data/cumulative_union_sparse_full_representation.csv diff --git a/testdata/cumulative_union_sparse_promotion.csv b/sql/data/cumulative_union_sparse_promotion.csv similarity index 100% rename from testdata/cumulative_union_sparse_promotion.csv rename to sql/data/cumulative_union_sparse_promotion.csv diff --git a/testdata/cumulative_union_sparse_sparse.csv b/sql/data/cumulative_union_sparse_sparse.csv similarity index 100% rename from testdata/cumulative_union_sparse_sparse.csv rename to sql/data/cumulative_union_sparse_sparse.csv diff --git a/testdata/murmur_bigint.csv b/sql/data/murmur_bigint.csv similarity index 100% rename from testdata/murmur_bigint.csv rename to sql/data/murmur_bigint.csv diff --git a/testdata/murmur_bytea.csv b/sql/data/murmur_bytea.csv similarity index 100% rename from testdata/murmur_bytea.csv rename to sql/data/murmur_bytea.csv diff --git a/regress/equal.sql b/sql/equal.sql similarity index 100% rename from regress/equal.sql rename to sql/equal.sql diff --git a/regress/explicit_thresh.sql b/sql/explicit_thresh.sql similarity index 100% rename from regress/explicit_thresh.sql rename to sql/explicit_thresh.sql diff --git a/regress/hash.sql b/sql/hash.sql similarity index 100% rename from regress/hash.sql rename to sql/hash.sql diff --git a/regress/hash_any.sql b/sql/hash_any.sql similarity index 100% rename from regress/hash_any.sql rename to sql/hash_any.sql diff --git a/regress/meta_func.sql b/sql/meta_func.sql similarity index 100% rename from regress/meta_func.sql rename to sql/meta_func.sql diff --git a/regress/murmur_bigint.sql b/sql/murmur_bigint.sql similarity index 85% rename from regress/murmur_bigint.sql rename to sql/murmur_bigint.sql index a83479d..125471e 100644 --- a/regress/murmur_bigint.sql +++ b/sql/murmur_bigint.sql @@ -13,7 +13,7 @@ CREATE TABLE test_seznjqbb ( post_hash_long bigint ); -\copy test_seznjqbb (seed, pre_hash_long, post_hash_long) from pstdin with csv header +\copy test_seznjqbb (seed, pre_hash_long, post_hash_long) from sql/data/murmur_bigint.csv with csv header SELECT COUNT(*) FROM test_seznjqbb; diff --git a/regress/murmur_bytea.sql b/sql/murmur_bytea.sql similarity index 85% rename from regress/murmur_bytea.sql rename to sql/murmur_bytea.sql index 985e239..ca4faa4 100644 --- a/regress/murmur_bytea.sql +++ b/sql/murmur_bytea.sql @@ -13,7 +13,7 @@ CREATE TABLE test_qfwzdmoy ( post_hash_long bigint ); -\copy test_qfwzdmoy (seed, pre_hash_long, post_hash_long) from pstdin with csv header +\copy test_qfwzdmoy (seed, pre_hash_long, post_hash_long) from sql/data/murmur_bytea.csv with csv header SELECT COUNT(*) FROM test_qfwzdmoy; diff --git a/regress/nosparse.sql b/sql/nosparse.sql similarity index 100% rename from regress/nosparse.sql rename to sql/nosparse.sql diff --git a/regress/notequal.sql b/sql/notequal.sql similarity index 100% rename from regress/notequal.sql rename to sql/notequal.sql diff --git a/regress/scalar_oob.sql b/sql/scalar_oob.sql similarity index 100% rename from regress/scalar_oob.sql rename to sql/scalar_oob.sql diff --git a/sql/setup.sql b/sql/setup.sql new file mode 100644 index 0000000..7f4840a --- /dev/null +++ b/sql/setup.sql @@ -0,0 +1 @@ +CREATE EXTENSION hll; diff --git a/regress/storedproc.sql b/sql/storedproc.sql similarity index 100% rename from regress/storedproc.sql rename to sql/storedproc.sql diff --git a/regress/transaction.sql b/sql/transaction.sql similarity index 100% rename from regress/transaction.sql rename to sql/transaction.sql diff --git a/regress/typmod.sql b/sql/typmod.sql similarity index 100% rename from regress/typmod.sql rename to sql/typmod.sql diff --git a/regress/typmod_insert.sql b/sql/typmod_insert.sql similarity index 100% rename from regress/typmod_insert.sql rename to sql/typmod_insert.sql diff --git a/regress/union_op.sql b/sql/union_op.sql similarity index 100% rename from regress/union_op.sql rename to sql/union_op.sql diff --git a/MurmurHash3.cpp b/src/MurmurHash3.cpp similarity index 100% rename from MurmurHash3.cpp rename to src/MurmurHash3.cpp diff --git a/hll.c b/src/hll.c similarity index 99% rename from hll.c rename to src/hll.c index 2740df6..02a3130 100644 --- a/hll.c +++ b/src/hll.c @@ -318,7 +318,7 @@ compressed_unpack(compreg_t * i_regp, brc.brc_curp = i_bitp; brc.brc_used = 0; - for (ssize_t ndx = 0; ndx < i_nregs; ++ndx) + for (size_t ndx = 0; ndx < i_nregs; ++ndx) { uint32_t val = bitstream_unpack(&brc); i_regp[ndx] = val; @@ -357,7 +357,7 @@ sparse_unpack(compreg_t * i_regp, brc.brc_curp = i_bitp; brc.brc_used = 0; - for (ssize_t ii = 0; ii < i_nfilled; ++ii) + for (size_t ii = 0; ii < i_nfilled; ++ii) { uint32_t buffer = bitstream_unpack(&brc); uint32_t val = buffer & regmask; @@ -480,7 +480,7 @@ compressed_pack(compreg_t const * i_regp, bwc.bwc_curp = o_bitp; bwc.bwc_used = 0; - for (ssize_t ndx = 0; ndx < i_nregs; ++ndx) + for (size_t ndx = 0; ndx < i_nregs; ++ndx) bitstream_pack(&bwc, i_regp[ndx]); } @@ -522,7 +522,7 @@ sparse_pack(compreg_t const * i_regp, bwc.bwc_curp = o_bitp; bwc.bwc_used = 0; - for (ssize_t ndx = 0; ndx < i_nregs; ++ndx) + for (size_t ndx = 0; ndx < i_nregs; ++ndx) { if (i_regp[ndx] != 0) { @@ -790,7 +790,7 @@ explicit_validate(multiset_t const * i_msp, ms_explicit_t const * i_msep) return; // Confirm that all elements are ascending with no duplicates. - for (int ii = 0; ii < i_msep->mse_nelem - 1; ++ii) + for (size_t ii = 0; ii < i_msep->mse_nelem - 1; ++ii) { if (element_compare(&i_msep->mse_elems[ii], &i_msep->mse_elems[ii + 1]) != -1) @@ -1184,7 +1184,7 @@ multiset_unpack(multiset_t * o_msp, // Pre-zero the registers since sparse only fills // in occasional ones. // - for (int ii = 0; ii < nregs; ++ii) + for (size_t ii = 0; ii < nregs; ++ii) mscp->msc_regs[ii] = 0; // Fill the registers. @@ -1295,7 +1295,7 @@ multiset_pack(multiset_t const * i_msp, uint8_t * o_bitp, size_t i_size) // compressed. // if (sparseon && - ((g_max_sparse != -1 && nfilled <= g_max_sparse) || + ((g_max_sparse != -1 && nfilled <= (size_t) g_max_sparse) || (g_max_sparse == -1 && sparsebitsz < cmprssbitsz))) { size_t ndx = pack_header(o_bitp, vers, MST_SPARSE, @@ -1441,7 +1441,7 @@ multiset_packed_size(multiset_t const * i_msp) // compressed. // if (sparseon && - ((g_max_sparse != -1 && nfilled <= g_max_sparse) || + ((g_max_sparse != -1 && nfilled <= (size_t) g_max_sparse) || (g_max_sparse == -1 && sparsebitsz < cmprssbitsz))) {