use of org.h2.table.TableFilter in project ignite by apache.
the class GridSqlQueryParser method collectOptimizedTableFiltersOrder.
/**
* @param qry Query.
*/
private void collectOptimizedTableFiltersOrder(Query qry) {
if (qry instanceof SelectUnion) {
collectOptimizedTableFiltersOrder(((SelectUnion) qry).getLeft());
collectOptimizedTableFiltersOrder(((SelectUnion) qry).getRight());
} else {
Select select = (Select) qry;
TableFilter filter = select.getTopTableFilter();
int i = 0;
do {
assert0(filter != null, select);
assert0(filter.getNestedJoin() == null, select);
// Here all the table filters must have generated unique aliases,
// thus we can store them in the same map for all the subqueries.
optimizedTableFilterOrder.put(filter.getTableAlias(), i++);
Table tbl = filter.getTable();
// Go down and collect inside of optimized subqueries.
if (tbl instanceof TableView) {
ViewIndex viewIdx = (ViewIndex) filter.getIndex();
collectOptimizedTableFiltersOrder(viewIdx.getQuery());
}
filter = filter.getJoin();
} while (filter != null);
}
}
use of org.h2.table.TableFilter in project ignite by apache.
the class SqlSystemIndex method getCost.
/**
* {@inheritDoc}
*/
@Override
public double getCost(Session ses, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet<Column> allColsSet) {
double colsCost = getRowCountApproximation();
if (masks != null) {
for (Column col : columns) {
// We can effictivly use only EQUALITY condition in system views.
if ((masks[col.getColumnId()] & IndexCondition.EQUALITY) != 0)
colsCost /= 2;
}
}
double idxCost = Constants.COST_ROW_OFFSET + colsCost;
if (((SystemViewH2Adapter) table).view.isDistributed())
idxCost *= DISTRIBUTED_MUL;
return idxCost;
}
Aggregations