Search in sources :

Example 16 with SortOrder

use of org.h2.result.SortOrder 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;
}
Also used : Column(org.h2.table.Column) IndexColumn(org.h2.table.IndexColumn)

Aggregations

IndexColumn (org.h2.table.IndexColumn)8 Column (org.h2.table.Column)7 SortOrder (org.h2.result.SortOrder)4 TableFilter (org.h2.table.TableFilter)3 Query (org.h2.command.dml.Query)2 IndexCondition (org.h2.index.IndexCondition)2 Value (org.h2.value.Value)2 ObjectStatisticsImpl (org.apache.ignite.internal.processors.query.stat.ObjectStatisticsImpl)1 Prepared (org.h2.command.Prepared)1 AlterTableAddConstraint (org.h2.command.ddl.AlterTableAddConstraint)1 SelectOrderBy (org.h2.command.dml.SelectOrderBy)1 Constraint (org.h2.constraint.Constraint)1 Database (org.h2.engine.Database)1 DbObject (org.h2.engine.DbObject)1 Expression (org.h2.expression.Expression)1 Parameter (org.h2.expression.Parameter)1 ValueExpression (org.h2.expression.ValueExpression)1 Index (org.h2.index.Index)1 ViewIndex (org.h2.index.ViewIndex)1 Trace (org.h2.message.Trace)1