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

Commit1f02a08

Browse files
author
Daniil Anisimov
committed
Fix testing with WRITE_READ_PARSE_PLAN_TREES.
Change RestrictInfo to AQOClause.Add AQOConstNode to use it instead of useless nodes.Serialize/deserialize all AQOPlanNode and AQOConstNode fields.
1 parent9bcf5ba commit1f02a08

File tree

6 files changed

+401
-112
lines changed

6 files changed

+401
-112
lines changed

‎aqo_pg15.patch‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,19 @@ index 3f8e58626c..256c76acf2 100644
7676
WRITE_NODE_FIELD(initPlan);
7777
WRITE_BITMAPSET_FIELD(extParam);
7878
WRITE_BITMAPSET_FIELD(allParam);
79-
+/*WRITE_NODE_FIELD(ext_nodes); */
79+
+WRITE_NODE_FIELD(ext_nodes);
8080
}
8181

8282
/*
8383
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
8484
index c84e5af3a2..ae0e78b142 100644
8585
--- a/src/backend/nodes/readfuncs.c
8686
+++ b/src/backend/nodes/readfuncs.c
87-
@@ -1666,6 +1666,11 @@ ReadCommonPlan(Plan *local_node)
87+
@@ -1666,6 +1666,7 @@ ReadCommonPlan(Plan *local_node)
8888
READ_NODE_FIELD(initPlan);
8989
READ_BITMAPSET_FIELD(extParam);
9090
READ_BITMAPSET_FIELD(allParam);
91-
+local_node->ext_nodes = NIL;
92-
+/* READ_NODE_FIELD(ext_nodes);
93-
+ * Don't serialize this field. It is required to serialize RestrictInfo and
94-
+ * EqualenceClass.
95-
+*/
91+
+READ_NODE_FIELD(ext_nodes);
9692
}
9793

9894
/*

‎cardinality_hooks.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
187187

188188
forboth(l,allclauses,l2,selectivities)
189189
{
190-
current_hash=get_clause_hash(
191-
((RestrictInfo*)lfirst(l))->clause,
190+
current_hash=get_clause_hash(((AQOClause*)lfirst(l))->clause,
192191
nargs,args_hash,eclass_hash);
193192
cache_selectivity(current_hash,rel->relid,rte->relid,
194193
*((double*)lfirst(l2)));

‎hash.c‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include"aqo.h"
2929
#include"hash.h"
30+
#include"path_utils.h"
3031

3132
staticintget_str_hash(constchar*str);
3233
staticintget_node_hash(Node*node);
@@ -218,11 +219,11 @@ get_fss_for_object(List *relsigns, List *clauselist,
218219
i=0;
219220
foreach(lc,clauselist)
220221
{
221-
RestrictInfo*rinfo=lfirst_node(RestrictInfo,lc);
222+
AQOClause*clause=(AQOClause*)lfirst(lc);
222223

223-
clause_hashes[i]=get_clause_hash(rinfo->clause,
224+
clause_hashes[i]=get_clause_hash(clause->clause,
224225
nargs,args_hash,eclass_hash);
225-
args=get_clause_args_ptr(rinfo->clause);
226+
args=get_clause_args_ptr(clause->clause);
226227
clause_has_consts[i]= (args!=NULL&&has_consts(*args));
227228
i++;
228229
}
@@ -317,14 +318,14 @@ get_clause_hash(Expr *clause, int nargs, int *args_hash, int *eclass_hash)
317318

318319
cclause=copyObject(clause);
319320
args=get_clause_args_ptr(cclause);
321+
/* XXX: Why does it work even if this loop is removed? */
320322
foreach(l,*args)
321323
{
322324
arg_eclass=get_arg_eclass(get_node_hash(lfirst(l)),
323325
nargs,args_hash,eclass_hash);
324326
if (arg_eclass!=0)
325327
{
326-
lfirst(l)=makeNode(Param);
327-
((Param*)lfirst(l))->paramid=arg_eclass;
328+
lfirst(l)=create_aqo_const_node(AQO_NODE_EXPR,arg_eclass);
328329
}
329330
}
330331
if (!clause_is_eq_clause(clause)||has_consts(*args))
@@ -554,7 +555,7 @@ get_arg_eclass(int arg_hash, int nargs, int *args_hash, int *eclass_hash)
554555
staticvoid
555556
get_clauselist_args(List*clauselist,int*nargs,int**args_hash)
556557
{
557-
RestrictInfo*rinfo;
558+
AQOClause*clause;
558559
List**args;
559560
ListCell*l;
560561
ListCell*l2;
@@ -564,9 +565,9 @@ get_clauselist_args(List *clauselist, int *nargs, int **args_hash)
564565

565566
foreach(l,clauselist)
566567
{
567-
rinfo= (RestrictInfo*)lfirst(l);
568-
args=get_clause_args_ptr(rinfo->clause);
569-
if (args!=NULL&&clause_is_eq_clause(rinfo->clause))
568+
clause= (AQOClause*)lfirst(l);
569+
args=get_clause_args_ptr(clause->clause);
570+
if (args!=NULL&&clause_is_eq_clause(clause->clause))
570571
foreach(l2,*args)
571572
if (!IsA(lfirst(l2),Const))
572573
cnt++;
@@ -575,9 +576,9 @@ get_clauselist_args(List *clauselist, int *nargs, int **args_hash)
575576
*args_hash=palloc(cnt*sizeof(**args_hash));
576577
foreach(l,clauselist)
577578
{
578-
rinfo= (RestrictInfo*)lfirst(l);
579-
args=get_clause_args_ptr(rinfo->clause);
580-
if (args!=NULL&&clause_is_eq_clause(rinfo->clause))
579+
clause= (AQOClause*)lfirst(l);
580+
args=get_clause_args_ptr(clause->clause);
581+
if (args!=NULL&&clause_is_eq_clause(clause->clause))
581582
foreach(l2,*args)
582583
if (!IsA(lfirst(l2),Const))
583584
(*args_hash)[i++]=get_node_hash(lfirst(l2));
@@ -632,7 +633,7 @@ disjoint_set_merge_eclasses(int *p, int v1, int v2)
632633
staticint*
633634
perform_eclasses_join(List*clauselist,intnargs,int*args_hash)
634635
{
635-
RestrictInfo*rinfo;
636+
AQOClause*clause;
636637
int*p;
637638
ListCell*l,
638639
*l2;
@@ -646,9 +647,9 @@ perform_eclasses_join(List *clauselist, int nargs, int *args_hash)
646647

647648
foreach(l,clauselist)
648649
{
649-
rinfo= (RestrictInfo*)lfirst(l);
650-
args=get_clause_args_ptr(rinfo->clause);
651-
if (args!=NULL&&clause_is_eq_clause(rinfo->clause))
650+
clause= (AQOClause*)lfirst(l);
651+
args=get_clause_args_ptr(clause->clause);
652+
if (args!=NULL&&clause_is_eq_clause(clause->clause))
652653
{
653654
i3=-1;
654655
foreach(l2,*args)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp