mirror of https://github.com/citusdata/citus.git
Add comment about NOT_EXPR. Treat it as invalid constraint for safety.
parent
7382c8be00
commit
3d3d615040
|
@ -559,6 +559,13 @@ BuildPruningTree(Node *node, PruningTreeBuildContext *context)
|
|||
|
||||
if (boolExpr->boolop == NOT_EXPR)
|
||||
{
|
||||
/*
|
||||
* We should not encounter NOT_EXPR nodes.
|
||||
* Postgres standard planner applies De Morgan's laws to remove them.
|
||||
* But if we encounter one, we treat it as invalid constraint for pruning.
|
||||
*/
|
||||
context->current->hasInvalidConstraints = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (context->current->boolop != boolExpr->boolop)
|
||||
|
|
|
@ -995,4 +995,65 @@ DEBUG: assigned task to node localhost:xxxxx
|
|||
4
|
||||
(1 row)
|
||||
|
||||
-- Check that NOT is handled with NEQs ORed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey != 2 OR o_orderkey != 3);
|
||||
DEBUG: Creating router plan
|
||||
DEBUG: Plan is router executable
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
0
|
||||
(1 row)
|
||||
|
||||
-- Check that NOT is handled with EQs ORed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey = 2 OR o_orderkey = 3);
|
||||
DEBUG: no valid constraints found
|
||||
DEBUG: shard count: 4
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
DEBUG: no valid constraints found
|
||||
DEBUG: shard count: 4
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
2
|
||||
(1 row)
|
||||
|
||||
-- Check that NOT is handled with NEQs ANDed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey != 2 AND o_orderkey != 3);
|
||||
DEBUG: constraint value: 2
|
||||
DEBUG: constraint value: 3
|
||||
DEBUG: shard count: 2
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
DEBUG: constraint value: 2
|
||||
DEBUG: constraint value: 3
|
||||
DEBUG: shard count: 2
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
2
|
||||
(1 row)
|
||||
|
||||
-- Check that NOT is handled with EQs ANDed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey = 2 AND o_orderkey = 3);
|
||||
DEBUG: no valid constraints found
|
||||
DEBUG: shard count: 4
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
DEBUG: no valid constraints found
|
||||
DEBUG: shard count: 4
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
DEBUG: assigned task to node localhost:xxxxx
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
4
|
||||
(1 row)
|
||||
|
||||
SET client_min_messages TO DEFAULT;
|
||||
|
|
|
@ -1429,6 +1429,9 @@ DEBUG: Deferred pruning for a fast-path router query
|
|||
DEBUG: Creating router plan
|
||||
DEBUG: Plan is router executable
|
||||
EXECUTE null_update_on_text_param_and_in(NULL);
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
DEBUG: Plan is router executable
|
||||
PREPARE null_update_on_text_param_and_in_2(text) AS UPDATE text_dist_column SET value = '' WHERE key IN ($1, 'test');
|
||||
EXECUTE null_update_on_text_param_and_in_2(NULL);
|
||||
DEBUG: Creating router plan
|
||||
|
|
|
@ -258,4 +258,20 @@ SELECT count(*) FROM orders_hash_partitioned
|
|||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE o_orderkey = 1 OR o_orderkey IS NOT NULL;
|
||||
|
||||
-- Check that NOT is handled with NEQs ORed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey != 2 OR o_orderkey != 3);
|
||||
|
||||
-- Check that NOT is handled with EQs ORed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey = 2 OR o_orderkey = 3);
|
||||
|
||||
-- Check that NOT is handled with NEQs ANDed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey != 2 AND o_orderkey != 3);
|
||||
|
||||
-- Check that NOT is handled with EQs ANDed
|
||||
SELECT count(*) FROM orders_hash_partitioned
|
||||
WHERE NOT (o_orderkey = 2 AND o_orderkey = 3);
|
||||
|
||||
SET client_min_messages TO DEFAULT;
|
||||
|
|
Loading…
Reference in New Issue