@@ -88,49 +88,15 @@ extern Oid pathman_config_params_relid;
88
88
Oid get_pathman_config_relid (bool invalid_is_ok );
89
89
Oid get_pathman_config_params_relid (bool invalid_is_ok );
90
90
91
- /*
92
- * pg_pathman's global state structure.
93
- */
94
- typedef struct PathmanState
95
- {
96
- LWLock * dsm_init_lock ; /* unused */
97
- } PathmanState ;
98
-
99
-
100
- /*
101
- * Result of search_range_partition_eq().
102
- */
103
- typedef enum
104
- {
105
- SEARCH_RANGEREL_OUT_OF_RANGE = 0 ,
106
- SEARCH_RANGEREL_GAP ,
107
- SEARCH_RANGEREL_FOUND
108
- } search_rangerel_result ;
109
-
110
-
111
- /*
112
- * pg_pathman's global state.
113
- */
114
- extern PathmanState * pmstate ;
115
-
116
-
117
- int append_child_relation (PlannerInfo * root , Relation parent_relation ,
118
- Index parent_rti , int ir_index , Oid child_oid ,
119
- List * wrappers );
120
-
121
- search_rangerel_result search_range_partition_eq (const Datum value ,
122
- FmgrInfo * cmp_func ,
123
- const PartRelationInfo * prel ,
124
- RangeEntry * out_re );
125
91
126
- uint32 hash_to_part_index (uint32 value , uint32 partitions );
127
-
128
- /* copied from allpaths.h */
129
- void set_append_rel_size (PlannerInfo * root , RelOptInfo * rel ,
130
- Index rti , RangeTblEntry * rte );
131
92
void set_append_rel_pathlist (PlannerInfo * root , RelOptInfo * rel , Index rti ,
132
93
PathKey * pathkeyAsc , PathKey * pathkeyDesc );
133
94
95
+ Index append_child_relation (PlannerInfo * root , Relation parent_relation ,
96
+ Index parent_rti , int ir_index , Oid child_oid ,
97
+ List * wrappers );
98
+
99
+
134
100
typedef struct
135
101
{
136
102
const Node * orig ; /* examined expression */
@@ -148,9 +114,7 @@ typedef struct
148
114
bool for_insert ; /* are we in PartitionFilter now? */
149
115
} WalkerContext ;
150
116
151
- /*
152
- * Usual initialization procedure for WalkerContext.
153
- */
117
+ /* Usual initialization procedure for WalkerContext */
154
118
#define InitWalkerContext (context , prel_vno , prel_info , ecxt , for_ins ) \
155
119
do { \
156
120
(context)->prel_varno = (prel_vno); \
@@ -162,15 +126,37 @@ typedef struct
162
126
/* Check that WalkerContext contains ExprContext (plan execution stage) */
163
127
#define WcxtHasExprContext (wcxt ) ( (wcxt)->econtext )
164
128
129
+ /* Examine expression in order to select partitions */
130
+ WrapperNode * walk_expr_tree (Expr * expr , WalkerContext * context );
131
+
132
+
165
133
void select_range_partitions (const Datum value ,
166
134
FmgrInfo * cmp_func ,
167
135
const RangeEntry * ranges ,
168
136
const int nranges ,
169
137
const int strategy ,
170
138
WrapperNode * result );
171
139
172
- /* Examine expression in order to select partitions. */
173
- WrapperNode * walk_expr_tree (Expr * expr , WalkerContext * context );
140
+ /* Result of search_range_partition_eq() */
141
+ typedef enum
142
+ {
143
+ SEARCH_RANGEREL_OUT_OF_RANGE = 0 ,
144
+ SEARCH_RANGEREL_GAP ,
145
+ SEARCH_RANGEREL_FOUND
146
+ } search_rangerel_result ;
147
+
148
+ search_rangerel_result search_range_partition_eq (const Datum value ,
149
+ FmgrInfo * cmp_func ,
150
+ const PartRelationInfo * prel ,
151
+ RangeEntry * out_re );
152
+
153
+
154
+ /* Convert hash value to the partition index */
155
+ static inline uint32
156
+ hash_to_part_index (uint32 value , uint32 partitions )
157
+ {
158
+ return value % partitions ;
159
+ }
174
160
175
161
176
162
/*
0 commit comments