Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0186678a
提交
0186678a
authored
1月 19, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use ValueRow in SelectGroups
上级
214203c5
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
14 行删除
+14
-14
Select.java
h2/src/main/org/h2/command/dml/Select.java
+2
-2
SelectGroups.java
h2/src/main/org/h2/command/dml/SelectGroups.java
+12
-12
没有找到文件。
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
0186678a
...
@@ -51,8 +51,8 @@ import org.h2.util.StatementBuilder;
...
@@ -51,8 +51,8 @@ import org.h2.util.StatementBuilder;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueNull
;
import
org.h2.value.ValueNull
;
import
org.h2.value.ValueRow
;
/**
/**
* This class represents a simple SELECT statement.
* This class represents a simple SELECT statement.
...
@@ -499,7 +499,7 @@ public class Select extends Query {
...
@@ -499,7 +499,7 @@ public class Select extends Query {
}
}
private
void
processGroupResult
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
private
void
processGroupResult
(
int
columnCount
,
LocalResult
result
,
long
offset
,
boolean
quickOffset
)
{
for
(
Value
Array
currentGroupsKey
;
(
currentGroupsKey
=
groupData
.
next
())
!=
null
;)
{
for
(
Value
Row
currentGroupsKey
;
(
currentGroupsKey
=
groupData
.
next
())
!=
null
;)
{
Value
[]
keyValues
=
currentGroupsKey
.
getList
();
Value
[]
keyValues
=
currentGroupsKey
.
getList
();
Value
[]
row
=
new
Value
[
columnCount
];
Value
[]
row
=
new
Value
[
columnCount
];
for
(
int
j
=
0
;
groupIndex
!=
null
&&
j
<
groupIndex
.
length
;
j
++)
{
for
(
int
j
=
0
;
groupIndex
!=
null
&&
j
<
groupIndex
.
length
;
j
++)
{
...
...
h2/src/main/org/h2/command/dml/SelectGroups.java
浏览文件 @
0186678a
...
@@ -18,7 +18,7 @@ import org.h2.expression.Expression;
...
@@ -18,7 +18,7 @@ import org.h2.expression.Expression;
import
org.h2.expression.analysis.DataAnalysisOperation
;
import
org.h2.expression.analysis.DataAnalysisOperation
;
import
org.h2.expression.analysis.PartitionData
;
import
org.h2.expression.analysis.PartitionData
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.Value
Array
;
import
org.h2.value.Value
Row
;
/**
/**
* Grouped data for aggregates.
* Grouped data for aggregates.
...
@@ -51,18 +51,18 @@ public abstract class SelectGroups {
...
@@ -51,18 +51,18 @@ public abstract class SelectGroups {
/**
/**
* Map of group-by key to group-by expression data e.g. AggregateData
* Map of group-by key to group-by expression data e.g. AggregateData
*/
*/
private
TreeMap
<
Value
Array
,
Object
[]>
groupByData
;
private
TreeMap
<
Value
Row
,
Object
[]>
groupByData
;
/**
/**
* Key into groupByData that produces currentGroupByExprData. Not used
* Key into groupByData that produces currentGroupByExprData. Not used
* in lazy mode.
* in lazy mode.
*/
*/
private
Value
Array
currentGroupsKey
;
private
Value
Row
currentGroupsKey
;
/**
/**
* Cursor for {@link #next()} method.
* Cursor for {@link #next()} method.
*/
*/
private
Iterator
<
Entry
<
Value
Array
,
Object
[]>>
cursor
;
private
Iterator
<
Entry
<
Value
Row
,
Object
[]>>
cursor
;
Grouped
(
Session
session
,
ArrayList
<
Expression
>
expressions
,
int
[]
groupIndex
)
{
Grouped
(
Session
session
,
ArrayList
<
Expression
>
expressions
,
int
[]
groupIndex
)
{
super
(
session
,
expressions
);
super
(
session
,
expressions
);
...
@@ -80,7 +80,7 @@ public abstract class SelectGroups {
...
@@ -80,7 +80,7 @@ public abstract class SelectGroups {
@Override
@Override
public
void
nextSource
()
{
public
void
nextSource
()
{
if
(
groupIndex
==
null
)
{
if
(
groupIndex
==
null
)
{
currentGroupsKey
=
Value
Array
.
getEmpty
();
currentGroupsKey
=
Value
Row
.
getEmpty
();
}
else
{
}
else
{
Value
[]
keyValues
=
new
Value
[
groupIndex
.
length
];
Value
[]
keyValues
=
new
Value
[
groupIndex
.
length
];
// update group
// update group
...
@@ -89,7 +89,7 @@ public abstract class SelectGroups {
...
@@ -89,7 +89,7 @@ public abstract class SelectGroups {
Expression
expr
=
expressions
.
get
(
idx
);
Expression
expr
=
expressions
.
get
(
idx
);
keyValues
[
i
]
=
expr
.
getValue
(
session
);
keyValues
[
i
]
=
expr
.
getValue
(
session
);
}
}
currentGroupsKey
=
Value
Array
.
get
(
keyValues
);
currentGroupsKey
=
Value
Row
.
get
(
keyValues
);
}
}
Object
[]
values
=
groupByData
.
get
(
currentGroupsKey
);
Object
[]
values
=
groupByData
.
get
(
currentGroupsKey
);
if
(
values
==
null
)
{
if
(
values
==
null
)
{
...
@@ -114,15 +114,15 @@ public abstract class SelectGroups {
...
@@ -114,15 +114,15 @@ public abstract class SelectGroups {
public
void
done
()
{
public
void
done
()
{
super
.
done
();
super
.
done
();
if
(
groupIndex
==
null
&&
groupByData
.
size
()
==
0
)
{
if
(
groupIndex
==
null
&&
groupByData
.
size
()
==
0
)
{
groupByData
.
put
(
Value
Array
.
getEmpty
(),
createRow
());
groupByData
.
put
(
Value
Row
.
getEmpty
(),
createRow
());
}
}
cursor
=
groupByData
.
entrySet
().
iterator
();
cursor
=
groupByData
.
entrySet
().
iterator
();
}
}
@Override
@Override
public
Value
Array
next
()
{
public
Value
Row
next
()
{
if
(
cursor
.
hasNext
())
{
if
(
cursor
.
hasNext
())
{
Map
.
Entry
<
Value
Array
,
Object
[]>
entry
=
cursor
.
next
();
Map
.
Entry
<
Value
Row
,
Object
[]>
entry
=
cursor
.
next
();
currentGroupByExprData
=
entry
.
getValue
();
currentGroupByExprData
=
entry
.
getValue
();
currentGroupRowId
++;
currentGroupRowId
++;
return
entry
.
getKey
();
return
entry
.
getKey
();
...
@@ -184,11 +184,11 @@ public abstract class SelectGroups {
...
@@ -184,11 +184,11 @@ public abstract class SelectGroups {
}
}
@Override
@Override
public
Value
Array
next
()
{
public
Value
Row
next
()
{
if
(
cursor
.
hasNext
())
{
if
(
cursor
.
hasNext
())
{
currentGroupByExprData
=
cursor
.
next
();
currentGroupByExprData
=
cursor
.
next
();
currentGroupRowId
++;
currentGroupRowId
++;
return
Value
Array
.
getEmpty
();
return
Value
Row
.
getEmpty
();
}
}
return
null
;
return
null
;
}
}
...
@@ -397,7 +397,7 @@ public abstract class SelectGroups {
...
@@ -397,7 +397,7 @@ public abstract class SelectGroups {
*
*
* @return the key of the next group, or null
* @return the key of the next group, or null
*/
*/
public
abstract
Value
Array
next
();
public
abstract
Value
Row
next
();
/**
/**
* Removes the data for the current key.
* Removes the data for the current key.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论