Skip to content

Commit

Permalink
Add ensure calls to CAgg validation function
Browse files Browse the repository at this point in the history
The CAgg validation logic is quite complex. This PR adds two ensure()
statements to the validation function to make it more clear (e.g., also
for static code analyzers) that we expect a valid bucket function.
  • Loading branch information
jnidzwetzki committed Apr 8, 2024
1 parent 20f422b commit a54a280
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tsl/src/continuous_aggs/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,13 @@ cagg_validate_query(const Query *query, const bool finalized, const char *cagg_s
(bucket_info.bucket_time_offset != NULL) ||
(TIMESTAMP_NOT_FINITE(bucket_info.bucket_time_origin) == false);

/* At this point, we should have a valid bucket function. Otherwise, we have errored out before.
*/
Ensure(bucket_info.bucket_func != NULL, "unable to find valid bucket function");

/* Ignore time_bucket_ng in this check, since offset and origin were allowed in the past */
FuncInfo *func_info = ts_func_cache_get_bucketing_func(bucket_info.bucket_func->funcid);
Ensure(func_info != NULL, "bucket function is not found in function cache");
bool is_time_bucket_ng = func_info->origin == ORIGIN_TIMESCALE_EXPERIMENTAL;

/*
Expand Down

0 comments on commit a54a280

Please sign in to comment.