timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
17.61k stars 883 forks source link

Fix accessor function cagg_get_bucket_function #6922

Closed fabriziomello closed 4 months ago

fabriziomello commented 4 months ago

In #6624 we refactored time_bucket catalog table to be more generic and introduced the cagg_get_bucket_function to inspect the query tree of a given Continuous Aggregate and return the time_bucket function oid.

The problem with the implementation is we traverse the whole query tree looking for FuncExpr and in certain cases we can have two different time_bucket function definition but what matters is the correct and valid time_bucket function that is part of the Query->groupClause.

Fixed it by inspecting only the Query->groupClause items looking for a valid time bucket FuncExpr and return it Oid.

Disable-check: force-changelog-file

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 68.75000% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 80.87%. Comparing base (59f50f2) to head (92a6e19). Report is 162 commits behind head on main.

:exclamation: Current head 92a6e19 differs from pull request most recent head 38e5c2b

Please upload reports for the commit 38e5c2b to get more accurate results.

Files Patch % Lines
tsl/src/continuous_aggs/repair.c 68.75% 1 Missing and 4 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6922 +/- ## ========================================== + Coverage 80.06% 80.87% +0.80% ========================================== Files 190 199 +9 Lines 37181 37190 +9 Branches 9450 9702 +252 ========================================== + Hits 29770 30078 +308 - Misses 2997 3234 +237 + Partials 4414 3878 -536 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.