mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-22 05:31:41 +08:00
Fix GapFill with ReScan
The GapFill node was not fully reset on a ReScan, so if there was a GapFill within a NestedLoop, only the first iteration would return results. This commit fixes this issues.
This commit is contained in:
parent
0ae37ba864
commit
df0acb161e
@ -13,6 +13,7 @@ accidentally triggering the load of a previous DB version.**
|
|||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
* #1648 Drop chunks for materialized hypertable
|
* #1648 Drop chunks for materialized hypertable
|
||||||
* #1665 Add ignore_invalidation_older_than to timescaledb_information.continuous_aggregates view
|
* #1665 Add ignore_invalidation_older_than to timescaledb_information.continuous_aggregates view
|
||||||
|
* #1674 Fix time_bucket_gapfill's interaction with GROUP BY
|
||||||
|
|
||||||
**Thanks**
|
**Thanks**
|
||||||
* @RJPhillips01 for reporting an issue with drop chunks.
|
* @RJPhillips01 for reporting an issue with drop chunks.
|
||||||
|
@ -728,6 +728,7 @@ gapfill_rescan(CustomScanState *node)
|
|||||||
{
|
{
|
||||||
ExecReScan(linitial(node->custom_ps));
|
ExecReScan(linitial(node->custom_ps));
|
||||||
}
|
}
|
||||||
|
((GapFillState *) node)->state = FETCHED_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2197,6 +2197,27 @@ GROUP BY 3,4;
|
|||||||
5 | 2 | red | 4
|
5 | 2 | red | 4
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
|
-- test with Nested Loop
|
||||||
|
SELECT l.id, bucket, data_value FROM
|
||||||
|
(VALUES (1), (2), (3), (4)) a(id)
|
||||||
|
INNER JOIN LATERAL (
|
||||||
|
SELECT b.id id, time_bucket_gapfill('1'::int, time, start=>'1'::int, finish=> '5'::int) bucket, locf(last(data, time)) data_value
|
||||||
|
FROM (VALUES (1, 1, 1), (1, 4, 4), (2, 1, -1), (2, 4, -4)) b(id, time, data)
|
||||||
|
WHERE a.id = b.id
|
||||||
|
GROUP BY b.id, bucket
|
||||||
|
) as l on (true);
|
||||||
|
id | bucket | data_value
|
||||||
|
----+--------+------------
|
||||||
|
1 | 1 | 1
|
||||||
|
1 | 2 | 1
|
||||||
|
1 | 3 | 1
|
||||||
|
1 | 4 | 4
|
||||||
|
2 | 1 | -1
|
||||||
|
2 | 2 | -1
|
||||||
|
2 | 3 | -1
|
||||||
|
2 | 4 | -4
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
-- test prepared statement
|
-- test prepared statement
|
||||||
PREPARE prep_gapfill AS
|
PREPARE prep_gapfill AS
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -1323,6 +1323,16 @@ SELECT
|
|||||||
FROM (VALUES (1,'blue',1),(2,'red',2)) v(time,color,value)
|
FROM (VALUES (1,'blue',1),(2,'red',2)) v(time,color,value)
|
||||||
GROUP BY 3,4;
|
GROUP BY 3,4;
|
||||||
|
|
||||||
|
-- test with Nested Loop
|
||||||
|
SELECT l.id, bucket, data_value FROM
|
||||||
|
(VALUES (1), (2), (3), (4)) a(id)
|
||||||
|
INNER JOIN LATERAL (
|
||||||
|
SELECT b.id id, time_bucket_gapfill('1'::int, time, start=>'1'::int, finish=> '5'::int) bucket, locf(last(data, time)) data_value
|
||||||
|
FROM (VALUES (1, 1, 1), (1, 4, 4), (2, 1, -1), (2, 4, -4)) b(id, time, data)
|
||||||
|
WHERE a.id = b.id
|
||||||
|
GROUP BY b.id, bucket
|
||||||
|
) as l on (true);
|
||||||
|
|
||||||
-- test prepared statement
|
-- test prepared statement
|
||||||
PREPARE prep_gapfill AS
|
PREPARE prep_gapfill AS
|
||||||
SELECT
|
SELECT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user