From 7fe5de79c0099d6b5366cf94c295fa53f16a848f Mon Sep 17 00:00:00 2001 From: zeromax007 Date: Thu, 26 Mar 2020 16:25:43 +0800 Subject: [PATCH] Fix aggration bug, upgrade Coaring version. --- roaring.c | 16 ++++++++------ roaring.h | 8 +++---- roaringbitmap--0.2.65.2--0.2.66.sql | 0 ...-0.2.65.2.sql => roaringbitmap--0.2.66.sql | 0 roaringbitmap.c | 22 +++++++++++++++++++ roaringbitmap.control | 2 +- 6 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 roaringbitmap--0.2.65.2--0.2.66.sql rename roaringbitmap--0.2.65.2.sql => roaringbitmap--0.2.66.sql (100%) diff --git a/roaring.c b/roaring.c index 1dff983..d0997f1 100644 --- a/roaring.c +++ b/roaring.c @@ -1,4 +1,4 @@ -/* auto-generated on Wed Sep 11 23:36:34 CST 2019. Do not edit! */ +/* auto-generated on Thu Mar 26 16:06:13 CST 2020. Do not edit! */ #include "roaring.h" /* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */ @@ -643,8 +643,8 @@ int32_t difference_vector16(const uint16_t *__restrict__ A, size_t s_a, } if (i_a < s_a) { if(C == A) { - assert(count <= i_a); - if(count < i_a) { + assert((size_t)count <= i_a); + if((size_t)count < i_a) { memmove(C + count, A + i_a, sizeof(uint16_t) * (s_a - i_a)); } } else { @@ -4462,7 +4462,8 @@ run_container_t *run_container_from_array(const array_container_t *c) { /** * Convert the runcontainer to either a Bitmap or an Array Container, depending * on the cardinality. Frees the container. - * Allocates and returns new container, which caller is responsible for freeing + * Allocates and returns new container, which caller is responsible for freeing. + * It does not free the run container. */ void *convert_to_bitset_or_array_container(run_container_t *r, int32_t card, @@ -4480,7 +4481,7 @@ void *convert_to_bitset_or_array_container(run_container_t *r, int32_t card, } assert(card == answer->cardinality); *resulttype = ARRAY_CONTAINER_TYPE_CODE; - run_container_free(r); + //run_container_free(r); return answer; } bitset_container_t *answer = bitset_container_create(); @@ -4490,7 +4491,7 @@ void *convert_to_bitset_or_array_container(run_container_t *r, int32_t card, } answer->cardinality = card; *resulttype = BITSET_CONTAINER_TYPE_CODE; - run_container_free(r); + //run_container_free(r); return answer; } @@ -8837,7 +8838,7 @@ bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r) { int32_t card = run_container_cardinality(truec); void *c1 = convert_to_bitset_or_array_container( truec, card, &typecode_after); - shared_container_free((shared_container_t *)c); + shared_container_free((shared_container_t *)c);// will free the run container as needed ra_set_container_at_index(&r->high_low_container, i, c1, typecode_after); @@ -8845,6 +8846,7 @@ bool roaring_bitmap_remove_run_compression(roaring_bitmap_t *r) { int32_t card = run_container_cardinality((run_container_t *)c); void *c1 = convert_to_bitset_or_array_container( (run_container_t *)c, card, &typecode_after); + run_container_free((run_container_t *)c); ra_set_container_at_index(&r->high_low_container, i, c1, typecode_after); } diff --git a/roaring.h b/roaring.h index 6aa1e13..3b2e7f4 100644 --- a/roaring.h +++ b/roaring.h @@ -1,13 +1,13 @@ -/* auto-generated on Wed Sep 11 23:36:34 CST 2019. Do not edit! */ +/* auto-generated on Thu Mar 26 16:06:13 CST 2020. Do not edit! */ /* begin file include/roaring/roaring_version.h */ // /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand #ifndef ROARING_INCLUDE_ROARING_VERSION #define ROARING_INCLUDE_ROARING_VERSION -#define ROARING_VERSION = 0.2.65, +#define ROARING_VERSION = 0.2.66, enum { ROARING_VERSION_MAJOR = 0, ROARING_VERSION_MINOR = 2, - ROARING_VERSION_REVISION = 65 + ROARING_VERSION_REVISION = 66 }; #endif // ROARING_INCLUDE_ROARING_VERSION /* end file include/roaring/roaring_version.h */ @@ -2880,7 +2880,7 @@ array_container_t *array_container_from_bitset(const bitset_container_t *bits); run_container_t *run_container_from_array(const array_container_t *c); /* convert a run into either an array or a bitset - * might free the container */ + * might free the container. This does not free the input run container. */ void *convert_to_bitset_or_array_container(run_container_t *r, int32_t card, uint8_t *resulttype); diff --git a/roaringbitmap--0.2.65.2--0.2.66.sql b/roaringbitmap--0.2.65.2--0.2.66.sql new file mode 100644 index 0000000..e69de29 diff --git a/roaringbitmap--0.2.65.2.sql b/roaringbitmap--0.2.66.sql similarity index 100% rename from roaringbitmap--0.2.65.2.sql rename to roaringbitmap--0.2.66.sql diff --git a/roaringbitmap.c b/roaringbitmap.c index 5de9d95..8dd6612 100644 --- a/roaringbitmap.c +++ b/roaringbitmap.c @@ -924,6 +924,9 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_or_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { @@ -965,6 +968,9 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_or_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { @@ -1004,10 +1010,14 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_and_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { r1 = setup_roaringbitmap(aggctx); + } else { @@ -1052,6 +1062,9 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_and_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { @@ -1099,6 +1112,9 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_xor_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { @@ -1147,6 +1163,9 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_xor_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { @@ -1194,6 +1213,9 @@ Datum (errcode(ERRCODE_DATA_EXCEPTION), errmsg("rb_build_trans outside transition context"))); + // Fix bug at args are both null @20200326 ZEROMAX + if (PG_ARGISNULL(0) && PG_ARGISNULL(1)) PG_RETURN_NULL(); + // Is the first argument a NULL? if (PG_ARGISNULL(0)) { diff --git a/roaringbitmap.control b/roaringbitmap.control index 1294430..6a76cde 100644 --- a/roaringbitmap.control +++ b/roaringbitmap.control @@ -1,5 +1,5 @@ # roaringbitmap extension comment = 'Extension for RoaringBitmaps' -default_version = '0.2.65.2' +default_version = '0.2.66' module_pathname = '$libdir/roaringbitmap' relocatable = true \ No newline at end of file