mirror of https://github.com/citusdata/citus.git
Merge pull request #3371 from citusdata/fix-task-tracker-row-gather-subquery
Fix row-gather for subqueries being handled by task-trackerpull/3355/head
commit
d855faf2b2
|
@ -65,6 +65,7 @@
|
||||||
#include "optimizer/var.h"
|
#include "optimizer/var.h"
|
||||||
#endif
|
#endif
|
||||||
#include "optimizer/restrictinfo.h"
|
#include "optimizer/restrictinfo.h"
|
||||||
|
#include "optimizer/tlist.h"
|
||||||
#include "parser/parse_relation.h"
|
#include "parser/parse_relation.h"
|
||||||
#include "parser/parsetree.h"
|
#include "parser/parsetree.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
|
@ -4220,9 +4221,20 @@ MapTaskList(MapMergeJob *mapMergeJob, List *filterTaskList)
|
||||||
partitionColumnName = groupByTargetEntry->resname;
|
partitionColumnName = groupByTargetEntry->resname;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
TargetEntry *targetEntry = tlist_member((Expr *) partitionColumn,
|
||||||
|
filterQuery->targetList);
|
||||||
|
if (targetEntry != NULL)
|
||||||
|
{
|
||||||
|
/* targetEntry->resname may be NULL */
|
||||||
|
partitionColumnName = targetEntry->resname;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partitionColumnName == NULL)
|
||||||
{
|
{
|
||||||
partitionColumnName = ColumnName(partitionColumn, rangeTableList);
|
partitionColumnName = ColumnName(partitionColumn, rangeTableList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(filterTaskCell, filterTaskList)
|
foreach(filterTaskCell, filterTaskList)
|
||||||
{
|
{
|
||||||
|
|
|
@ -383,10 +383,10 @@ select * FROM (
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
select * FROM (
|
select * FROM (
|
||||||
SELECT key, avg(distinct floor(agg1.val/2)) m from aggdata agg1
|
SELECT key k, avg(distinct floor(agg1.val/2)) m from aggdata agg1
|
||||||
group by key
|
group by key
|
||||||
) subq;
|
) subq;
|
||||||
key | m
|
k | m
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
1 | 1
|
1 | 1
|
||||||
5 |
|
5 |
|
||||||
|
@ -397,6 +397,16 @@ select * FROM (
|
||||||
9 | 0
|
9 | 0
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
|
-- Test TransformsSubqueryNode with group by not in FROM (failed in past)
|
||||||
|
select count(*) FROM (
|
||||||
|
SELECT avg(distinct floor(agg1.val/2)) m from aggdata agg1
|
||||||
|
group by key
|
||||||
|
) subq;
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
7
|
||||||
|
(1 row)
|
||||||
|
|
||||||
RESET citus.task_executor_type;
|
RESET citus.task_executor_type;
|
||||||
-- This fails due to table types not being managed properly
|
-- This fails due to table types not being managed properly
|
||||||
select key, count(distinct aggdata)
|
select key, count(distinct aggdata)
|
||||||
|
|
|
@ -184,7 +184,13 @@ select * FROM (
|
||||||
) subq ORDER BY 2, 1 LIMIT 5;
|
) subq ORDER BY 2, 1 LIMIT 5;
|
||||||
|
|
||||||
select * FROM (
|
select * FROM (
|
||||||
SELECT key, avg(distinct floor(agg1.val/2)) m from aggdata agg1
|
SELECT key k, avg(distinct floor(agg1.val/2)) m from aggdata agg1
|
||||||
|
group by key
|
||||||
|
) subq;
|
||||||
|
|
||||||
|
-- Test TransformsSubqueryNode with group by not in FROM (failed in past)
|
||||||
|
select count(*) FROM (
|
||||||
|
SELECT avg(distinct floor(agg1.val/2)) m from aggdata agg1
|
||||||
group by key
|
group by key
|
||||||
) subq;
|
) subq;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue