提交 46842ae5 authored 作者: S.Vladykin's avatar S.Vladykin

merged from master

......@@ -347,6 +347,33 @@ public class IndexCondition {
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.
*
......
......@@ -18,10 +18,19 @@ public class PlanItem {
*/
double cost;
private int[] masks;
private Index index;
private PlanItem joinPlan;
private PlanItem nestedJoinPlan;
void setMasks(int[] masks) {
this.masks = masks;
}
int[] getMasks() {
return masks;
}
void setIndex(Index index) {
this.index = index;
}
......
......@@ -86,6 +86,7 @@ public class TableFilter implements ColumnResolver {
private final Select select;
private String alias;
private Index index;
private int[] masks;
private int scanCount;
private boolean evaluatable;
......@@ -225,6 +226,7 @@ public class TableFilter implements ColumnResolver {
sortOrder = select.getSortOrder();
}
item = table.getBestPlanItem(s, masks, filters, filter, sortOrder);
item.setMasks(masks);
// The more index conditions, the earlier the table.
// This is to ensure joins without indexes run quickly:
// x (x.a=10); y (x.b=y.b) - see issue 113
......@@ -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
*/
......@@ -280,6 +282,7 @@ public class TableFilter implements ColumnResolver {
return;
}
setIndex(item.getIndex());
masks = item.getMasks();
if (nestedJoin != null) {
if (item.getNestedJoinPlan() != null) {
nestedJoin.setPlanItem(item.getNestedJoinPlan());
......@@ -798,6 +801,14 @@ public class TableFilter implements ColumnResolver {
}
}
public int[] getMasks() {
return masks;
}
public ArrayList<IndexCondition> getIndexConditions() {
return indexConditions;
}
public Index getIndex() {
return index;
}
......
......@@ -1096,6 +1096,7 @@ public class TestTableEngines extends TestBase {
@Override
public IndexLookupBatch createLookupBatch(final TableFilter filter) {
assert filter.getMasks() != null || "scan".equals(getName());
final int preferedSize = preferedBatchSize;
return preferedSize == 0 ? null : new IndexLookupBatch() {
List<SearchRow> searchRows = New.arrayList();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论