Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
23c30246
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
23c30246
编写于
2月 21, 1999
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pathkeys.c cleanup.
上级
9d197856
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
48 addition
and
68 deletion
+48
-68
src/backend/nodes/print.c
src/backend/nodes/print.c
+2
-2
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinpath.c
+9
-7
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/pathkeys.c
+33
-56
src/include/optimizer/paths.h
src/include/optimizer/paths.h
+4
-3
未找到文件。
src/backend/nodes/print.c
浏览文件 @
23c30246
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.2
3 1999/02/20 19:02:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.2
4 1999/02/21 01:55:01
momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -223,7 +223,7 @@ print_pathkeys(List *pathkeys, List *rtable)
printf
(
"("
);
foreach
(
i
,
pathkeys
)
{
List
pathkey
=
lfirst
(
i
)
)
;
List
pathkey
=
lfirst
(
i
);
printf
(
"("
);
foreach
(
k
,
pathkey
)
...
...
src/backend/optimizer/path/joinpath.c
浏览文件 @
23c30246
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.3
0 1999/02/19 05:18:04
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.3
1 1999/02/21 01:55:02
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -309,10 +309,11 @@ match_unsorted_outer(RelOptInfo *joinrel,
{
List
*
jmkeys
=
xmergeinfo
->
jmethod
.
jmkeys
;
matchedJoinKeys
=
order_joinkeys_by_pathkeys
(
outerpath
->
pathkeys
,
order_joinkeys_by_pathkeys
(
outerpath
->
pathkeys
,
jmkeys
,
clauses
,
OUTER
,
&
matchedJoinKeys
,
&
matchedJoinClauses
);
merge_pathkeys
=
new_join_pathkeys
(
outerpath
->
pathkeys
,
joinrel
->
targetlist
,
clauses
);
...
...
@@ -449,10 +450,11 @@ match_unsorted_inner(RelOptInfo *joinrel,
{
List
*
jmkeys
=
xmergeinfo
->
jmethod
.
jmkeys
;
matchedJoinKeys
=
order_joinkeys_by_pathkeys
(
innerpath
->
pathkeys
,
order_joinkeys_by_pathkeys
(
innerpath
->
pathkeys
,
jmkeys
,
clauses
,
INNER
,
&
matchedJoinKeys
,
&
matchedJoinClauses
);
}
...
...
src/backend/optimizer/path/pathkeys.c
浏览文件 @
23c30246
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.
5 1999/02/20 19:02:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.
6 1999/02/21 01:55:02
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -27,8 +27,6 @@
static
int
match_pathkey_joinkeys
(
List
*
pathkey
,
List
*
joinkeys
,
int
outer_or_inner
);
static
bool
joinkeys_pathkeys_match
(
List
*
joinkeys
,
List
*
pathkey
,
int
outer_or_inner
);
static
List
*
new_join_pathkey
(
List
*
subkeys
,
List
*
considered_subkeys
,
List
*
join_rel_tlist
,
List
*
joinclauses
);
static
List
*
new_matching_subkeys
(
Var
*
subkey
,
List
*
considered_subkeys
,
...
...
@@ -94,19 +92,20 @@ static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
* Returns the join keys and corresponding join clauses in a list if all
* of the path keys were matched:
* (
* ( (outerkey0 innerkey0) ... (outerkeyN innerkeyN) )
* ( (outerkey0 innerkey0) ... (outerkeyN
or
innerkeyN) )
* ( clause0 ... clauseN )
* )
* and nil otherwise.
*
* Returns a list of matched join keys and a list of matched join clauses
* in
matchedJoinClausesPtr. - ay 11/94
* in
pointers if valid order can be found.
*/
List
*
bool
order_joinkeys_by_pathkeys
(
List
*
pathkeys
,
List
*
joinkeys
,
List
*
joinclauses
,
int
outer_or_inner
,
List
**
matchedJoinKeysPtr
,
List
**
matchedJoinClausesPtr
)
{
List
*
matched_joinkeys
=
NIL
;
...
...
@@ -114,7 +113,7 @@ order_joinkeys_by_pathkeys(List *pathkeys,
List
*
pathkey
=
NIL
;
List
*
i
=
NIL
;
int
matched_joinkey_index
=
-
1
;
int
matched_keys
=
0
;
/*
* Reorder the joinkeys by picking out one that matches each pathkey,
* and create a new joinkey/joinclause list in pathkey order
...
...
@@ -127,12 +126,20 @@ order_joinkeys_by_pathkeys(List *pathkeys,
if
(
matched_joinkey_index
!=
-
1
)
{
List
*
xjoinkey
=
nth
(
matched_joinkey_index
,
joinkeys
);
List
*
joinclause
=
nth
(
matched_joinkey_index
,
joinclauses
);
matched_keys
++
;
if
(
matchedJoinKeysPtr
)
{
JoinKey
*
joinkey
=
nth
(
matched_joinkey_index
,
joinkeys
);
matched_joinkeys
=
lappend
(
matched_joinkeys
,
joinkey
);
}
matched_joinkeys
=
lappend
(
matched_joinkeys
,
xjoinkey
);
if
(
matchedJoinClausesPtr
&&
joinclauses
)
{
Expr
*
joinclause
=
nth
(
matched_joinkey_index
,
joinclauses
);
matched_joinclauses
=
lappend
(
matched_joinclauses
,
joinclause
);
}
}
else
/* A pathkey could not be matched. */
break
;
...
...
@@ -142,14 +149,20 @@ order_joinkeys_by_pathkeys(List *pathkeys,
* Did we fail to match all the joinkeys?
* Extra pathkeys are no problem.
*/
if
(
length
(
joinkeys
)
!=
length
(
matched_
joinkeys
))
if
(
matched_keys
!=
length
(
joinkeys
))
{
if
(
matchedJoinKeysPtr
)
*
matchedJoinKeysPtr
=
NIL
;
if
(
matchedJoinClausesPtr
)
*
matchedJoinClausesPtr
=
NIL
;
return
NIL
;
return
false
;
}
if
(
matchedJoinKeysPtr
)
*
matchedJoinKeysPtr
=
matched_joinkeys
;
if
(
matchedJoinClausesPtr
)
*
matchedJoinClausesPtr
=
matched_joinclauses
;
return
matched_joinkeys
;
return
true
;
}
...
...
@@ -221,8 +234,8 @@ get_cheapest_path_for_joinkeys(List *joinkeys,
Path
*
path
=
(
Path
*
)
lfirst
(
i
);
int
better_sort
,
better_key
;
if
(
joinkeys_pathkeys_match
(
joinkeys
,
path
->
pathkeys
,
outer_or_inner
)
&&
length
(
joinkeys
)
==
length
(
path
->
pathkeys
)
&&
if
(
order_joinkeys_by_pathkeys
(
path
->
pathkeys
,
joinkeys
,
NIL
,
outer_or_inner
,
NULL
,
NULL
)
&&
pathorder_match
(
ordering
,
path
->
pathorder
,
&
better_sort
)
&&
better_sort
==
0
)
{
...
...
@@ -291,42 +304,6 @@ extract_path_keys(List *joinkeys,
}
/*
* joinkeys_pathkeys_match
*/
static
bool
joinkeys_pathkeys_match
(
List
*
joinkeys
,
List
*
pathkey
,
int
outer_or_inner
)
{
JoinKey
*
xjoinkey
;
Var
*
temp
;
Var
*
tempkey
=
NULL
;
bool
found
=
false
;
List
*
i
=
NIL
;
List
*
j
=
NIL
;
foreach
(
i
,
joinkeys
)
{
xjoinkey
=
(
JoinKey
*
)
lfirst
(
i
);
found
=
false
;
foreach
(
j
,
pathkey
)
{
temp
=
(
Var
*
)
lfirst
((
List
*
)
lfirst
(
j
));
if
(
temp
==
NULL
)
continue
;
tempkey
=
extract_join_key
(
xjoinkey
,
outer_or_inner
);
if
(
var_equal
(
tempkey
,
temp
))
{
found
=
true
;
break
;
}
}
if
(
found
==
false
)
return
false
;
}
return
found
;
}
/****************************************************************************
* NEW PATHKEY FORMATION
****************************************************************************/
...
...
src/include/optimizer/paths.h
浏览文件 @
23c30246
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.2
4 1999/02/19 05:18:06
momjian Exp $
* $Id: paths.h,v 1.2
5 1999/02/21 01:55:03
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -54,8 +54,9 @@ extern List *group_clauses_by_hashop(List *restrictinfo_list,
* joinutils.h
* generic join method key/clause routines
*/
extern
List
*
order_joinkeys_by_pathkeys
(
List
*
pathkeys
,
extern
bool
order_joinkeys_by_pathkeys
(
List
*
pathkeys
,
List
*
joinkeys
,
List
*
joinclauses
,
int
outer_or_inner
,
List
**
matchedJoinKeysPtr
,
List
**
matchedJoinClausesPtr
);
extern
List
*
extract_path_keys
(
List
*
joinkeys
,
List
*
tlist
,
int
outer_or_inner
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录