Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
21ffff1a
提交
21ffff1a
authored
1月 19, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use ValueRow instead of ValueArray in local and external results
上级
a440ce8c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
26 行增加
和
26 行删除
+26
-26
MVPlainTempResult.java
h2/src/main/org/h2/mvstore/db/MVPlainTempResult.java
+5
-5
MVSortedTempResult.java
h2/src/main/org/h2/mvstore/db/MVSortedTempResult.java
+14
-14
LocalResultImpl.java
h2/src/main/org/h2/result/LocalResultImpl.java
+7
-7
没有找到文件。
h2/src/main/org/h2/mvstore/db/MVPlainTempResult.java
浏览文件 @
21ffff1a
...
...
@@ -13,7 +13,7 @@ import org.h2.mvstore.MVMap;
import
org.h2.mvstore.MVMap.Builder
;
import
org.h2.result.ResultExternal
;
import
org.h2.value.Value
;
import
org.h2.value.Value
Array
;
import
org.h2.value.Value
Row
;
/**
* Plain temporary result.
...
...
@@ -23,7 +23,7 @@ class MVPlainTempResult extends MVTempResult {
/**
* Map with identities of rows as keys rows as values.
*/
private
final
MVMap
<
Long
,
Value
Array
>
map
;
private
final
MVMap
<
Long
,
Value
Row
>
map
;
/**
* Counter for the identities of rows. A separate counter is used instead of
...
...
@@ -35,7 +35,7 @@ class MVPlainTempResult extends MVTempResult {
/**
* Cursor for the {@link #next()} method.
*/
private
Cursor
<
Long
,
Value
Array
>
cursor
;
private
Cursor
<
Long
,
Value
Row
>
cursor
;
/**
* Creates a shallow copy of the result.
...
...
@@ -61,7 +61,7 @@ class MVPlainTempResult extends MVTempResult {
MVPlainTempResult
(
Database
database
,
Expression
[]
expressions
,
int
visibleColumnCount
)
{
super
(
database
,
expressions
.
length
,
visibleColumnCount
);
ValueDataType
valueType
=
new
ValueDataType
(
database
,
new
int
[
columnCount
]);
Builder
<
Long
,
Value
Array
>
builder
=
new
MVMap
.
Builder
<
Long
,
ValueArray
>()
Builder
<
Long
,
Value
Row
>
builder
=
new
MVMap
.
Builder
<
Long
,
ValueRow
>()
.
valueType
(
valueType
).
singleWriter
();
map
=
store
.
openMap
(
"tmp"
,
builder
);
}
...
...
@@ -69,7 +69,7 @@ class MVPlainTempResult extends MVTempResult {
@Override
public
int
addRow
(
Value
[]
values
)
{
assert
parent
==
null
;
map
.
append
(
counter
++,
Value
Array
.
get
(
values
));
map
.
append
(
counter
++,
Value
Row
.
get
(
values
));
return
++
rowCount
;
}
...
...
h2/src/main/org/h2/mvstore/db/MVSortedTempResult.java
浏览文件 @
21ffff1a
...
...
@@ -17,7 +17,7 @@ import org.h2.mvstore.MVMap.Builder;
import
org.h2.result.ResultExternal
;
import
org.h2.result.SortOrder
;
import
org.h2.value.Value
;
import
org.h2.value.Value
Array
;
import
org.h2.value.Value
Row
;
/**
* Sorted temporary result.
...
...
@@ -48,7 +48,7 @@ class MVSortedTempResult extends MVTempResult {
* Map with rows as keys and counts of duplicate rows as values. If this map is
* distinct all values are 1.
*/
private
final
MVMap
<
Value
Array
,
Long
>
map
;
private
final
MVMap
<
Value
Row
,
Long
>
map
;
/**
* Optional index. This index is created only if result is distinct and
...
...
@@ -56,12 +56,12 @@ class MVSortedTempResult extends MVTempResult {
* {@link #contains(Value[])} method is invoked. Only the root result should
* have an index if required.
*/
private
MVMap
<
Value
Array
,
Boolean
>
index
;
private
MVMap
<
Value
Row
,
Boolean
>
index
;
/**
* Cursor for the {@link #next()} method.
*/
private
Cursor
<
Value
Array
,
Long
>
cursor
;
private
Cursor
<
Value
Row
,
Long
>
cursor
;
/**
* Current value for the {@link #next()} method. Used in non-distinct results
...
...
@@ -167,12 +167,12 @@ class MVSortedTempResult extends MVTempResult {
}
this
.
indexes
=
indexes
;
ValueDataType
keyType
=
new
ValueDataType
(
database
,
sortTypes
);
Builder
<
Value
Array
,
Long
>
builder
=
new
MVMap
.
Builder
<
ValueArray
,
Long
>().
keyType
(
keyType
);
Builder
<
Value
Row
,
Long
>
builder
=
new
MVMap
.
Builder
<
ValueRow
,
Long
>().
keyType
(
keyType
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
if
(
distinct
&&
length
!=
visibleColumnCount
||
distinctIndexes
!=
null
)
{
int
count
=
distinctIndexes
!=
null
?
distinctIndexes
.
length
:
visibleColumnCount
;
ValueDataType
distinctType
=
new
ValueDataType
(
database
,
new
int
[
count
]);
Builder
<
Value
Array
,
Boolean
>
indexBuilder
=
new
MVMap
.
Builder
<
ValueArray
,
Boolean
>().
keyType
(
distinctType
);
Builder
<
Value
Row
,
Boolean
>
indexBuilder
=
new
MVMap
.
Builder
<
ValueRow
,
Boolean
>().
keyType
(
distinctType
);
index
=
store
.
openMap
(
"idx"
,
indexBuilder
);
}
}
...
...
@@ -180,7 +180,7 @@ class MVSortedTempResult extends MVTempResult {
@Override
public
int
addRow
(
Value
[]
values
)
{
assert
parent
==
null
;
Value
Array
key
=
getKey
(
values
);
Value
Row
key
=
getKey
(
values
);
if
(
distinct
||
distinctIndexes
!=
null
)
{
if
(
distinctIndexes
!=
null
)
{
int
cnt
=
distinctIndexes
.
length
;
...
...
@@ -188,12 +188,12 @@ class MVSortedTempResult extends MVTempResult {
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
newValues
[
i
]
=
values
[
distinctIndexes
[
i
]];
}
Value
Array
distinctRow
=
ValueArray
.
get
(
newValues
);
Value
Row
distinctRow
=
ValueRow
.
get
(
newValues
);
if
(
index
.
putIfAbsent
(
distinctRow
,
true
)
!=
null
)
{
return
rowCount
;
}
}
else
if
(
columnCount
!=
visibleColumnCount
)
{
Value
Array
distinctRow
=
ValueArray
.
get
(
Arrays
.
copyOf
(
values
,
visibleColumnCount
));
Value
Row
distinctRow
=
ValueRow
.
get
(
Arrays
.
copyOf
(
values
,
visibleColumnCount
));
if
(
index
.
putIfAbsent
(
distinctRow
,
true
)
!=
null
)
{
return
rowCount
;
}
...
...
@@ -222,7 +222,7 @@ class MVSortedTempResult extends MVTempResult {
}
assert
distinct
;
if
(
columnCount
!=
visibleColumnCount
)
{
return
index
.
containsKey
(
Value
Array
.
get
(
values
));
return
index
.
containsKey
(
Value
Row
.
get
(
values
));
}
return
map
.
containsKey
(
getKey
(
values
));
}
...
...
@@ -240,13 +240,13 @@ class MVSortedTempResult extends MVTempResult {
}
/**
* Reorder values if required and convert them into {@link Value
Array
}.
* Reorder values if required and convert them into {@link Value
Row
}.
*
* @param values
* values
* @return Value
Array
for maps
* @return Value
Row
for maps
*/
private
Value
Array
getKey
(
Value
[]
values
)
{
private
Value
Row
getKey
(
Value
[]
values
)
{
if
(
indexes
!=
null
)
{
Value
[]
r
=
new
Value
[
indexes
.
length
];
for
(
int
i
=
0
;
i
<
indexes
.
length
;
i
++)
{
...
...
@@ -254,7 +254,7 @@ class MVSortedTempResult extends MVTempResult {
}
values
=
r
;
}
return
Value
Array
.
get
(
values
);
return
Value
Row
.
get
(
values
);
}
/**
...
...
h2/src/main/org/h2/result/LocalResultImpl.java
浏览文件 @
21ffff1a
...
...
@@ -17,7 +17,7 @@ import org.h2.util.Utils;
import
org.h2.util.ValueHashMap
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.Value
Array
;
import
org.h2.value.Value
Row
;
/**
* A local result set contains all row data of a result set.
...
...
@@ -179,7 +179,7 @@ public class LocalResultImpl implements LocalResult {
}
assert
values
.
length
==
visibleColumnCount
;
if
(
distinctRows
!=
null
)
{
Value
Array
array
=
ValueArray
.
get
(
values
);
Value
Row
array
=
ValueRow
.
get
(
values
);
distinctRows
.
remove
(
array
);
rowCount
=
distinctRows
.
size
();
}
else
{
...
...
@@ -202,11 +202,11 @@ public class LocalResultImpl implements LocalResult {
if
(
distinctRows
==
null
)
{
distinctRows
=
new
ValueHashMap
<>();
for
(
Value
[]
row
:
rows
)
{
Value
Array
array
=
getArrayOfDistinct
(
row
);
Value
Row
array
=
getDistinctRow
(
row
);
distinctRows
.
put
(
array
,
array
.
getList
());
}
}
Value
Array
array
=
ValueArray
.
get
(
values
);
Value
Row
array
=
ValueRow
.
get
(
values
);
return
distinctRows
.
get
(
array
)
!=
null
;
}
...
...
@@ -284,7 +284,7 @@ public class LocalResultImpl implements LocalResult {
}
}
private
Value
Array
getArrayOfDistinct
(
Value
[]
values
)
{
private
Value
Row
getDistinctRow
(
Value
[]
values
)
{
if
(
distinctIndexes
!=
null
)
{
int
cnt
=
distinctIndexes
.
length
;
Value
[]
newValues
=
new
Value
[
cnt
];
...
...
@@ -295,7 +295,7 @@ public class LocalResultImpl implements LocalResult {
}
else
if
(
values
.
length
>
visibleColumnCount
)
{
values
=
Arrays
.
copyOf
(
values
,
visibleColumnCount
);
}
return
Value
Array
.
get
(
values
);
return
Value
Row
.
get
(
values
);
}
private
void
createExternalResult
()
{
...
...
@@ -317,7 +317,7 @@ public class LocalResultImpl implements LocalResult {
cloneLobs
(
values
);
if
(
isAnyDistinct
())
{
if
(
distinctRows
!=
null
)
{
Value
Array
array
=
getArrayOfDistinct
(
values
);
Value
Row
array
=
getDistinctRow
(
values
);
distinctRows
.
putIfAbsent
(
array
,
values
);
rowCount
=
distinctRows
.
size
();
if
(
rowCount
>
maxMemoryRows
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论