Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit075f472

Browse files
committed
refactoring in walk_expr_tree()'s machinery
1 parent171696f commit075f472

9 files changed

+110
-152
lines changed

‎expected/pathman_basic.out

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
450450
-> Seq Scan on hash_rel_2
451451
(4 rows)
452452

453+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE false;
454+
QUERY PLAN
455+
--------------------------
456+
Result
457+
One-Time Filter: false
458+
(2 rows)
459+
453460
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = NULL;
454461
QUERY PLAN
455462
--------------------------
@@ -609,6 +616,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
609616
-> Seq Scan on hash_rel_2
610617
(4 rows)
611618

619+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE false;
620+
QUERY PLAN
621+
--------------------------
622+
Result
623+
One-Time Filter: false
624+
(2 rows)
625+
612626
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = NULL;
613627
QUERY PLAN
614628
--------------------------

‎sql/pathman_basic.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ SET enable_bitmapscan = OFF;
165165
SET enable_seqscan=ON;
166166

167167
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_rel;
168+
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE false;
168169
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE value=NULL;
169170
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE value=2;
170171
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE value=2OR value=1;
@@ -189,6 +190,7 @@ SET enable_bitmapscan = OFF;
189190
SET enable_seqscan= OFF;
190191

191192
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_rel;
193+
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE false;
192194
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE value=NULL;
193195
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE value=2;
194196
EXPLAIN (COSTS OFF)SELECT*FROMtest.hash_relWHERE value=2OR value=1;

‎src/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
137137
{
138138
WrapperNode*wrap;
139139

140-
InitWalkerContext(&context,part_expr,inner_prel,NULL, false);
140+
InitWalkerContext(&context,part_expr,inner_prel,NULL);
141141
wrap=walk_expr_tree((Expr*)lfirst(lc),&context);
142142
paramsel *=wrap->paramsel;
143143
}
@@ -345,7 +345,7 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
345345
ranges=list_make1_irange_full(prel,IR_COMPLETE);
346346

347347
/* Make wrappers over restrictions and collect final rangeset */
348-
InitWalkerContext(&context,part_expr,prel,NULL, false);
348+
InitWalkerContext(&context,part_expr,prel,NULL);
349349
wrappers=NIL;
350350
foreach(lc,rel->baserestrictinfo)
351351
{

‎src/include/pathman.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,14 @@ typedef struct
146146
Node*prel_expr;/* expression from PartRelationInfo */
147147
constPartRelationInfo*prel;/* main partitioning structure */
148148
ExprContext*econtext;/* for ExecEvalExpr() */
149-
boolfor_insert;/* are we in PartitionFilter now? */
150149
}WalkerContext;
151150

152151
/* Usual initialization procedure for WalkerContext */
153-
#defineInitWalkerContext(context,expr,prel_info,ecxt,for_ins) \
152+
#defineInitWalkerContext(context,expr,prel_info,ecxt) \
154153
do { \
155154
(context)->prel_expr = (expr); \
156155
(context)->prel = (prel_info); \
157156
(context)->econtext = (ecxt); \
158-
(context)->for_insert = (for_ins); \
159157
} while (0)
160158

161159
/* Check that WalkerContext contains ExprContext (plan execution stage) */
@@ -166,11 +164,11 @@ WrapperNode *walk_expr_tree(Expr *expr, WalkerContext *context);
166164

167165

168166
voidselect_range_partitions(constDatumvalue,
167+
constOidcollid,
169168
FmgrInfo*cmp_func,
170169
constRangeEntry*ranges,
171170
constintnranges,
172171
constintstrategy,
173-
constOidcollid,
174172
WrapperNode*result);
175173

176174

‎src/nodes_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ rescan_append_common(CustomScanState *node)
723723
/* First we select all available partitions... */
724724
ranges=list_make1_irange_full(prel,IR_COMPLETE);
725725

726-
InitWalkerContext(&wcxt,prel_expr,prel,econtext, false);
726+
InitWalkerContext(&wcxt,prel_expr,prel,econtext);
727727
foreach (lc,scan_state->canon_custom_exprs)
728728
{
729729
WrapperNode*wn;

‎src/partition_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ find_partitions_for_value(Datum value, Oid value_type,
402402
CopyToTempConst(constbyval,ev_byval);
403403

404404
/* We use 0 since varno doesn't matter for Const */
405-
InitWalkerContext(&wcxt,0,prel,NULL, true);
405+
InitWalkerContext(&wcxt,0,prel,NULL);
406406
ranges=walk_expr_tree((Expr*)&temp_const,&wcxt)->rangeset;
407407

408408
returnget_partition_oids(ranges,nparts,prel, false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp