From c6705ebbd13e40690f6136c9acea4aae6949e8f4 Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Tue, 24 Aug 2021 13:31:32 +0300 Subject: [PATCH] Address reviews --- src/backend/timeseries/create_timeseries_table.c | 6 ++++++ src/include/timeseries/timeseries_utils.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/backend/timeseries/create_timeseries_table.c b/src/backend/timeseries/create_timeseries_table.c index 67d3ba55c..b1ee4b3d0 100644 --- a/src/backend/timeseries/create_timeseries_table.c +++ b/src/backend/timeseries/create_timeseries_table.c @@ -198,6 +198,12 @@ InitiateTimeseriesTablePartitions(Oid relationId, bool useStartFrom) { bool readOnly = false; StringInfo initiateTimeseriesPartitionsCommand = makeStringInfo(); + + /* + * Since making the right calculation via C is much more complex and + * we will call that function once to create timeseries table, we + * are using SPI call. + */ if (useStartFrom) { appendStringInfo(initiateTimeseriesPartitionsCommand, diff --git a/src/include/timeseries/timeseries_utils.h b/src/include/timeseries/timeseries_utils.h index 62201f977..f2c7c51d9 100644 --- a/src/include/timeseries/timeseries_utils.h +++ b/src/include/timeseries/timeseries_utils.h @@ -25,6 +25,10 @@ #define Anum_citus_timeseries_table_compression_threshold 6 #define Anum_citus_timeseries_table_retention_threshold 7 +/* + * Taken from the Postgres code. Postgres' uses that conversion + * for internal interval conparison. + */ #define INTERVAL_TO_SEC(ivp) \ (((double) (ivp)->time) / ((double) USECS_PER_SEC) + \ (ivp)->day * (24.0 * SECS_PER_HOUR) + \