Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
be4bebc0
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,发现更多精彩内容 >>
提交
be4bebc0
编写于
9月 03, 2017
作者:
H
Heikki Linnakangas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename hasWindFuncs fields in Query and ParseState, to match upstream.
上级
52fdcd7c
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
39 addition
and
39 deletion
+39
-39
src/backend/catalog/heap.c
src/backend/catalog/heap.c
+2
-2
src/backend/commands/functioncmds.c
src/backend/commands/functioncmds.c
+1
-1
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+1
-1
src/backend/commands/typecmds.c
src/backend/commands/typecmds.c
+1
-1
src/backend/gpopt/translate/CQueryMutators.cpp
src/backend/gpopt/translate/CQueryMutators.cpp
+3
-3
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+1
-1
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+1
-1
src/backend/nodes/outfast.c
src/backend/nodes/outfast.c
+1
-1
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+1
-1
src/backend/nodes/readfast.c
src/backend/nodes/readfast.c
+1
-1
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+1
-1
src/backend/optimizer/plan/planwindow.c
src/backend/optimizer/plan/planwindow.c
+4
-4
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepjointree.c
+1
-1
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+12
-12
src/backend/parser/parse_agg.c
src/backend/parser/parse_agg.c
+3
-3
src/backend/parser/parse_clause.c
src/backend/parser/parse_clause.c
+2
-2
src/backend/parser/parse_utilcmd.c
src/backend/parser/parse_utilcmd.c
+1
-1
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+1
-1
src/include/parser/parse_node.h
src/include/parser/parse_node.h
+1
-1
未找到文件。
src/backend/catalog/heap.c
浏览文件 @
be4bebc0
...
...
@@ -2973,7 +2973,7 @@ cookConstraint (ParseState *pstate,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in check constraint"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"cannot use window function in check constraint"
)));
...
...
@@ -3082,7 +3082,7 @@ cookDefault(ParseState *pstate,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in default expression"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"cannot use window function in default expression"
)));
...
...
src/backend/commands/functioncmds.c
浏览文件 @
be4bebc0
...
...
@@ -376,7 +376,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in parameter default value"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_WINDOWING_ERROR
),
errmsg
(
"cannot use window function in parameter default value"
)));
...
...
src/backend/commands/tablecmds.c
浏览文件 @
be4bebc0
...
...
@@ -8131,7 +8131,7 @@ ATPrepAlterColumnType(List **wqueue,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in transform expression"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"cannot use window function in transform expression"
)));
...
...
src/backend/commands/typecmds.c
浏览文件 @
be4bebc0
...
...
@@ -2300,7 +2300,7 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in check constraint"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"cannot use window function in check constraint"
)));
...
...
src/backend/gpopt/translate/CQueryMutators.cpp
浏览文件 @
be4bebc0
...
...
@@ -1280,7 +1280,7 @@ CQueryMutators::PqueryNormalizeHaving
pqueryNewSubquery
->
targetList
=
NIL
;
pqueryNewSubquery
->
hasAggs
=
false
;
pqueryNewSubquery
->
hasWindFuncs
=
false
;
pqueryNewSubquery
->
hasWind
ow
Funcs
=
false
;
pqueryNewSubquery
->
hasSubLinks
=
false
;
ListCell
*
plc
=
NULL
;
...
...
@@ -1595,7 +1595,7 @@ CQueryMutators::FNeedsWindowPrLNormalization
const
Query
*
pquery
)
{
if
(
!
pquery
->
hasWindFuncs
)
if
(
!
pquery
->
hasWind
ow
Funcs
)
{
return
false
;
}
...
...
@@ -1759,7 +1759,7 @@ CQueryMutators::PqueryNormalizeWindowPrL
GPOS_ASSERT
(
gpdb
::
UlListLength
(
pqueryNew
->
targetList
)
<=
gpdb
::
UlListLength
(
pquery
->
targetList
));
pqueryNew
->
hasWindFuncs
=
false
;
pqueryNew
->
hasWind
ow
Funcs
=
false
;
ReassignSortClause
(
pqueryNew
,
pqueryDrdTbl
);
return
pqueryNew
;
...
...
src/backend/nodes/copyfuncs.c
浏览文件 @
be4bebc0
...
...
@@ -2826,7 +2826,7 @@ _copyQuery(Query *from)
COPY_SCALAR_FIELD
(
resultRelation
);
COPY_NODE_FIELD
(
intoClause
);
COPY_SCALAR_FIELD
(
hasAggs
);
COPY_SCALAR_FIELD
(
hasWindFuncs
);
COPY_SCALAR_FIELD
(
hasWind
ow
Funcs
);
COPY_SCALAR_FIELD
(
hasSubLinks
);
COPY_SCALAR_FIELD
(
hasDynamicFunctions
);
COPY_NODE_FIELD
(
rtable
);
...
...
src/backend/nodes/equalfuncs.c
浏览文件 @
be4bebc0
...
...
@@ -840,7 +840,7 @@ _equalQuery(Query *a, Query *b)
COMPARE_SCALAR_FIELD
(
resultRelation
);
COMPARE_NODE_FIELD
(
intoClause
);
COMPARE_SCALAR_FIELD
(
hasAggs
);
COMPARE_SCALAR_FIELD
(
hasWindFuncs
);
COMPARE_SCALAR_FIELD
(
hasWind
ow
Funcs
);
COMPARE_SCALAR_FIELD
(
hasSubLinks
);
COMPARE_SCALAR_FIELD
(
hasDynamicFunctions
);
COMPARE_NODE_FIELD
(
rtable
);
...
...
src/backend/nodes/outfast.c
浏览文件 @
be4bebc0
...
...
@@ -894,7 +894,7 @@ _outQuery(StringInfo str, Query *node)
WRITE_INT_FIELD
(
resultRelation
);
WRITE_NODE_FIELD
(
intoClause
);
WRITE_BOOL_FIELD
(
hasAggs
);
WRITE_BOOL_FIELD
(
hasWindFuncs
);
WRITE_BOOL_FIELD
(
hasWind
ow
Funcs
);
WRITE_BOOL_FIELD
(
hasSubLinks
);
WRITE_BOOL_FIELD
(
hasDynamicFunctions
);
WRITE_NODE_FIELD
(
rtable
);
...
...
src/backend/nodes/outfuncs.c
浏览文件 @
be4bebc0
...
...
@@ -3493,7 +3493,7 @@ _outQuery(StringInfo str, Query *node)
WRITE_INT_FIELD
(
resultRelation
);
WRITE_NODE_FIELD
(
intoClause
);
WRITE_BOOL_FIELD
(
hasAggs
);
WRITE_BOOL_FIELD
(
hasWindFuncs
);
WRITE_BOOL_FIELD
(
hasWind
ow
Funcs
);
WRITE_BOOL_FIELD
(
hasSubLinks
);
WRITE_BOOL_FIELD
(
hasDynamicFunctions
);
WRITE_NODE_FIELD
(
rtable
);
...
...
src/backend/nodes/readfast.c
浏览文件 @
be4bebc0
...
...
@@ -228,7 +228,7 @@ _readQuery(void)
READ_INT_FIELD
(
resultRelation
);
READ_NODE_FIELD
(
intoClause
);
READ_BOOL_FIELD
(
hasAggs
);
READ_BOOL_FIELD
(
hasWindFuncs
);
READ_BOOL_FIELD
(
hasWind
ow
Funcs
);
READ_BOOL_FIELD
(
hasSubLinks
);
READ_BOOL_FIELD
(
hasDynamicFunctions
);
READ_NODE_FIELD
(
rtable
);
...
...
src/backend/nodes/readfuncs.c
浏览文件 @
be4bebc0
...
...
@@ -322,7 +322,7 @@ _readQuery(void)
READ_INT_FIELD
(
resultRelation
);
READ_NODE_FIELD
(
intoClause
);
READ_BOOL_FIELD
(
hasAggs
);
READ_BOOL_FIELD
(
hasWindFuncs
);
READ_BOOL_FIELD
(
hasWind
ow
Funcs
);
READ_BOOL_FIELD
(
hasSubLinks
);
READ_BOOL_FIELD
(
hasDynamicFunctions
);
READ_NODE_FIELD
(
rtable
);
...
...
src/backend/optimizer/plan/planwindow.c
浏览文件 @
be4bebc0
...
...
@@ -296,7 +296,7 @@ window_planner(PlannerInfo *root, double tuple_fraction, List **pathkeys_ptr)
/* Assert existence of windowing in query. */
Assert
(
parse
->
targetList
!=
NIL
);
Assert
(
parse
->
windowClause
!=
NULL
);
Assert
(
parse
->
hasWind
Funcs
);
Assert
(
parse
->
hasWind
owFuncs
);
/* Assert no unsupported stuff */
Assert
(
parse
->
setOperations
==
NULL
);
Assert
(
!
parse
->
hasAggs
);
...
...
@@ -1303,7 +1303,7 @@ make_lower_targetlist(Query *parse,
SortClause
*
dummy
;
ListCell
*
lc
;
Assert
(
parse
->
hasWindFuncs
);
Assert
(
parse
->
hasWind
ow
Funcs
);
/* Start with a "flattened" tlist (having just the vars mentioned in
* the targetlist or the window clause --- but no upper-level Vars;
...
...
@@ -3958,7 +3958,7 @@ Plan *wrap_plan(PlannerInfo *root, Plan *plan, Query *query,
subquery->resultRelation = 0;
subquery->intoClause = NULL;
subquery->hasAggs = false;
subquery->hasWindFuncs = false;
subquery->hasWind
ow
Funcs = false;
subquery->hasSubLinks = false;
subquery->returningList = NIL;
subquery->groupClause = NIL;
...
...
@@ -4084,7 +4084,7 @@ Query *copy_common_subquery(Query *original, List *targetList)
common
->
resultRelation
=
0
;
common
->
utilityStmt
=
NULL
;
common
->
intoClause
=
NULL
;
common
->
hasWindFuncs
=
false
;
common
->
hasWind
ow
Funcs
=
false
;
common
->
hasSubLinks
=
false
;
/* XXX */
common
->
returningList
=
NIL
;
common
->
distinctClause
=
NIL
;
...
...
src/backend/optimizer/prep/prepjointree.c
浏览文件 @
be4bebc0
...
...
@@ -716,7 +716,7 @@ is_simple_subquery(PlannerInfo *root, Query *subquery)
* limiting, or WITH. (XXX WITH could possibly be allowed later)
*/
if
(
subquery
->
hasAggs
||
subquery
->
hasWindFuncs
||
subquery
->
hasWind
ow
Funcs
||
subquery
->
groupClause
||
subquery
->
havingQual
||
subquery
->
windowClause
||
...
...
src/backend/parser/analyze.c
浏览文件 @
be4bebc0
...
...
@@ -809,7 +809,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
errmsg
(
"cannot use aggregate function in VALUES"
),
parser_errposition
(
pstate
,
locate_agg_of_level
((
Node
*
)
qry
,
0
))));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_WINDOWING_ERROR
),
errmsg
(
"cannot use window function in VALUES"
)));
...
...
@@ -918,7 +918,7 @@ transformGroupedWindows(Query *qry)
Assert
(
!
PointerIsValid
(
qry
->
utilityStmt
));
Assert
(
qry
->
returningList
==
NIL
);
if
(
!
qry
->
hasWindFuncs
||
!
(
qry
->
groupClause
||
qry
->
hasAggs
)
)
if
(
!
qry
->
hasWind
ow
Funcs
||
!
(
qry
->
groupClause
||
qry
->
hasAggs
)
)
return
qry
;
/* Make the new subquery (Q''). Note that (per SQL:2003) there
...
...
@@ -933,7 +933,7 @@ transformGroupedWindows(Query *qry)
subq
->
resultRelation
=
0
;
subq
->
intoClause
=
NULL
;
subq
->
hasAggs
=
qry
->
hasAggs
;
subq
->
hasWindFuncs
=
false
;
/* reevaluate later */
subq
->
hasWind
ow
Funcs
=
false
;
/* reevaluate later */
subq
->
hasSubLinks
=
qry
->
hasSubLinks
;
/* reevaluate later */
/* Core of subquery input table expression: */
...
...
@@ -953,10 +953,10 @@ transformGroupedWindows(Query *qry)
subq
->
setOperations
=
NULL
;
/* Check if there is a window function in the join tree. If so
* we must mark hasWindFuncs in the sub query as well.
* we must mark hasWind
ow
Funcs in the sub query as well.
*/
if
(
checkExprHasWindFuncs
((
Node
*
)
subq
->
jointree
))
subq
->
hasWindFuncs
=
true
;
subq
->
hasWind
ow
Funcs
=
true
;
/* Make the single range table entry for the outer query Q' as
* a wrapper for the subquery (Q'') currently under construction.
...
...
@@ -1652,8 +1652,8 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
if
(
pstate
->
p_hasTblValueExpr
)
parseCheckTableFunctions
(
pstate
,
qry
);
qry
->
hasWind
Funcs
=
pstate
->
p_hasWind
Funcs
;
if
(
pstate
->
p_hasWindFuncs
)
qry
->
hasWind
owFuncs
=
pstate
->
p_hasWindow
Funcs
;
if
(
pstate
->
p_hasWind
ow
Funcs
)
parseProcessWindFuncs
(
pstate
,
qry
);
...
...
@@ -1666,7 +1666,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
* If the query mixes window functions and aggregates, we need to
* transform it such that the grouped query appears as a subquery
*/
if
(
qry
->
hasWindFuncs
&&
(
qry
->
groupClause
||
qry
->
hasAggs
))
if
(
qry
->
hasWind
ow
Funcs
&&
(
qry
->
groupClause
||
qry
->
hasAggs
))
transformGroupedWindows
(
qry
);
return
qry
;
...
...
@@ -1882,7 +1882,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
errmsg
(
"cannot use aggregate function in VALUES"
),
parser_errposition
(
pstate
,
locate_agg_of_level
((
Node
*
)
newExprsLists
,
0
))));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_WINDOWING_ERROR
),
errmsg
(
"cannot use window function in VALUES"
)));
...
...
@@ -2744,7 +2744,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
errmsg
(
"cannot use aggregate function in UPDATE"
),
parser_errposition
(
pstate
,
locate_agg_of_level
((
Node
*
)
qry
,
0
))));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_WINDOWING_ERROR
),
errmsg
(
"cannot use window function in UPDATE"
)));
...
...
@@ -2853,7 +2853,7 @@ transformReturningList(ParseState *pstate, List *returningList)
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in RETURNING"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"cannot use window function in RETURNING"
)));
...
...
@@ -3044,7 +3044,7 @@ CheckSelectLocking(Query *qry)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE/SHARE is not allowed with aggregate functions"
)));
if
(
qry
->
hasWindFuncs
)
if
(
qry
->
hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE/SHARE is not allowed with window functions"
)));
...
...
src/backend/parser/parse_agg.c
浏览文件 @
be4bebc0
...
...
@@ -121,7 +121,7 @@ check_call(ParseState *pstate, Node *call)
if
(
is_agg
)
pstate
->
p_hasAggs
=
true
;
else
pstate
->
p_hasWindFuncs
=
true
;
pstate
->
p_hasWind
ow
Funcs
=
true
;
}
/*
...
...
@@ -212,7 +212,7 @@ transformWindowFuncCall(ParseState *pstate, WindowRef *wind,
check_call
(
pstate
,
(
Node
*
)
wind
);
pstate
->
p_hasWindFuncs
=
true
;
pstate
->
p_hasWind
ow
Funcs
=
true
;
}
/*
...
...
@@ -995,7 +995,7 @@ void
parseProcessWindFuncs
(
ParseState
*
pstate
,
Query
*
qry
)
{
/* This should only be called if we found window functions */
Assert
(
pstate
->
p_hasWindFuncs
);
Assert
(
pstate
->
p_hasWind
ow
Funcs
);
/*
* Window functions must never appear in WHERE or
...
...
src/backend/parser/parse_clause.c
浏览文件 @
be4bebc0
...
...
@@ -708,7 +708,7 @@ transformWindowClause(ParseState *pstate, Query *qry)
/* If there are no window functions in the targetlist,
* forget the window clause.
*/
if
(
!
pstate
->
p_hasWindFuncs
)
if
(
!
pstate
->
p_hasWind
ow
Funcs
)
{
pstate
->
p_win_clauses
=
NIL
;
qry
->
windowClause
=
NIL
;
...
...
@@ -2851,7 +2851,7 @@ transformDistinctClause(ParseState *pstate, List *distinctlist,
{
/* We had SELECT DISTINCT */
if
(
!
pstate
->
p_hasAggs
&&
!
pstate
->
p_hasWindFuncs
&&
*
groupClause
==
NIL
)
if
(
!
pstate
->
p_hasAggs
&&
!
pstate
->
p_hasWind
ow
Funcs
&&
*
groupClause
==
NIL
)
{
/*
* MPP-15040
...
...
src/backend/parser/parse_utilcmd.c
浏览文件 @
be4bebc0
...
...
@@ -2803,7 +2803,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"cannot use aggregate function in rule WHERE condition"
)));
if
(
pstate
->
p_hasWindFuncs
)
if
(
pstate
->
p_hasWind
ow
Funcs
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"cannot use window function in rule WHERE condition"
)));
...
...
src/include/nodes/parsenodes.h
浏览文件 @
be4bebc0
...
...
@@ -120,7 +120,7 @@ typedef struct Query
IntoClause
*
intoClause
;
/* target for SELECT INTO / CREATE TABLE AS */
bool
hasAggs
;
/* has aggregates in tlist or havingQual */
bool
hasWind
Funcs
;
/* has window function(s) in target
list */
bool
hasWind
owFuncs
;
/* has window functions in t
list */
bool
hasSubLinks
;
/* has subquery SubLink */
bool
hasDynamicFunctions
;
/* has functions with unstable return types */
...
...
src/include/parser/parse_node.h
浏览文件 @
be4bebc0
...
...
@@ -84,7 +84,7 @@ typedef struct ParseState
Node
*
p_value_substitute
;
/* what to replace VALUE with, if any */
bool
p_variableparams
;
bool
p_hasAggs
;
bool
p_hasWindFuncs
;
bool
p_hasWind
ow
Funcs
;
bool
p_hasSubLinks
;
bool
p_hasModifyingCTE
;
bool
p_is_insert
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录