Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c7191ee7
提交
c7191ee7
authored
11月 21, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move stage constants to DataAnalysisOperation
上级
2e263d53
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
26 行增加
和
27 行删除
+26
-27
Select.java
h2/src/main/org/h2/command/dml/Select.java
+8
-8
Aggregate.java
h2/src/main/org/h2/expression/aggregate/Aggregate.java
+0
-15
DataAnalysisOperation.java
...ain/org/h2/expression/analysis/DataAnalysisOperation.java
+18
-4
Function.java
h2/src/main/org/h2/expression/function/Function.java
+0
-0
FunctionCall.java
h2/src/main/org/h2/expression/function/FunctionCall.java
+0
-0
FunctionInfo.java
h2/src/main/org/h2/expression/function/FunctionInfo.java
+0
-0
JavaFunction.java
h2/src/main/org/h2/expression/function/JavaFunction.java
+0
-0
TableFunction.java
h2/src/main/org/h2/expression/function/TableFunction.java
+0
-0
没有找到文件。
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
c7191ee7
...
@@ -25,7 +25,7 @@ import org.h2.expression.ExpressionColumn;
...
@@ -25,7 +25,7 @@ import org.h2.expression.ExpressionColumn;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.expression.Parameter
;
import
org.h2.expression.Parameter
;
import
org.h2.expression.Wildcard
;
import
org.h2.expression.Wildcard
;
import
org.h2.expression.a
ggregate.Aggregate
;
import
org.h2.expression.a
nalysis.DataAnalysisOperation
;
import
org.h2.expression.analysis.Window
;
import
org.h2.expression.analysis.Window
;
import
org.h2.index.Cursor
;
import
org.h2.index.Cursor
;
import
org.h2.index.Index
;
import
org.h2.index.Index
;
...
@@ -389,7 +389,7 @@ public class Select extends Query {
...
@@ -389,7 +389,7 @@ public class Select extends Query {
private
void
queryWindow
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
private
void
queryWindow
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
initGroupData
(
columnCount
);
initGroupData
(
columnCount
);
try
{
try
{
gatherGroup
(
columnCount
,
Aggregate
.
STAGE_WINDOW
);
gatherGroup
(
columnCount
,
DataAnalysisOperation
.
STAGE_WINDOW
);
processGroupResult
(
columnCount
,
result
,
offset
,
quickOffset
);
processGroupResult
(
columnCount
,
result
,
offset
,
quickOffset
);
}
finally
{
}
finally
{
groupData
.
reset
();
groupData
.
reset
();
...
@@ -399,12 +399,12 @@ public class Select extends Query {
...
@@ -399,12 +399,12 @@ public class Select extends Query {
private
void
queryGroupWindow
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
private
void
queryGroupWindow
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
initGroupData
(
columnCount
);
initGroupData
(
columnCount
);
try
{
try
{
gatherGroup
(
columnCount
,
Aggregate
.
STAGE_GROUP
);
gatherGroup
(
columnCount
,
DataAnalysisOperation
.
STAGE_GROUP
);
try
{
try
{
isGroupWindowStage2
=
true
;
isGroupWindowStage2
=
true
;
while
(
groupData
.
next
()
!=
null
)
{
while
(
groupData
.
next
()
!=
null
)
{
if
(
havingIndex
<
0
||
expressions
.
get
(
havingIndex
).
getBooleanValue
(
session
))
{
if
(
havingIndex
<
0
||
expressions
.
get
(
havingIndex
).
getBooleanValue
(
session
))
{
updateAgg
(
columnCount
,
Aggregate
.
STAGE_WINDOW
);
updateAgg
(
columnCount
,
DataAnalysisOperation
.
STAGE_WINDOW
);
}
else
{
}
else
{
groupData
.
remove
();
groupData
.
remove
();
}
}
...
@@ -422,7 +422,7 @@ public class Select extends Query {
...
@@ -422,7 +422,7 @@ public class Select extends Query {
private
void
queryGroup
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
private
void
queryGroup
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
initGroupData
(
columnCount
);
initGroupData
(
columnCount
);
try
{
try
{
gatherGroup
(
columnCount
,
Aggregate
.
STAGE_GROUP
);
gatherGroup
(
columnCount
,
DataAnalysisOperation
.
STAGE_GROUP
);
processGroupResult
(
columnCount
,
result
,
offset
,
quickOffset
);
processGroupResult
(
columnCount
,
result
,
offset
,
quickOffset
);
}
finally
{
}
finally
{
groupData
.
reset
();
groupData
.
reset
();
...
@@ -433,7 +433,7 @@ public class Select extends Query {
...
@@ -433,7 +433,7 @@ public class Select extends Query {
if
(
groupData
==
null
)
{
if
(
groupData
==
null
)
{
groupData
=
SelectGroups
.
getInstance
(
session
,
expressions
,
isGroupQuery
,
groupIndex
);
groupData
=
SelectGroups
.
getInstance
(
session
,
expressions
,
isGroupQuery
,
groupIndex
);
}
else
{
}
else
{
updateAgg
(
columnCount
,
Aggregate
.
STAGE_RESET
);
updateAgg
(
columnCount
,
DataAnalysisOperation
.
STAGE_RESET
);
}
}
groupData
.
reset
();
groupData
.
reset
();
}
}
...
@@ -1742,7 +1742,7 @@ public class Select extends Query {
...
@@ -1742,7 +1742,7 @@ public class Select extends Query {
groupData
=
SelectGroups
.
getInstance
(
getSession
(),
Select
.
this
.
expressions
,
isGroupQuery
,
groupIndex
);
groupData
=
SelectGroups
.
getInstance
(
getSession
(),
Select
.
this
.
expressions
,
isGroupQuery
,
groupIndex
);
}
else
{
}
else
{
// TODO is this branch possible?
// TODO is this branch possible?
updateAgg
(
columnCount
,
Aggregate
.
STAGE_RESET
);
updateAgg
(
columnCount
,
DataAnalysisOperation
.
STAGE_RESET
);
groupData
.
resetLazy
();
groupData
.
resetLazy
();
}
}
}
}
...
@@ -1778,7 +1778,7 @@ public class Select extends Query {
...
@@ -1778,7 +1778,7 @@ public class Select extends Query {
groupData
.
nextLazyGroup
();
groupData
.
nextLazyGroup
();
}
}
groupData
.
nextLazyRow
();
groupData
.
nextLazyRow
();
updateAgg
(
columnCount
,
Aggregate
.
STAGE_GROUP
);
updateAgg
(
columnCount
,
DataAnalysisOperation
.
STAGE_GROUP
);
if
(
row
!=
null
)
{
if
(
row
!=
null
)
{
return
row
;
return
row
;
}
}
...
...
h2/src/main/org/h2/expression/aggregate/Aggregate.java
浏览文件 @
c7191ee7
...
@@ -155,21 +155,6 @@ public class Aggregate extends AbstractAggregate {
...
@@ -155,21 +155,6 @@ public class Aggregate extends AbstractAggregate {
ENVELOPE
,
ENVELOPE
,
}
}
/**
* Reset stage. Used to reset internal data to its initial state.
*/
public
static
final
int
STAGE_RESET
=
0
;
/**
* Group stage, used for explicit or implicit GROUP BY operation.
*/
public
static
final
int
STAGE_GROUP
=
1
;
/**
* Window processing stage.
*/
public
static
final
int
STAGE_WINDOW
=
2
;
private
static
final
HashMap
<
String
,
AggregateType
>
AGGREGATES
=
new
HashMap
<>(
64
);
private
static
final
HashMap
<
String
,
AggregateType
>
AGGREGATES
=
new
HashMap
<>(
64
);
private
final
AggregateType
type
;
private
final
AggregateType
type
;
...
...
h2/src/main/org/h2/expression/analysis/DataAnalysisOperation.java
浏览文件 @
c7191ee7
...
@@ -16,7 +16,6 @@ import org.h2.command.dml.SelectOrderBy;
...
@@ -16,7 +16,6 @@ import org.h2.command.dml.SelectOrderBy;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.expression.aggregate.Aggregate
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.SortOrder
;
import
org.h2.result.SortOrder
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.ColumnResolver
;
...
@@ -30,6 +29,21 @@ import org.h2.value.ValueInt;
...
@@ -30,6 +29,21 @@ import org.h2.value.ValueInt;
*/
*/
public
abstract
class
DataAnalysisOperation
extends
Expression
{
public
abstract
class
DataAnalysisOperation
extends
Expression
{
/**
* Reset stage. Used to reset internal data to its initial state.
*/
public
static
final
int
STAGE_RESET
=
0
;
/**
* Group stage, used for explicit or implicit GROUP BY operation.
*/
public
static
final
int
STAGE_GROUP
=
1
;
/**
* Window processing stage.
*/
public
static
final
int
STAGE_WINDOW
=
2
;
protected
final
Select
select
;
protected
final
Select
select
;
protected
Window
over
;
protected
Window
over
;
...
@@ -126,12 +140,12 @@ public abstract class DataAnalysisOperation extends Expression {
...
@@ -126,12 +140,12 @@ public abstract class DataAnalysisOperation extends Expression {
@Override
@Override
public
final
void
updateAggregate
(
Session
session
,
int
stage
)
{
public
final
void
updateAggregate
(
Session
session
,
int
stage
)
{
if
(
stage
==
Aggregate
.
STAGE_RESET
)
{
if
(
stage
==
STAGE_RESET
)
{
updateGroupAggregates
(
session
,
Aggregate
.
STAGE_RESET
);
updateGroupAggregates
(
session
,
STAGE_RESET
);
lastGroupRowId
=
0
;
lastGroupRowId
=
0
;
return
;
return
;
}
}
boolean
window
=
stage
==
Aggregate
.
STAGE_WINDOW
;
boolean
window
=
stage
==
STAGE_WINDOW
;
if
(
window
!=
(
over
!=
null
))
{
if
(
window
!=
(
over
!=
null
))
{
if
(!
window
&&
select
.
isWindowQuery
())
{
if
(!
window
&&
select
.
isWindowQuery
())
{
updateGroupAggregates
(
session
,
stage
);
updateGroupAggregates
(
session
,
stage
);
...
...
h2/src/main/org/h2/expression/Function.java
→
h2/src/main/org/h2/expression/
function/
Function.java
浏览文件 @
c7191ee7
File moved
h2/src/main/org/h2/expression/FunctionCall.java
→
h2/src/main/org/h2/expression/
function/
FunctionCall.java
浏览文件 @
c7191ee7
File moved
h2/src/main/org/h2/expression/FunctionInfo.java
→
h2/src/main/org/h2/expression/
function/
FunctionInfo.java
浏览文件 @
c7191ee7
File moved
h2/src/main/org/h2/expression/JavaFunction.java
→
h2/src/main/org/h2/expression/
function/
JavaFunction.java
浏览文件 @
c7191ee7
File moved
h2/src/main/org/h2/expression/TableFunction.java
→
h2/src/main/org/h2/expression/
function/
TableFunction.java
浏览文件 @
c7191ee7
File moved
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论