Fix merge conflicts (#1347)

- Update regression tests to meet the changes in the regression
   test output.
 - Replace Ifs with Asserts given that the check is already done
 - Update shard pruning outputs
pull/1323/head
Önder Kalacı 2017-04-24 16:35:07 +03:00 committed by Onder Kalaci
parent d6e9350a4b
commit 2cbebc1c00
5 changed files with 74 additions and 146 deletions

View File

@ -2977,24 +2977,6 @@ FindReferencedTableColumn(Expr *columnExpression, List *parentQueryList, Query *
/* /*
* CoPartitionedTables checks if given two distributed tables have 1-to-1
* shard partitioning.
/*
* Check if the tables have the same colocation ID - if so, we know
* they're colocated.
*/
if (firstTableCache->colocationId != INVALID_COLOCATION_ID &&
firstTableCache->colocationId == secondTableCache->colocationId)
{
return true;
}
/*
* If not known to be colocated check if the remaining shards are
* anyway. Do so by comparing the shard interval arrays that are sorted on
* interval minimum values. Then it compares every shard interval in order
* and if any pair of shard intervals are not equal it returns false.
*/
* ExtractQueryWalker walks over a query, and finds all queries in the query * ExtractQueryWalker walks over a query, and finds all queries in the query
* tree and returns these queries. * tree and returns these queries.
*/ */
@ -3237,18 +3219,9 @@ WorkerLimitCount(MultiExtendedOp *originalOpNode)
* certain expressions such as parameters are not evaluated and converted * certain expressions such as parameters are not evaluated and converted
* into Consts on the op node. * into Consts on the op node.
*/ */
if (!IsA(originalOpNode->limitCount, Const)) Assert(IsA(originalOpNode->limitCount, Const));
{ Assert(originalOpNode->limitOffset == NULL ||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), IsA(originalOpNode->limitOffset, Const));
errmsg("unsupported limit clause")));
}
/* same as the above but this time for OFFSET clause */
if (originalOpNode->limitOffset && !IsA(originalOpNode->limitOffset, Const))
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsupported offset clause")));
}
/* /*
* If we don't have group by clauses, or if we have order by clauses without * If we don't have group by clauses, or if we have order by clauses without

View File

@ -1930,7 +1930,7 @@ FROM (
ORDER BY 2 DESC, 1 ORDER BY 2 DESC, 1
LIMIT $1 OFFSET $2; LIMIT $1 OFFSET $2;
EXECUTE parametrized_limit(3,3); EXECUTE parametrized_limit(3,3);
ERROR: unsupported limit clause ERROR: no value found for parameter 1
PREPARE parametrized_offset AS PREPARE parametrized_offset AS
SELECT user_id, array_length(events_table, 1) SELECT user_id, array_length(events_table, 1)
FROM ( FROM (
@ -1947,7 +1947,7 @@ FROM (
ORDER BY 2 DESC, 1 ORDER BY 2 DESC, 1
LIMIT 3 OFFSET $1; LIMIT 3 OFFSET $1;
EXECUTE parametrized_offset(3); EXECUTE parametrized_offset(3);
ERROR: unsupported offset clause ERROR: no value found for parameter 1
SET client_min_messages TO DEFAULT; SET client_min_messages TO DEFAULT;
DROP FUNCTION volatile_func_test(); DROP FUNCTION volatile_func_test();
SET citus.subquery_pushdown to OFF; SET citus.subquery_pushdown to OFF;

View File

@ -1329,6 +1329,8 @@ ORDER BY
count_pay; count_pay;
-- Lateral join subquery pushdown -- Lateral join subquery pushdown
-- set subquery_pushdown due to limit in the query
SET citus.subquery_pushdown to ON;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT SELECT
tenant_id, tenant_id,

View File

@ -407,20 +407,8 @@ SET client_min_messages TO DEBUG2;
SELECT * FROM SELECT * FROM
(SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE a = 'onder' GROUP BY a) (SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE a = 'onder' GROUP BY a)
AS foo; AS foo;
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270006 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270006 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval
count count
------- -------
@ -429,20 +417,8 @@ DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned
SELECT * FROM SELECT * FROM
(SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE 'eren' = a GROUP BY a) (SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE 'eren' = a GROUP BY a)
AS foo; AS foo;
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270007 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270007 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval
count count
------- -------
@ -1202,15 +1178,14 @@ FROM
-> Aggregate -> Aggregate
-> GroupAggregate -> GroupAggregate
Group Key: (((NULL::user_composite_type)).tenant_id), (((NULL::user_composite_type)).user_id) Group Key: (((NULL::user_composite_type)).tenant_id), (((NULL::user_composite_type)).user_id)
-> Merge Join -> Sort
Sort Key: (((NULL::user_composite_type)).tenant_id), (((NULL::user_composite_type)).user_id) Sort Key: (((NULL::user_composite_type)).tenant_id), (((NULL::user_composite_type)).user_id)
-> Sort -> Hash Join
Hash Cond: ((NULL::user_composite_type) = events.composite_id) Hash Cond: ((NULL::user_composite_type) = events.composite_id)
-> Seq Scan on users_270013 users -> Result
One-Time Filter: false One-Time Filter: false
-> Sort -> Hash
-> Seq Scan on events_270011 events (cost=0.00..11.79 rows=3 width=556) -> Seq Scan on events_270011 events
-> Seq Scan on events_270009 events
Filter: ((event_type)::text = ANY ('{click,submit,pay}'::text[])) Filter: ((event_type)::text = ANY ('{click,submit,pay}'::text[]))
(18 rows) (18 rows)
@ -1279,46 +1254,46 @@ GROUP BY
hasdone; hasdone;
QUERY PLAN QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
x HashAggregate HashAggregate
Group Key: remote_scan.hasdone
-> Custom Scan (Citus Real-Time) -> Custom Scan (Citus Real-Time)
Task Count: 4
Tasks Shown: One of 4
-> Task
Node: host=localhost port=57637 dbname=regression
-> GroupAggregate -> GroupAggregate
Group Key: subquery_top.hasdone
-> Sort -> Sort
Sort Key: subquery_top.hasdone
-> Subquery Scan on subquery_top -> Subquery Scan on subquery_top
-> GroupAggregate -> GroupAggregate
Group Key: subquery_1.tenant_id, subquery_1.user_id, ('Has done paying'::text)
-> Sort -> Sort
-> Merge Left Join Sort Key: subquery_1.tenant_id, subquery_1.user_id, ('Has done paying'::text)
-> Hash Right Join
Hash Cond: (events.composite_id = subquery_1.composite_id)
-> Unique -> Unique
-> Sort -> Sort
-> Append Sort Key: ((events.composite_id).tenant_id), ((events.composite_id).user_id)
-> Nested Loop -> Seq Scan on events_270011 events
-> Seq Scan on events_270009 events
-> Seq Scan on users_270013 users
-> Nested Loop
-> Seq Scan on events_270009 events_1
-> Seq Scan on users_270013 users_1
-> Materialize
-> Unique
-> Sort
-> Seq Scan on events_270009 events_2
-> Seq Scan on events_270011 events (cost=0.00..76.62 rows=1 width=80)
Filter: (((event_type)::text = 'pay'::text) AND (composite_id >= '(1,-9223372036854775808)'::user_composite_type) AND (composite_id <= '(1,9223372036854775807)'::user_composite_type)) Filter: (((event_type)::text = 'pay'::text) AND (composite_id >= '(1,-9223372036854775808)'::user_composite_type) AND (composite_id <= '(1,9223372036854775807)'::user_composite_type))
-> Hash (cost=23.89..23.89 rows=2 width=88) -> Hash
-> Subquery Scan on subquery_1 (cost=23.84..23.89 rows=2 width=88) -> Subquery Scan on subquery_1
-> Unique (cost=23.84..23.87 rows=2 width=88) -> Unique
-> Sort (cost=23.84..23.84 rows=2 width=88) -> Sort
Sort Key: (((NULL::user_composite_type)).tenant_id), (((NULL::user_composite_type)).user_id), (NULL::user_composite_type), ('action=>1'::text), events_1.event_time Sort Key: (((NULL::user_composite_type)).tenant_id), (((NULL::user_composite_type)).user_id), (NULL::user_composite_type), ('action=>1'::text), events_1.event_time
-> Append (cost=0.00..23.83 rows=2 width=88) -> Append
-> Nested Loop (cost=0.00..11.90 rows=1 width=88) -> Nested Loop
Join Filter: ((NULL::user_composite_type) = events_1.composite_id) Join Filter: ((NULL::user_composite_type) = events_1.composite_id)
-> Result (cost=0.00..0.01 rows=1 width=40) -> Result
One-Time Filter: false One-Time Filter: false
-> Seq Scan on events_270011 events_1 (cost=0.00..11.62 rows=1 width=40) -> Seq Scan on events_270011 events_1
Filter: ((event_type)::text = 'click'::text) Filter: ((event_type)::text = 'click'::text)
-> Nested Loop (cost=0.00..11.90 rows=1 width=88) -> Nested Loop
Join Filter: ((NULL::user_composite_type) = events_2.composite_id) Join Filter: ((NULL::user_composite_type) = events_2.composite_id)
-> Result (cost=0.00..0.01 rows=1 width=40) -> Result
One-Time Filter: false One-Time Filter: false
-> Seq Scan on events_270011 events_2 (cost=0.00..11.62 rows=1 width=40) -> Seq Scan on events_270011 events_2
Filter: ((event_type)::text = 'submit'::text) Filter: ((event_type)::text = 'submit'::text)
(41 rows) (41 rows)
@ -1395,6 +1370,8 @@ ORDER BY
count_pay; count_pay;
ERROR: bogus varattno for OUTER_VAR var: 3 ERROR: bogus varattno for OUTER_VAR var: 3
-- Lateral join subquery pushdown -- Lateral join subquery pushdown
-- set subquery_pushdown due to limit in the query
SET citus.subquery_pushdown to ON;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT SELECT
tenant_id, tenant_id,
@ -1445,8 +1422,8 @@ ORDER BY
user_lastseen DESC user_lastseen DESC
LIMIT LIMIT
10; 10;
QUERY PLAN QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------
Limit Limit
-> Sort -> Sort
Sort Key: remote_scan.user_lastseen DESC Sort Key: remote_scan.user_lastseen DESC
@ -1466,13 +1443,13 @@ LIMIT
-> Limit -> Limit
-> Sort -> Sort
Sort Key: users.lastseen DESC Sort Key: users.lastseen DESC
-> Seq Scan on users_270013 users -> Subquery Scan on users
-> Result (cost=0.00..0.01 rows=1 width=40) -> Result
One-Time Filter: false
-> Limit -> Limit
-> Sort -> Sort
-> Sort (cost=43.81..43.82 rows=1 width=524)
Sort Key: events.event_time DESC Sort Key: events.event_time DESC
-> Seq Scan on events_270009 events -> Seq Scan on events_270011 events
Filter: (composite_id = users.composite_id) Filter: (composite_id = users.composite_id)
(27 rows) (27 rows)

View File

@ -407,20 +407,8 @@ SET client_min_messages TO DEBUG2;
SELECT * FROM SELECT * FROM
(SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE a = 'onder' GROUP BY a) (SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE a = 'onder' GROUP BY a)
AS foo; AS foo;
DEBUG: predicate pruning for shardId 270007
DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270006 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270006 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270008
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval
count count
------- -------
@ -429,20 +417,8 @@ DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned
SELECT * FROM SELECT * FROM
(SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE 'eren' = a GROUP BY a) (SELECT count(*) FROM subquery_pruning_varchar_test_table WHERE 'eren' = a GROUP BY a)
AS foo; AS foo;
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270005 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: predicate pruning for shardId 270007
DEBUG: predicate pruning for shardId 270008
DEBUG: Skipping the target shard interval 270007 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270007 because SELECT query is pruned away for the interval
DEBUG: predicate pruning for shardId 270005
DEBUG: predicate pruning for shardId 270006
DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval DEBUG: Skipping the target shard interval 270008 because SELECT query is pruned away for the interval
count count
------- -------
@ -1199,16 +1175,14 @@ FROM
Tasks Shown: One of 4 Tasks Shown: One of 4
-> Task -> Task
Node: host=localhost port=57637 dbname=regression Node: host=localhost port=57637 dbname=regression
-> Aggregate -> Aggregate
-> GroupAggregate -> GroupAggregate
Group Key: ((users.composite_id).tenant_id), ((users.composite_id).user_id) Group Key: ((users.composite_id).tenant_id), ((users.composite_id).user_id)
-> Merge Join -> Sort
-> Sort
Sort Key: ((users.composite_id).tenant_id), ((users.composite_id).user_id) Sort Key: ((users.composite_id).tenant_id), ((users.composite_id).user_id)
-> Seq Scan on users_270013 users -> Result
One-Time Filter: false One-Time Filter: false
-> Sort (13 rows)
-> Seq Scan on events_270009 events
-- Union and left join subquery pushdown -- Union and left join subquery pushdown
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
@ -1276,34 +1250,34 @@ GROUP BY
QUERY PLAN QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HashAggregate HashAggregate
Group Key: remote_scan.hasdone
-> Custom Scan (Citus Real-Time) -> Custom Scan (Citus Real-Time)
Task Count: 4
Tasks Shown: One of 4
-> Task
Node: host=localhost port=57637 dbname=regression
-> HashAggregate -> HashAggregate
Group Key: COALESCE(('Has done paying'::text), 'Has not done paying'::text)
-> GroupAggregate -> GroupAggregate
Group Key: subquery_1.tenant_id, subquery_1.user_id, ('Has done paying'::text)
-> Sort -> Sort
-> Merge Left Join Sort Key: subquery_1.tenant_id, subquery_1.user_id, ('Has done paying'::text)
-> Hash Right Join
Hash Cond: (events.composite_id = subquery_1.composite_id)
-> Unique -> Unique
-> Sort -> Sort
-> Append Sort Key: ((events.composite_id).tenant_id), ((events.composite_id).user_id)
-> Nested Loop -> Seq Scan on events_270011 events
-> Seq Scan on events_270009 events
-> Seq Scan on users_270013 users
-> Nested Loop
-> Seq Scan on events_270009 events_1
-> Seq Scan on users_270013 users_1
-> Materialize
-> Unique
-> Sort
-> Seq Scan on events_270009 events_2
Filter: (((event_type)::text = 'pay'::text) AND (composite_id >= '(1,-9223372036854775808)'::user_composite_type) AND (composite_id <= '(1,9223372036854775807)'::user_composite_type)) Filter: (((event_type)::text = 'pay'::text) AND (composite_id >= '(1,-9223372036854775808)'::user_composite_type) AND (composite_id <= '(1,9223372036854775807)'::user_composite_type))
-> Hash (cost=0.10..0.10 rows=2 width=88) -> Hash
-> Subquery Scan on subquery_1 (cost=0.05..0.10 rows=2 width=88) -> Subquery Scan on subquery_1
-> Unique (cost=0.05..0.08 rows=2 width=0) -> Unique
-> Sort (cost=0.05..0.06 rows=2 width=0) -> Sort
Sort Key: ((composite_id).tenant_id), ((composite_id).user_id), composite_id, ('action=>1'::text), event_time Sort Key: ((composite_id).tenant_id), ((composite_id).user_id), composite_id, ('action=>1'::text), event_time
-> Append (cost=0.00..0.04 rows=2 width=0) -> Append
-> Result (cost=0.00..0.01 rows=1 width=0) -> Result
One-Time Filter: false One-Time Filter: false
-> Result (cost=0.00..0.01 rows=1 width=0) -> Result
One-Time Filter: false One-Time Filter: false
(30 rows) (30 rows)
@ -1380,6 +1354,8 @@ ORDER BY
count_pay; count_pay;
ERROR: bogus varattno for OUTER_VAR var: 3 ERROR: bogus varattno for OUTER_VAR var: 3
-- Lateral join subquery pushdown -- Lateral join subquery pushdown
-- set subquery_pushdown due to limit in the query
SET citus.subquery_pushdown to ON;
EXPLAIN (COSTS OFF) EXPLAIN (COSTS OFF)
SELECT SELECT
tenant_id, tenant_id,
@ -1430,8 +1406,8 @@ ORDER BY
user_lastseen DESC user_lastseen DESC
LIMIT LIMIT
10; 10;
QUERY PLAN QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------
Limit Limit
-> Sort -> Sort
Sort Key: remote_scan.user_lastseen DESC Sort Key: remote_scan.user_lastseen DESC
@ -1451,12 +1427,12 @@ LIMIT
-> Limit -> Limit
-> Sort -> Sort
Sort Key: lastseen DESC Sort Key: lastseen DESC
-> Seq Scan on users_270013 users -> Result
One-Time Filter: false One-Time Filter: false
-> Limit -> Limit
-> Sort -> Sort
Sort Key: events.event_time DESC Sort Key: events.event_time DESC
-> Seq Scan on events_270009 events -> Seq Scan on events_270011 events
Filter: (composite_id = composite_id) Filter: (composite_id = composite_id)
(26 rows) (26 rows)