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

Commit8cf2371

Browse files
committed
rename some fields in PartRelationInfo
1 parent26cb18f commit8cf2371

File tree

10 files changed

+86
-80
lines changed

10 files changed

+86
-80
lines changed

‎src/hooks.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
325325
TypeCacheEntry*tce;
326326

327327
/* Determine operator type */
328-
tce=lookup_type_cache(prel->atttype,TYPECACHE_LT_OPR |TYPECACHE_GT_OPR);
328+
tce=lookup_type_cache(prel->ev_type,TYPECACHE_LT_OPR |TYPECACHE_GT_OPR);
329329

330330
/* Make pathkeys */
331331
pathkeys=build_expression_pathkey(root, (Expr*)part_expr,NULL,

‎src/include/relation_info.h‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ typedef enum
119119
}PartType;
120120

121121
/*
122-
* Child relation info for RANGE partitioning
122+
* Child relation info for RANGE partitioning.
123123
*/
124124
typedefstruct
125125
{
@@ -130,34 +130,38 @@ typedef struct
130130

131131
/*
132132
* PartRelationInfo
133-
*Per-relation partitioning information
133+
*Per-relation partitioning information.
134+
*Allows us to perform partition pruning.
134135
*/
135136
typedefstruct
136137
{
137138
Oidkey;/* partitioned table's Oid */
138-
boolvalid;/* is this entry valid? */
139-
boolenable_parent;/*include parent to the plan */
139+
boolvalid,/* is this entry valid? */
140+
enable_parent;/*should plan include parent? */
140141

141142
PartTypeparttype;/* partitioning type (HASH | RANGE) */
142143

144+
/* Partition dispatch info */
143145
uint32children_count;
144146
Oid*children;/* Oids of child partitions */
145147
RangeEntry*ranges;/* per-partition range entry or NULL */
146148

149+
/* Partitioning expression */
147150
constchar*expr_cstr;/* original expression */
148151
Node*expr;/* planned expression */
149152
List*expr_vars;/* vars from expression, lazy */
150153
Bitmapset*expr_atts;/* attnums from expression */
151154

152-
Oidatttype;/* expression type */
153-
int32atttypmod;/* expression type modifier */
154-
boolattbyval;/* is partitioned column stored by value? */
155-
int16attlen;/* length of the partitioned column's type */
156-
intattalign;/* alignment of the part column's type */
157-
Oidattcollid;/* collation of the partitioned column */
155+
/* Partitioning expression's value */
156+
Oidev_type;/* expression type */
157+
int32ev_typmod;/* expression type modifier */
158+
boolev_byval;/* is expression's val stored by value? */
159+
int16ev_len;/* length of the expression val's type */
160+
intev_align;/* alignment of the expression val's type */
161+
Oidev_collid;/* collation of the expression val */
158162

159-
Oidcmp_proc,/* comparison fuction for 'atttype' */
160-
hash_proc;/* hash function for 'atttype' */
163+
Oidcmp_proc,/* comparison fuction for 'ev_type' */
164+
hash_proc;/* hash function for 'ev_type' */
161165
}PartRelationInfo;
162166

163167
#definePART_EXPR_VARNO( 1 )
@@ -176,6 +180,7 @@ typedef struct
176180
/*
177181
* PartBoundInfo
178182
*Cached bounds of the specified partition.
183+
*Allows us to deminish overhead of check constraints.
179184
*/
180185
typedefstruct
181186
{
@@ -255,6 +260,7 @@ PrelExpressionForRelid(const PartRelationInfo *prel, Index rel_index)
255260
{
256261
Node*expr;
257262

263+
/* TODO: implement some kind of cache */
258264
if (rel_index!=PART_EXPR_VARNO)
259265
{
260266
expr=copyObject(prel->expr);
@@ -360,7 +366,7 @@ FreeRangesArray(PartRelationInfo *prel)
360366
if (prel->ranges)
361367
{
362368
/* Remove persistent entries if not byVal */
363-
if (!prel->attbyval)
369+
if (!prel->ev_byval)
364370
{
365371
for (i=0;i<PrelChildrenCount(prel);i++)
366372
{
@@ -370,8 +376,8 @@ FreeRangesArray(PartRelationInfo *prel)
370376
if (!OidIsValid(child))
371377
continue;
372378

373-
FreeBound(&prel->ranges[i].min,prel->attbyval);
374-
FreeBound(&prel->ranges[i].max,prel->attbyval);
379+
FreeBound(&prel->ranges[i].min,prel->ev_byval);
380+
FreeBound(&prel->ranges[i].max,prel->ev_byval);
375381
}
376382
}
377383

‎src/init.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ validate_range_constraint(const Expr *expr,
878878
*lower_null=*upper_null= true;
879879

880880
/* Find type cache entry for partitioned expression type */
881-
tce=lookup_type_cache(prel->atttype,TYPECACHE_BTREE_OPFAMILY);
881+
tce=lookup_type_cache(prel->ev_type,TYPECACHE_BTREE_OPFAMILY);
882882

883883
/* Is it an AND clause? */
884884
if (and_clause((Node*)expr))
@@ -1034,7 +1034,7 @@ read_opexpr_const(const OpExpr *opexpr,
10341034
/* Cast Const to a proper type if needed */
10351035
*value=perform_type_cast(boundary->constvalue,
10361036
getBaseType(boundary->consttype),
1037-
getBaseType(prel->atttype),
1037+
getBaseType(prel->ev_type),
10381038
&cast_success);
10391039

10401040
if (!cast_success)

‎src/partition_creation.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ create_partitions_for_value_internal(Oid relid, Datum value, Oid value_type,
354354
shout_if_prel_is_invalid(relid,prel,PT_RANGE);
355355

356356
/* Fetch base types of prel->atttype & value_type */
357-
base_bound_type=getBaseType(prel->atttype);
357+
base_bound_type=getBaseType(prel->ev_type);
358358
base_value_type=getBaseType(value_type);
359359

360360
/* Search for a suitable partition if we didn't hold it */
@@ -398,12 +398,12 @@ create_partitions_for_value_internal(Oid relid, Datum value, Oid value_type,
398398

399399
/* Copy datums in order to protect them from cache invalidation */
400400
bound_min=CopyBound(&ranges[0].min,
401-
prel->attbyval,
402-
prel->attlen);
401+
prel->ev_byval,
402+
prel->ev_len);
403403

404404
bound_max=CopyBound(&ranges[PrelLastChild(prel)].max,
405-
prel->attbyval,
406-
prel->attlen);
405+
prel->ev_byval,
406+
prel->ev_len);
407407

408408
/* Check if interval is set */
409409
if (isnull[Anum_pathman_config_range_interval-1])
@@ -426,7 +426,7 @@ create_partitions_for_value_internal(Oid relid, Datum value, Oid value_type,
426426
&bound_min,&bound_max,base_bound_type,
427427
interval_binary,interval_type,
428428
value,base_value_type,
429-
prel->attcollid);
429+
prel->ev_collid);
430430
}
431431
}
432432
else
@@ -1259,15 +1259,15 @@ check_range_available(Oid parent_relid,
12591259
/* Fetch comparison function */
12601260
fill_type_cmp_fmgr_info(&cmp_func,
12611261
getBaseType(value_type),
1262-
getBaseType(prel->atttype));
1262+
getBaseType(prel->ev_type));
12631263

12641264
ranges=PrelGetRangesArray(prel);
12651265
for (i=0;i<PrelChildrenCount(prel);i++)
12661266
{
12671267
intc1,c2;
12681268

1269-
c1=cmp_bounds(&cmp_func,prel->attcollid,start,&ranges[i].max);
1270-
c2=cmp_bounds(&cmp_func,prel->attcollid,end,&ranges[i].min);
1269+
c1=cmp_bounds(&cmp_func,prel->ev_collid,start,&ranges[i].max);
1270+
c2=cmp_bounds(&cmp_func,prel->ev_collid,end,&ranges[i].min);
12711271

12721272
/* There's something! */
12731273
if (c1<0&&c2>0)

‎src/partition_filter.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,10 @@ find_partitions_for_value(Datum value, Oid value_type,
396396
temp_const.constisnull= false;
397397

398398
/* ... and some other important data */
399-
CopyToTempConst(consttypmod,atttypmod);
400-
CopyToTempConst(constcollid,attcollid);
401-
CopyToTempConst(constlen,attlen);
402-
CopyToTempConst(constbyval,attbyval);
399+
CopyToTempConst(consttypmod,ev_typmod);
400+
CopyToTempConst(constcollid,ev_collid);
401+
CopyToTempConst(constlen,ev_len);
402+
CopyToTempConst(constbyval,ev_byval);
403403

404404
/* We use 0 since varno doesn't matter for Const */
405405
InitWalkerContext(&wcxt,0,prel,NULL, true);
@@ -431,7 +431,7 @@ select_partition_for_insert(Datum value, Oid value_type,
431431
elseif (nparts==0)
432432
{
433433
selected_partid=create_partitions_for_value(PrelParentRelid(prel),
434-
value,prel->atttype);
434+
value,prel->ev_type);
435435

436436
/* get_pathman_relation_info() will refresh this entry */
437437
invalidate_pathman_relation_info(PrelParentRelid(prel),NULL);
@@ -446,7 +446,7 @@ select_partition_for_insert(Datum value, Oid value_type,
446446
/* Could not find suitable partition */
447447
if (rri_holder==NULL)
448448
elog(ERROR,ERR_PART_ATTR_NO_PART,
449-
datum_to_cstring(value,prel->atttype));
449+
datum_to_cstring(value,prel->ev_type));
450450

451451
returnrri_holder;
452452
}
@@ -630,7 +630,7 @@ partition_filter_exec(CustomScanState *node)
630630
elog(ERROR,ERR_PART_ATTR_MULTIPLE_RESULTS);
631631

632632
/* Search for a matching partition */
633-
rri_holder=select_partition_for_insert(value,prel->atttype,prel,
633+
rri_holder=select_partition_for_insert(value,prel->ev_type,prel,
634634
&state->result_parts,estate);
635635

636636
/* Switch back and clean up per-tuple context */

‎src/pg_pathman.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,11 @@ handle_const(const Const *c, WalkerContext *context)
740740
boolcast_success;
741741

742742
/* Peform type cast if types mismatch */
743-
if (prel->atttype!=c->consttype)
743+
if (prel->ev_type!=c->consttype)
744744
{
745745
value=perform_type_cast(c->constvalue,
746746
getBaseType(c->consttype),
747-
getBaseType(prel->atttype),
747+
getBaseType(prel->ev_type),
748748
&cast_success);
749749

750750
if (!cast_success)
@@ -770,14 +770,14 @@ handle_const(const Const *c, WalkerContext *context)
770770

771771
fill_type_cmp_fmgr_info(&cmp_finfo,
772772
getBaseType(c->consttype),
773-
getBaseType(prel->atttype));
773+
getBaseType(prel->ev_type));
774774

775775
select_range_partitions(c->constvalue,
776776
&cmp_finfo,
777777
PrelGetRangesArray(context->prel),
778778
PrelChildrenCount(context->prel),
779779
strategy,
780-
prel->attcollid,
780+
prel->ev_collid,
781781
result);/* output */
782782

783783
result->paramsel=estimate_paramsel_using_prel(prel,strategy);
@@ -1042,7 +1042,7 @@ handle_binary_opexpr(WalkerContext *context, WrapperNode *result,
10421042
return;
10431043
}
10441044

1045-
tce=lookup_type_cache(prel->atttype,TYPECACHE_BTREE_OPFAMILY);
1045+
tce=lookup_type_cache(prel->ev_type,TYPECACHE_BTREE_OPFAMILY);
10461046
strategy=get_op_opfamily_strategy(expr->opno,tce->btree_opf);
10471047

10481048
/* There's no strategy for this operator, go to end */
@@ -1077,17 +1077,17 @@ handle_binary_opexpr(WalkerContext *context, WrapperNode *result,
10771077
* if operator collation is different from default attribute collation.
10781078
* In this case we just return all of them.
10791079
*/
1080-
if (expr->opcollid!=prel->attcollid&&
1080+
if (expr->opcollid!=prel->ev_collid&&
10811081
strategy!=BTEqualStrategyNumber)
10821082
gotobinary_opexpr_return;
10831083

10841084
collid=OidIsValid(expr->opcollid) ?
10851085
expr->opcollid :
1086-
prel->attcollid;
1086+
prel->ev_collid;
10871087

10881088
fill_type_cmp_fmgr_info(&cmp_func,
10891089
getBaseType(c->consttype),
1090-
getBaseType(prel->atttype));
1090+
getBaseType(prel->ev_type));
10911091

10921092
select_range_partitions(c->constvalue,
10931093
&cmp_func,
@@ -1122,7 +1122,7 @@ handle_binary_opexpr_param(const PartRelationInfo *prel,
11221122
intstrategy;
11231123

11241124
/* Determine operator type */
1125-
tce=lookup_type_cache(prel->atttype,TYPECACHE_BTREE_OPFAMILY);
1125+
tce=lookup_type_cache(prel->ev_type,TYPECACHE_BTREE_OPFAMILY);
11261126
strategy=get_op_opfamily_strategy(expr->opno,tce->btree_opf);
11271127

11281128
result->rangeset=list_make1_irange_full(prel,IR_LOSSY);

‎src/pl_funcs.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ get_partition_key_type(PG_FUNCTION_ARGS)
186186
prel=get_pathman_relation_info(relid);
187187
shout_if_prel_is_invalid(relid,prel,PT_ANY);
188188

189-
PG_RETURN_OID(prel->atttype);
189+
PG_RETURN_OID(prel->ev_type);
190190
}
191191

192192
/*
@@ -486,7 +486,7 @@ show_partition_list_internal(PG_FUNCTION_ARGS)
486486
{
487487
Datumrmin=CStringGetTextDatum(
488488
datum_to_cstring(BoundGetValue(&re->min),
489-
prel->atttype));
489+
prel->ev_type));
490490

491491
values[Anum_pathman_pl_range_min-1]=rmin;
492492
}
@@ -497,7 +497,7 @@ show_partition_list_internal(PG_FUNCTION_ARGS)
497497
{
498498
Datumrmax=CStringGetTextDatum(
499499
datum_to_cstring(BoundGetValue(&re->max),
500-
prel->atttype));
500+
prel->ev_type));
501501

502502
values[Anum_pathman_pl_range_max-1]=rmax;
503503
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp