Skip to content

Commit

Permalink
Fix aggration bug, upgrade Coaring version.
Browse files Browse the repository at this point in the history
  • Loading branch information
zeromax007 committed Mar 26, 2020
1 parent c57005b commit 7fe5de7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
16 changes: 9 additions & 7 deletions roaring.c
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand All @@ -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;
}

Expand Down Expand Up @@ -8837,14 +8838,15 @@ 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);

} else {
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);
}
Expand Down
8 changes: 4 additions & 4 deletions roaring.h
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down Expand Up @@ -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);

Expand Down
Empty file.
File renamed without changes.
22 changes: 22 additions & 0 deletions roaringbitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion roaringbitmap.control
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7fe5de7

Please sign in to comment.