提交 a7694674 编写于 作者: D Dhanashree Kashid, Ekta Khanna and Jesse Zhang 提交者: Dhanashree Kashid

Fix infinite execution of partition selector

This fixes a bug introduced in e378d84b
where the partition selector may go in an infinite loop because it never
got a chance to actually _select_ the partitions.
上级 3416a948
......@@ -146,8 +146,8 @@ ExecPartitionSelector(PartitionSelectorState *node)
PartitionSelector *ps = (PartitionSelector *) node->ps.plan;
EState *estate = node->ps.state;
ExprContext *econtext = node->ps.ps_ExprContext;
TupleTableSlot *inputSlot;
TupleTableSlot *candidateOutputSlot;
TupleTableSlot *inputSlot = NULL;
TupleTableSlot *candidateOutputSlot = NULL;
if (ps->staticSelection)
{
......@@ -195,7 +195,10 @@ ExecPartitionSelector(PartitionSelectorState *node)
econtext->ecxt_outertuple = inputSlot;
econtext->ecxt_scantuple = inputSlot;
candidateOutputSlot = ExecProject(node->ps.ps_ProjInfo, NULL);
if (NULL != inputSlot)
{
candidateOutputSlot = ExecProject(node->ps.ps_ProjInfo, NULL);
}
/*
* If we have a partitioning projection, project the input tuple
......
......@@ -1938,6 +1938,31 @@ explain analyze select a.* from mpp8031 a, mpp8031 b where a.oid = b.oid;
(34 rows)
drop table mpp8031;
-- Test Query on Partition table when optimizer_static_partition_selection is OFF.
-- start_ignore
DROP TABLE IF EXISTS partitioned_table;
NOTICE: table "partitioned_table" does not exist, skipping
-- end_ignore
CREATE TABLE partitioned_table (a int)
PARTITION BY RANGE(a)
(
END(10),
END(20),
END(30)
);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
NOTICE: CREATE TABLE will create partition "partitioned_table_1_prt_1" for table "partitioned_table"
NOTICE: CREATE TABLE will create partition "partitioned_table_1_prt_2" for table "partitioned_table"
NOTICE: CREATE TABLE will create partition "partitioned_table_1_prt_3" for table "partitioned_table"
INSERT INTO partitioned_table VALUES(11);
SET optimizer_static_partition_selection = off;
SELECT * FROM partitioned_table;
a
----
11
(1 row)
-- CLEANUP
-- start_ignore
drop schema if exists bfv_partition;
......
......@@ -1938,6 +1938,31 @@ explain analyze select a.* from mpp8031 a, mpp8031 b where a.oid = b.oid;
(31 rows)
drop table mpp8031;
-- Test Query on Partition table when optimizer_static_partition_selection is OFF.
-- start_ignore
DROP TABLE IF EXISTS partitioned_table;
NOTICE: table "partitioned_table" does not exist, skipping
-- end_ignore
CREATE TABLE partitioned_table (a int)
PARTITION BY RANGE(a)
(
END(10),
END(20),
END(30)
);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
NOTICE: CREATE TABLE will create partition "partitioned_table_1_prt_1" for table "partitioned_table"
NOTICE: CREATE TABLE will create partition "partitioned_table_1_prt_2" for table "partitioned_table"
NOTICE: CREATE TABLE will create partition "partitioned_table_1_prt_3" for table "partitioned_table"
INSERT INTO partitioned_table VALUES(11);
SET optimizer_static_partition_selection = off;
SELECT * FROM partitioned_table;
a
----
11
(1 row)
-- CLEANUP
-- start_ignore
drop schema if exists bfv_partition;
......
......@@ -794,6 +794,25 @@ EVERY ('2 mons'::interval)
explain analyze select a.* from mpp8031 a, mpp8031 b where a.oid = b.oid;
drop table mpp8031;
-- Test Query on Partition table when optimizer_static_partition_selection is OFF.
-- start_ignore
DROP TABLE IF EXISTS partitioned_table;
-- end_ignore
CREATE TABLE partitioned_table (a int)
PARTITION BY RANGE(a)
(
END(10),
END(20),
END(30)
);
INSERT INTO partitioned_table VALUES(11);
SET optimizer_static_partition_selection = off;
SELECT * FROM partitioned_table;
-- CLEANUP
-- start_ignore
drop schema if exists bfv_partition;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册