mirror of https://github.com/citusdata/citus.git
parent
2160a2951b
commit
6123022ca7
|
@ -259,6 +259,7 @@ MultiLogicalPlanOptimize(MultiTreeRoot *multiLogicalPlan)
|
||||||
MultiTable *tableNode = (MultiTable *) lfirst(tableNodeCell);
|
MultiTable *tableNode = (MultiTable *) lfirst(tableNodeCell);
|
||||||
if (tableNode->relationId == SUBQUERY_RELATION_ID)
|
if (tableNode->relationId == SUBQUERY_RELATION_ID)
|
||||||
{
|
{
|
||||||
|
ErrorIfContainsUnsupportedAggregate((MultiNode *) tableNode);
|
||||||
TransformSubqueryNode(tableNode);
|
TransformSubqueryNode(tableNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2145,8 +2146,9 @@ ErrorIfUnsupportedAggregateDistinct(Aggref *aggregateExpression,
|
||||||
bool distinctSupported = true;
|
bool distinctSupported = true;
|
||||||
List *repartitionNodeList = NIL;
|
List *repartitionNodeList = NIL;
|
||||||
Var *distinctColumn = NULL;
|
Var *distinctColumn = NULL;
|
||||||
|
List *multiTableNodeList = NIL;
|
||||||
AggregateType aggregateType = GetAggregateType(aggregateExpression->aggfnoid);
|
ListCell *multiTableNodeCell = NULL;
|
||||||
|
AggregateType aggregateType = AGGREGATE_INVALID_FIRST;
|
||||||
|
|
||||||
/* check if logical plan includes a subquery */
|
/* check if logical plan includes a subquery */
|
||||||
List *subqueryMultiTableList = SubqueryMultiTableList(logicalPlanNode);
|
List *subqueryMultiTableList = SubqueryMultiTableList(logicalPlanNode);
|
||||||
|
@ -2157,7 +2159,20 @@ ErrorIfUnsupportedAggregateDistinct(Aggref *aggregateExpression,
|
||||||
errdetail("distinct in the outermost query is unsupported")));
|
errdetail("distinct in the outermost query is unsupported")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
multiTableNodeList = FindNodesOfType(logicalPlanNode, T_MultiTable);
|
||||||
|
foreach(multiTableNodeCell, multiTableNodeList)
|
||||||
|
{
|
||||||
|
MultiTable *multiTable = (MultiTable *) lfirst(multiTableNodeCell);
|
||||||
|
if (multiTable->relationId == SUBQUERY_RELATION_ID)
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errmsg("cannot compute count (distinct)"),
|
||||||
|
errdetail("Subqueries with aggregate (distinct) are "
|
||||||
|
"not supported yet")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if we have a count(distinct), and distinct approximation is enabled */
|
/* if we have a count(distinct), and distinct approximation is enabled */
|
||||||
|
aggregateType = GetAggregateType(aggregateExpression->aggfnoid);
|
||||||
if (aggregateType == AGGREGATE_COUNT &&
|
if (aggregateType == AGGREGATE_COUNT &&
|
||||||
CountDistinctErrorRate != DISABLE_DISTINCT_APPROXIMATION)
|
CountDistinctErrorRate != DISABLE_DISTINCT_APPROXIMATION)
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,6 +171,18 @@ from
|
||||||
l_tax) as distributed_table;
|
l_tax) as distributed_table;
|
||||||
ERROR: cannot perform distributed planning on this query
|
ERROR: cannot perform distributed planning on this query
|
||||||
DETAIL: Subqueries without aggregates are not supported yet
|
DETAIL: Subqueries without aggregates are not supported yet
|
||||||
|
-- Check that we don't support subqueries with count(distinct).
|
||||||
|
select
|
||||||
|
different_shipment_days
|
||||||
|
from
|
||||||
|
(select
|
||||||
|
count(distinct l_shipdate) as different_shipment_days
|
||||||
|
from
|
||||||
|
lineitem
|
||||||
|
group by
|
||||||
|
l_partkey) as distributed_table;
|
||||||
|
ERROR: cannot compute count (distinct)
|
||||||
|
DETAIL: Subqueries with aggregate (distinct) are not supported yet
|
||||||
-- Check that if subquery is pulled, we don't error and run query properly.
|
-- Check that if subquery is pulled, we don't error and run query properly.
|
||||||
SELECT max(l_suppkey) FROM
|
SELECT max(l_suppkey) FROM
|
||||||
(
|
(
|
||||||
|
|
|
@ -125,6 +125,18 @@ from
|
||||||
group by
|
group by
|
||||||
l_tax) as distributed_table;
|
l_tax) as distributed_table;
|
||||||
|
|
||||||
|
-- Check that we don't support subqueries with count(distinct).
|
||||||
|
|
||||||
|
select
|
||||||
|
different_shipment_days
|
||||||
|
from
|
||||||
|
(select
|
||||||
|
count(distinct l_shipdate) as different_shipment_days
|
||||||
|
from
|
||||||
|
lineitem
|
||||||
|
group by
|
||||||
|
l_partkey) as distributed_table;
|
||||||
|
|
||||||
-- Check that if subquery is pulled, we don't error and run query properly.
|
-- Check that if subquery is pulled, we don't error and run query properly.
|
||||||
|
|
||||||
SELECT max(l_suppkey) FROM
|
SELECT max(l_suppkey) FROM
|
||||||
|
|
Loading…
Reference in New Issue