Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4b02e36f
提交
4b02e36f
authored
9月 15, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add window stage flag to updateAggregate()
上级
4c2a4489
显示空白字符变更
内嵌
并排
正在显示
31 个修改的文件
包含
80 行增加
和
71 行删除
+80
-71
Query.java
h2/src/main/org/h2/command/dml/Query.java
+2
-1
Select.java
h2/src/main/org/h2/command/dml/Select.java
+9
-9
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+3
-3
Alias.java
h2/src/main/org/h2/expression/Alias.java
+2
-2
BinaryOperation.java
h2/src/main/org/h2/expression/BinaryOperation.java
+3
-3
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+4
-4
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+3
-3
ConditionAndOr.java
h2/src/main/org/h2/expression/ConditionAndOr.java
+3
-3
ConditionExists.java
h2/src/main/org/h2/expression/ConditionExists.java
+1
-1
ConditionIn.java
h2/src/main/org/h2/expression/ConditionIn.java
+3
-3
ConditionInConstantSet.java
h2/src/main/org/h2/expression/ConditionInConstantSet.java
+2
-2
ConditionInParameter.java
h2/src/main/org/h2/expression/ConditionInParameter.java
+2
-2
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+3
-3
ConditionNot.java
h2/src/main/org/h2/expression/ConditionNot.java
+2
-2
Expression.java
h2/src/main/org/h2/expression/Expression.java
+2
-1
ExpressionColumn.java
h2/src/main/org/h2/expression/ExpressionColumn.java
+1
-1
ExpressionList.java
h2/src/main/org/h2/expression/ExpressionList.java
+2
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-2
IntervalOperation.java
h2/src/main/org/h2/expression/IntervalOperation.java
+3
-3
JavaFunction.java
h2/src/main/org/h2/expression/JavaFunction.java
+2
-2
Parameter.java
h2/src/main/org/h2/expression/Parameter.java
+1
-1
Rownum.java
h2/src/main/org/h2/expression/Rownum.java
+1
-1
SequenceValue.java
h2/src/main/org/h2/expression/SequenceValue.java
+1
-1
Subquery.java
h2/src/main/org/h2/expression/Subquery.java
+2
-2
UnaryOperation.java
h2/src/main/org/h2/expression/UnaryOperation.java
+2
-2
ValueExpression.java
h2/src/main/org/h2/expression/ValueExpression.java
+1
-1
Variable.java
h2/src/main/org/h2/expression/Variable.java
+1
-1
Wildcard.java
h2/src/main/org/h2/expression/Wildcard.java
+1
-1
Aggregate.java
h2/src/main/org/h2/expression/aggregate/Aggregate.java
+6
-3
JavaAggregate.java
h2/src/main/org/h2/expression/aggregate/JavaAggregate.java
+6
-3
Window.java
h2/src/main/org/h2/expression/aggregate/Window.java
+4
-3
没有找到文件。
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
4b02e36f
...
...
@@ -276,8 +276,9 @@ public abstract class Query extends Prepared {
* Update all aggregate function values.
*
* @param s the session
* @param window true for window processing stage, false for group stage
*/
public
abstract
void
updateAggregate
(
Session
s
);
public
abstract
void
updateAggregate
(
Session
s
,
boolean
window
);
/**
* Call the before triggers on all tables.
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
4b02e36f
...
...
@@ -369,7 +369,7 @@ public class Select extends Query {
if
(
isConditionMet
())
{
rowNumber
++;
groupData
.
nextSource
();
updateAgg
(
columnCount
);
updateAgg
(
columnCount
,
true
);
if
(
sampleSize
>
0
&&
rowNumber
>=
sampleSize
)
{
break
;
}
...
...
@@ -398,7 +398,7 @@ public class Select extends Query {
if
(
isConditionMet
())
{
rowNumber
++;
groupData
.
nextSource
();
updateAgg
(
columnCount
);
updateAgg
(
columnCount
,
false
);
if
(
sampleSize
>
0
&&
rowNumber
>=
sampleSize
)
{
break
;
}
...
...
@@ -413,11 +413,11 @@ public class Select extends Query {
}
}
private
void
updateAgg
(
int
columnCount
)
{
private
void
updateAgg
(
int
columnCount
,
boolean
window
)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
if
(
groupByExpression
==
null
||
!
groupByExpression
[
i
])
{
Expression
expr
=
expressions
.
get
(
i
);
expr
.
updateAggregate
(
session
);
expr
.
updateAggregate
(
session
,
window
);
}
}
}
...
...
@@ -1482,15 +1482,15 @@ public class Select extends Query {
}
@Override
public
void
updateAggregate
(
Session
s
)
{
public
void
updateAggregate
(
Session
s
,
boolean
window
)
{
for
(
Expression
e
:
expressions
)
{
e
.
updateAggregate
(
s
);
e
.
updateAggregate
(
s
,
window
);
}
if
(
condition
!=
null
)
{
condition
.
updateAggregate
(
s
);
condition
.
updateAggregate
(
s
,
window
);
}
if
(
having
!=
null
)
{
having
.
updateAggregate
(
s
);
having
.
updateAggregate
(
s
,
window
);
}
}
...
...
@@ -1686,7 +1686,7 @@ public class Select extends Query {
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
if
(
groupByExpression
==
null
||
!
groupByExpression
[
i
])
{
Expression
expr
=
expressions
.
get
(
i
);
expr
.
updateAggregate
(
getSession
());
expr
.
updateAggregate
(
getSession
()
,
false
);
}
}
if
(
row
!=
null
)
{
...
...
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
4b02e36f
...
...
@@ -449,9 +449,9 @@ public class SelectUnion extends Query {
}
@Override
public
void
updateAggregate
(
Session
s
)
{
left
.
updateAggregate
(
s
);
right
.
updateAggregate
(
s
);
public
void
updateAggregate
(
Session
s
,
boolean
window
)
{
left
.
updateAggregate
(
s
,
window
);
right
.
updateAggregate
(
s
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/Alias.java
浏览文件 @
4b02e36f
...
...
@@ -83,8 +83,8 @@ public class Alias extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
expr
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
expr
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/BinaryOperation.java
浏览文件 @
4b02e36f
...
...
@@ -436,9 +436,9 @@ public class BinaryOperation extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
right
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
4b02e36f
...
...
@@ -495,11 +495,11 @@ public class CompareLike extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
right
.
updateAggregate
(
session
,
window
);
if
(
escape
!=
null
)
{
escape
.
updateAggregate
(
session
);
escape
.
updateAggregate
(
session
,
window
);
}
}
...
...
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
4b02e36f
...
...
@@ -475,10 +475,10 @@ public class Comparison extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
if
(
right
!=
null
)
{
right
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
,
window
);
}
}
...
...
h2/src/main/org/h2/expression/ConditionAndOr.java
浏览文件 @
4b02e36f
...
...
@@ -268,9 +268,9 @@ public class ConditionAndOr extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
right
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/ConditionExists.java
浏览文件 @
4b02e36f
...
...
@@ -46,7 +46,7 @@ public class ConditionExists extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
// TODO exists: is it allowed that the subquery contains aggregates?
// probably not
// select id from test group by id having exists (select * from test2
...
...
h2/src/main/org/h2/expression/ConditionIn.java
浏览文件 @
4b02e36f
...
...
@@ -163,10 +163,10 @@ public class ConditionIn extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
for
(
Expression
e
:
valueList
)
{
e
.
updateAggregate
(
session
);
e
.
updateAggregate
(
session
,
window
);
}
}
...
...
h2/src/main/org/h2/expression/ConditionInConstantSet.java
浏览文件 @
4b02e36f
...
...
@@ -125,8 +125,8 @@ public class ConditionInConstantSet extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/ConditionInParameter.java
浏览文件 @
4b02e36f
...
...
@@ -145,8 +145,8 @@ public class ConditionInParameter extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
4b02e36f
...
...
@@ -146,9 +146,9 @@ public class ConditionInSelect extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
query
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
query
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/ConditionNot.java
浏览文件 @
4b02e36f
...
...
@@ -70,8 +70,8 @@ public class ConditionNot extends Condition {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
condition
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
condition
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/Expression.java
浏览文件 @
4b02e36f
...
...
@@ -105,8 +105,9 @@ public abstract class Expression {
* be used to make sure the internal state is only updated once.
*
* @param session the session
* @param window true for window processing stage, false for group stage
*/
public
abstract
void
updateAggregate
(
Session
session
);
public
abstract
void
updateAggregate
(
Session
session
,
boolean
window
);
/**
* Check if this expression and all sub-expressions can fulfill a criteria.
...
...
h2/src/main/org/h2/expression/ExpressionColumn.java
浏览文件 @
4b02e36f
...
...
@@ -153,7 +153,7 @@ public class ExpressionColumn extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
Value
now
=
columnResolver
.
getValue
(
column
);
Select
select
=
columnResolver
.
getSelect
();
if
(
select
==
null
)
{
...
...
h2/src/main/org/h2/expression/ExpressionList.java
浏览文件 @
4b02e36f
...
...
@@ -98,9 +98,9 @@ public class ExpressionList extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
for
(
Expression
e
:
list
)
{
e
.
updateAggregate
(
session
);
e
.
updateAggregate
(
session
,
window
);
}
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
4b02e36f
...
...
@@ -2633,10 +2633,10 @@ public class Function extends Expression implements FunctionCall {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
for
(
Expression
e
:
args
)
{
if
(
e
!=
null
)
{
e
.
updateAggregate
(
session
);
e
.
updateAggregate
(
session
,
window
);
}
}
}
...
...
h2/src/main/org/h2/expression/IntervalOperation.java
浏览文件 @
4b02e36f
...
...
@@ -291,9 +291,9 @@ public class IntervalOperation extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
left
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
left
.
updateAggregate
(
session
,
window
);
right
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/JavaFunction.java
浏览文件 @
4b02e36f
...
...
@@ -107,10 +107,10 @@ public class JavaFunction extends Expression implements FunctionCall {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
for
(
Expression
e
:
args
)
{
if
(
e
!=
null
)
{
e
.
updateAggregate
(
session
);
e
.
updateAggregate
(
session
,
window
);
}
}
}
...
...
h2/src/main/org/h2/expression/Parameter.java
浏览文件 @
4b02e36f
...
...
@@ -141,7 +141,7 @@ public class Parameter extends Expression implements ParameterInterface {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
// nothing to do
}
...
...
h2/src/main/org/h2/expression/Rownum.java
浏览文件 @
4b02e36f
...
...
@@ -73,7 +73,7 @@ public class Rownum extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
// nothing to do
}
...
...
h2/src/main/org/h2/expression/SequenceValue.java
浏览文件 @
4b02e36f
...
...
@@ -72,7 +72,7 @@ public class SequenceValue extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
// nothing to do
}
...
...
h2/src/main/org/h2/expression/Subquery.java
浏览文件 @
4b02e36f
...
...
@@ -94,8 +94,8 @@ public class Subquery extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
query
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
query
.
updateAggregate
(
session
,
window
);
}
private
Expression
getExpression
()
{
...
...
h2/src/main/org/h2/expression/UnaryOperation.java
浏览文件 @
4b02e36f
...
...
@@ -82,8 +82,8 @@ public class UnaryOperation extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
arg
.
updateAggregate
(
session
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
arg
.
updateAggregate
(
session
,
window
);
}
@Override
...
...
h2/src/main/org/h2/expression/ValueExpression.java
浏览文件 @
4b02e36f
...
...
@@ -143,7 +143,7 @@ public class ValueExpression extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
// nothing to do
}
...
...
h2/src/main/org/h2/expression/Variable.java
浏览文件 @
4b02e36f
...
...
@@ -101,7 +101,7 @@ public class Variable extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
// nothing to do
}
...
...
h2/src/main/org/h2/expression/Wildcard.java
浏览文件 @
4b02e36f
...
...
@@ -91,7 +91,7 @@ public class Wildcard extends Expression {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
DbException
.
throwInternalError
(
toString
());
}
...
...
h2/src/main/org/h2/expression/aggregate/Aggregate.java
浏览文件 @
4b02e36f
...
...
@@ -289,12 +289,15 @@ public class Aggregate extends AbstractAggregate {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
if
(
window
!=
(
over
!=
null
))
{
return
;
}
// TODO aggregates: check nested MIN(MAX(ID)) and so on
// if (on != null) {
// on.updateAggregate();
// }
SelectGroups
groupData
=
select
.
getGroupDataIfCurrent
(
over
!=
null
);
SelectGroups
groupData
=
select
.
getGroupDataIfCurrent
(
window
);
if
(
groupData
==
null
)
{
// this is a different level (the enclosing query)
return
;
...
...
@@ -308,7 +311,7 @@ public class Aggregate extends AbstractAggregate {
lastGroupRowId
=
groupRowId
;
if
(
over
!=
null
)
{
over
.
updateAggregate
(
session
);
over
.
updateAggregate
(
session
,
true
);
}
if
(
filterCondition
!=
null
)
{
if
(!
filterCondition
.
getBooleanValue
(
session
))
{
...
...
h2/src/main/org/h2/expression/aggregate/JavaAggregate.java
浏览文件 @
4b02e36f
...
...
@@ -200,8 +200,11 @@ public class JavaAggregate extends AbstractAggregate {
}
@Override
public
void
updateAggregate
(
Session
session
)
{
SelectGroups
groupData
=
select
.
getGroupDataIfCurrent
(
over
!=
null
);
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
if
(
window
!=
(
over
!=
null
))
{
return
;
}
SelectGroups
groupData
=
select
.
getGroupDataIfCurrent
(
window
);
if
(
groupData
==
null
)
{
// this is a different level (the enclosing query)
return
;
...
...
@@ -215,7 +218,7 @@ public class JavaAggregate extends AbstractAggregate {
lastGroupRowId
=
groupRowId
;
if
(
over
!=
null
)
{
over
.
updateAggregate
(
session
);
over
.
updateAggregate
(
session
,
true
);
}
if
(
filterCondition
!=
null
)
{
if
(!
filterCondition
.
getBooleanValue
(
session
))
{
...
...
h2/src/main/org/h2/expression/aggregate/Window.java
浏览文件 @
4b02e36f
...
...
@@ -113,12 +113,13 @@ public final class Window {
*
* @param session
* the session
* @see Expression#updateAggregate(Session)
* @param window true for window processing stage, false for group stage
* @see Expression#updateAggregate(Session, boolean)
*/
public
void
updateAggregate
(
Session
session
)
{
public
void
updateAggregate
(
Session
session
,
boolean
window
)
{
if
(
partitionBy
!=
null
)
{
for
(
Expression
expr
:
partitionBy
)
{
expr
.
updateAggregate
(
session
);
expr
.
updateAggregate
(
session
,
window
);
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论