mirror of https://github.com/citusdata/citus.git
addressing review
parent
8eba822bfd
commit
257c2c8a35
|
@ -4753,11 +4753,14 @@ WorkerLimitCount(Node *limitCount, Node *limitOffset, OrderByLimitReference
|
|||
if (workerLimitNode != NULL && limitOffset != NULL)
|
||||
{
|
||||
Const *workerLimitConst = (Const *) workerLimitNode;
|
||||
|
||||
/* Only update the worker limit if the const is not null.*/
|
||||
if (!workerLimitConst->constisnull)
|
||||
{
|
||||
/* Only update the worker limit if the const is not null.*/
|
||||
Const *workerOffsetConst = (Const *) limitOffset;
|
||||
int64 workerLimitCount = DatumGetInt64(workerLimitConst->constvalue);
|
||||
|
||||
/* If the offset is null, it defaults to 0 when cast to int64. */
|
||||
int64 workerOffsetCount = DatumGetInt64(workerOffsetConst->constvalue);
|
||||
workerLimitCount = workerLimitCount + workerOffsetCount;
|
||||
workerLimitNode = (Node *) MakeIntegerConstInt64(workerLimitCount);
|
||||
|
|
|
@ -578,6 +578,29 @@ DEBUG: push down of limit count: 1
|
|||
1
|
||||
(1 row)
|
||||
|
||||
-- check if we can correctly push the limit when it is all
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 LIMIT all;
|
||||
DEBUG: push down of limit count: ALL
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
(6 rows)
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 OFFSET 2 LIMIT all;
|
||||
DEBUG: push down of limit count: ALL
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
(4 rows)
|
||||
|
||||
SET client_min_messages TO NOTICE;
|
||||
-- non constants should not push down
|
||||
CREATE OR REPLACE FUNCTION my_limit()
|
||||
|
|
|
@ -236,6 +236,11 @@ SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET
|
|||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET null LIMIT 1;
|
||||
|
||||
-- check if we can correctly push the limit when it is all
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 LIMIT all;
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 OFFSET 2 LIMIT all;
|
||||
|
||||
SET client_min_messages TO NOTICE;
|
||||
|
||||
-- non constants should not push down
|
||||
|
|
Loading…
Reference in New Issue