Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ffd8fc37
提交
ffd8fc37
authored
10月 28, 2015
作者:
S.Vladykin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BaseIndex.getCostRangeIndex changed to accept TableFilter[]
上级
13fd5a10
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
17 行增加
和
16 行删除
+17
-16
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+5
-3
LinkedIndex.java
h2/src/main/org/h2/index/LinkedIndex.java
+1
-1
MetaIndex.java
h2/src/main/org/h2/index/MetaIndex.java
+1
-1
PageBtreeIndex.java
h2/src/main/org/h2/index/PageBtreeIndex.java
+1
-1
PageDelegateIndex.java
h2/src/main/org/h2/index/PageDelegateIndex.java
+1
-1
SpatialTreeIndex.java
h2/src/main/org/h2/index/SpatialTreeIndex.java
+2
-2
TreeIndex.java
h2/src/main/org/h2/index/TreeIndex.java
+1
-1
MVDelegateIndex.java
h2/src/main/org/h2/mvstore/db/MVDelegateIndex.java
+1
-1
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+1
-1
MVSpatialIndex.java
h2/src/main/org/h2/mvstore/db/MVSpatialIndex.java
+2
-2
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+1
-2
没有找到文件。
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
ffd8fc37
...
@@ -152,12 +152,13 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -152,12 +152,13 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
*
*
* @param masks the search mask
* @param masks the search mask
* @param rowCount the number of rows in the index
* @param rowCount the number of rows in the index
* @param filter the table filter
* @param filters all joined table filters
* @param filter the current table filter index
* @param sortOrder the sort order
* @param sortOrder the sort order
* @return the estimated cost
* @return the estimated cost
*/
*/
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
TableFilter
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
rowCount
+=
Constants
.
COST_ROW_OFFSET
;
rowCount
+=
Constants
.
COST_ROW_OFFSET
;
long
cost
=
rowCount
;
long
cost
=
rowCount
;
long
rows
=
rowCount
;
long
rows
=
rowCount
;
...
@@ -201,6 +202,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -201,6 +202,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
boolean
sortOrderMatches
=
true
;
boolean
sortOrderMatches
=
true
;
int
coveringCount
=
0
;
int
coveringCount
=
0
;
int
[]
sortTypes
=
sortOrder
.
getSortTypes
();
int
[]
sortTypes
=
sortOrder
.
getSortTypes
();
TableFilter
tableFilter
=
filters
==
null
?
null
:
filters
[
filter
];
for
(
int
i
=
0
,
len
=
sortTypes
.
length
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
,
len
=
sortTypes
.
length
;
i
<
len
;
i
++)
{
if
(
i
>=
indexColumns
.
length
)
{
if
(
i
>=
indexColumns
.
length
)
{
// we can still use this index if we are sorting by more
// we can still use this index if we are sorting by more
...
@@ -209,7 +211,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -209,7 +211,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
// more of the order by columns
// more of the order by columns
break
;
break
;
}
}
Column
col
=
sortOrder
.
getColumn
(
i
,
f
ilter
);
Column
col
=
sortOrder
.
getColumn
(
i
,
tableF
ilter
);
if
(
col
==
null
)
{
if
(
col
==
null
)
{
sortOrderMatches
=
false
;
sortOrderMatches
=
false
;
break
;
break
;
...
...
h2/src/main/org/h2/index/LinkedIndex.java
浏览文件 @
ffd8fc37
...
@@ -144,7 +144,7 @@ public class LinkedIndex extends BaseIndex {
...
@@ -144,7 +144,7 @@ public class LinkedIndex extends BaseIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
100
+
getCostRangeIndex
(
masks
,
rowCount
+
return
100
+
getCostRangeIndex
(
masks
,
rowCount
+
Constants
.
COST_ROW_OFFSET
,
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
Constants
.
COST_ROW_OFFSET
,
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/index/MetaIndex.java
浏览文件 @
ffd8fc37
...
@@ -58,7 +58,7 @@ public class MetaIndex extends BaseIndex {
...
@@ -58,7 +58,7 @@ public class MetaIndex extends BaseIndex {
return
10
*
MetaTable
.
ROW_COUNT_APPROXIMATION
;
return
10
*
MetaTable
.
ROW_COUNT_APPROXIMATION
;
}
}
return
getCostRangeIndex
(
masks
,
MetaTable
.
ROW_COUNT_APPROXIMATION
,
return
getCostRangeIndex
(
masks
,
MetaTable
.
ROW_COUNT_APPROXIMATION
,
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/index/PageBtreeIndex.java
浏览文件 @
ffd8fc37
...
@@ -220,7 +220,7 @@ public class PageBtreeIndex extends PageIndex {
...
@@ -220,7 +220,7 @@ public class PageBtreeIndex extends PageIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
10
*
getCostRangeIndex
(
masks
,
tableData
.
getRowCount
(
session
),
return
10
*
getCostRangeIndex
(
masks
,
tableData
.
getRowCount
(
session
),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/index/PageDelegateIndex.java
浏览文件 @
ffd8fc37
...
@@ -99,7 +99,7 @@ public class PageDelegateIndex extends PageIndex {
...
@@ -99,7 +99,7 @@ public class PageDelegateIndex extends PageIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
10
*
getCostRangeIndex
(
masks
,
mainIndex
.
getRowCount
(
session
),
return
10
*
getCostRangeIndex
(
masks
,
mainIndex
.
getRowCount
(
session
),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/index/SpatialTreeIndex.java
浏览文件 @
ffd8fc37
...
@@ -180,7 +180,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
...
@@ -180,7 +180,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
@Override
@Override
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
TableFilter
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
getCostRangeIndex
(
masks
,
rowCount
,
columns
);
return
getCostRangeIndex
(
masks
,
rowCount
,
columns
);
}
}
...
@@ -211,7 +211,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
...
@@ -211,7 +211,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
getCostRangeIndex
(
masks
,
table
.
getRowCountApproximation
(),
return
getCostRangeIndex
(
masks
,
table
.
getRowCountApproximation
(),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/index/TreeIndex.java
浏览文件 @
ffd8fc37
...
@@ -321,7 +321,7 @@ public class TreeIndex extends BaseIndex {
...
@@ -321,7 +321,7 @@ public class TreeIndex extends BaseIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
SortOrder
sortOrder
)
{
return
getCostRangeIndex
(
masks
,
tableData
.
getRowCountApproximation
(),
return
getCostRangeIndex
(
masks
,
tableData
.
getRowCountApproximation
(),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/mvstore/db/MVDelegateIndex.java
浏览文件 @
ffd8fc37
...
@@ -91,7 +91,7 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex {
...
@@ -91,7 +91,7 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
10
*
getCostRangeIndex
(
masks
,
mainIndex
.
getRowCountApproximation
(),
return
10
*
getCostRangeIndex
(
masks
,
mainIndex
.
getRowCountApproximation
(),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
ffd8fc37
...
@@ -355,7 +355,7 @@ public class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -355,7 +355,7 @@ public class MVSecondaryIndex extends BaseIndex implements MVIndex {
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
try
{
try
{
return
10
*
getCostRangeIndex
(
masks
,
dataMap
.
sizeAsLongMax
(),
return
10
*
getCostRangeIndex
(
masks
,
dataMap
.
sizeAsLongMax
(),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
catch
(
IllegalStateException
e
)
{
}
catch
(
IllegalStateException
e
)
{
throw
DbException
.
get
(
ErrorCode
.
OBJECT_CLOSED
,
e
);
throw
DbException
.
get
(
ErrorCode
.
OBJECT_CLOSED
,
e
);
}
}
...
...
h2/src/main/org/h2/mvstore/db/MVSpatialIndex.java
浏览文件 @
ffd8fc37
...
@@ -240,12 +240,12 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
...
@@ -240,12 +240,12 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
getCostRangeIndex
(
masks
,
table
.
getRowCountApproximation
(),
return
getCostRangeIndex
(
masks
,
table
.
getRowCountApproximation
(),
filters
==
null
?
null
:
filters
[
filter
]
,
sortOrder
);
filters
,
filter
,
sortOrder
);
}
}
@Override
@Override
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
TableFilter
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
SpatialTreeIndex
.
getCostRangeIndex
(
masks
,
rowCount
,
columns
);
return
SpatialTreeIndex
.
getCostRangeIndex
(
masks
,
rowCount
,
columns
);
}
}
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
ffd8fc37
...
@@ -1206,8 +1206,7 @@ public class TestTableEngines extends TestBase {
...
@@ -1206,8 +1206,7 @@ public class TestTableEngines extends TestBase {
@Override
@Override
public
double
getCost
(
Session
session
,
int
[]
masks
,
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
return
getCostRangeIndex
(
masks
,
set
.
size
(),
filters
==
null
?
return
getCostRangeIndex
(
masks
,
set
.
size
(),
filters
,
filter
,
sortOrder
);
null
:
filters
[
filter
],
sortOrder
);
}
}
@Override
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论