Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: install PostgreSQL
run: |
sudo apt update
sudo apt -y install postgresql-16 postgresql-client-16 postgresql-server-dev-16 libpq-dev
sudo apt -y install postgresql-16 postgresql-client-16 postgresql-server-dev-16 libpq-dev clang-19
- name: make
run: make
- name: install
Expand Down
10 changes: 10 additions & 0 deletions src/aod_sketch_c_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ char* aod_sketch_to_string(const void* sketchptr, bool print_entries) {
pg_unreachable();
}

unsigned aod_sketch_get_num_values(const void* sketchptr) {
try {
uint8_t num_values = static_cast<const compact_aod_sketch_pg*>(sketchptr)->get_num_values();
return num_values;
} catch (std::exception& e) {
pg_error(e.what());
}
pg_unreachable();
}

ptr_with_size aod_sketch_serialize(const void* sketchptr, unsigned header_size) {
try {
ptr_with_size p;
Expand Down
1 change: 1 addition & 0 deletions src/aod_sketch_c_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ double update_aod_sketch_get_estimate(const void* sketchptr);
double compact_aod_sketch_get_estimate(const void* sketchptr);
void** aod_sketch_get_estimate_and_bounds(const void* sketchptr, unsigned num_std_devs);
char* aod_sketch_to_string(const void* sketchptr, bool print_entries);
unsigned aod_sketch_get_num_values(const void* sketchptr);

struct ptr_with_size aod_sketch_serialize(const void* sketchptr, unsigned header_size);
void* aod_sketch_deserialize(const char* buffer, unsigned length);
Expand Down
4 changes: 4 additions & 0 deletions src/aod_sketch_pg_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ Datum pg_aod_sketch_union_agg(PG_FUNCTION_ARGS) {

sketch_bytes = PG_GETARG_BYTEA_P(1);
sketchptr = aod_sketch_deserialize(VARDATA(sketch_bytes), VARSIZE(sketch_bytes) - VARHDRSZ);
if (stateptr->num_values != aod_sketch_get_num_values(sketchptr)) {
compact_aod_sketch_delete(sketchptr);
elog(ERROR, "pg_aod_sketch_union_agg expects the same num_values in sketches");
}
aod_union_update(stateptr->ptr, sketchptr);
compact_aod_sketch_delete(sketchptr);

Expand Down