Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
46842ae5
提交
46842ae5
authored
10月 29, 2015
作者:
S.Vladykin
浏览文件
操作
浏览文件
下载
差异文件
merged from master
上级
37f6be3b
39ec93ff
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
49 行增加
和
1 行删除
+49
-1
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+27
-0
PlanItem.java
h2/src/main/org/h2/table/PlanItem.java
+9
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+12
-1
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+1
-0
没有找到文件。
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
46842ae5
...
@@ -347,6 +347,33 @@ public class IndexCondition {
...
@@ -347,6 +347,33 @@ public class IndexCondition {
return
column
;
return
column
;
}
}
/**
* Get expression.
*
* @return Expression.
*/
public
Expression
getExpression
()
{
return
expression
;
}
/**
* Get expression list.
*
* @return Expression list.
*/
public
List
<
Expression
>
getExpressionList
()
{
return
expressionList
;
}
/**
* Get expression query.
*
* @return Expression query.
*/
public
Query
getExpressionQuery
()
{
return
expressionQuery
;
}
/**
/**
* Check if the expression can be evaluated.
* Check if the expression can be evaluated.
*
*
...
...
h2/src/main/org/h2/table/PlanItem.java
浏览文件 @
46842ae5
...
@@ -18,10 +18,19 @@ public class PlanItem {
...
@@ -18,10 +18,19 @@ public class PlanItem {
*/
*/
double
cost
;
double
cost
;
private
int
[]
masks
;
private
Index
index
;
private
Index
index
;
private
PlanItem
joinPlan
;
private
PlanItem
joinPlan
;
private
PlanItem
nestedJoinPlan
;
private
PlanItem
nestedJoinPlan
;
void
setMasks
(
int
[]
masks
)
{
this
.
masks
=
masks
;
}
int
[]
getMasks
()
{
return
masks
;
}
void
setIndex
(
Index
index
)
{
void
setIndex
(
Index
index
)
{
this
.
index
=
index
;
this
.
index
=
index
;
}
}
...
...
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
46842ae5
...
@@ -86,6 +86,7 @@ public class TableFilter implements ColumnResolver {
...
@@ -86,6 +86,7 @@ public class TableFilter implements ColumnResolver {
private
final
Select
select
;
private
final
Select
select
;
private
String
alias
;
private
String
alias
;
private
Index
index
;
private
Index
index
;
private
int
[]
masks
;
private
int
scanCount
;
private
int
scanCount
;
private
boolean
evaluatable
;
private
boolean
evaluatable
;
...
@@ -225,6 +226,7 @@ public class TableFilter implements ColumnResolver {
...
@@ -225,6 +226,7 @@ public class TableFilter implements ColumnResolver {
sortOrder
=
select
.
getSortOrder
();
sortOrder
=
select
.
getSortOrder
();
}
}
item
=
table
.
getBestPlanItem
(
s
,
masks
,
filters
,
filter
,
sortOrder
);
item
=
table
.
getBestPlanItem
(
s
,
masks
,
filters
,
filter
,
sortOrder
);
item
.
setMasks
(
masks
);
// The more index conditions, the earlier the table.
// The more index conditions, the earlier the table.
// This is to ensure joins without indexes run quickly:
// This is to ensure joins without indexes run quickly:
// x (x.a=10); y (x.b=y.b) - see issue 113
// x (x.a=10); y (x.b=y.b) - see issue 113
...
@@ -269,7 +271,7 @@ public class TableFilter implements ColumnResolver {
...
@@ -269,7 +271,7 @@ public class TableFilter implements ColumnResolver {
}
}
/**
/**
* Set what plan item (index, cost
) to use
use.
* Set what plan item (index, cost
, masks) to
use.
*
*
* @param item the plan item
* @param item the plan item
*/
*/
...
@@ -280,6 +282,7 @@ public class TableFilter implements ColumnResolver {
...
@@ -280,6 +282,7 @@ public class TableFilter implements ColumnResolver {
return
;
return
;
}
}
setIndex
(
item
.
getIndex
());
setIndex
(
item
.
getIndex
());
masks
=
item
.
getMasks
();
if
(
nestedJoin
!=
null
)
{
if
(
nestedJoin
!=
null
)
{
if
(
item
.
getNestedJoinPlan
()
!=
null
)
{
if
(
item
.
getNestedJoinPlan
()
!=
null
)
{
nestedJoin
.
setPlanItem
(
item
.
getNestedJoinPlan
());
nestedJoin
.
setPlanItem
(
item
.
getNestedJoinPlan
());
...
@@ -798,6 +801,14 @@ public class TableFilter implements ColumnResolver {
...
@@ -798,6 +801,14 @@ public class TableFilter implements ColumnResolver {
}
}
}
}
public
int
[]
getMasks
()
{
return
masks
;
}
public
ArrayList
<
IndexCondition
>
getIndexConditions
()
{
return
indexConditions
;
}
public
Index
getIndex
()
{
public
Index
getIndex
()
{
return
index
;
return
index
;
}
}
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
46842ae5
...
@@ -1096,6 +1096,7 @@ public class TestTableEngines extends TestBase {
...
@@ -1096,6 +1096,7 @@ public class TestTableEngines extends TestBase {
@Override
@Override
public
IndexLookupBatch
createLookupBatch
(
final
TableFilter
filter
)
{
public
IndexLookupBatch
createLookupBatch
(
final
TableFilter
filter
)
{
assert
filter
.
getMasks
()
!=
null
||
"scan"
.
equals
(
getName
());
final
int
preferedSize
=
preferedBatchSize
;
final
int
preferedSize
=
preferedBatchSize
;
return
preferedSize
==
0
?
null
:
new
IndexLookupBatch
()
{
return
preferedSize
==
0
?
null
:
new
IndexLookupBatch
()
{
List
<
SearchRow
>
searchRows
=
New
.
arrayList
();
List
<
SearchRow
>
searchRows
=
New
.
arrayList
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论