/* This file is part of VoltDB.
* Copyright (C) 2008-2010 VoltDB L.L.C.
*
* VoltDB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VoltDB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VoltDB. If not, see <http://www.gnu.org/licenses/>.
*/
package org.voltdb.planner;
import java.util.ArrayList;
import org.voltdb.catalog.Index;
import org.voltdb.expressions.AbstractExpression;
import org.voltdb.types.IndexLookupType;
import org.voltdb.types.SortDirectionType;
public class AccessPath {
Index index = null;
IndexUseType use = IndexUseType.COVERING_UNIQUE_EQUALITY;
boolean nestLoopIndexJoin = false;
boolean keyIterate = false;
IndexLookupType lookupType = IndexLookupType.EQ;
SortDirectionType sortDirection = SortDirectionType.INVALID;
ArrayList<AbstractExpression> indexExprs = new ArrayList<AbstractExpression>();
ArrayList<AbstractExpression> endExprs = new ArrayList<AbstractExpression>();
ArrayList<AbstractExpression> otherExprs = new ArrayList<AbstractExpression>();
ArrayList<AbstractExpression> joinExprs = new ArrayList<AbstractExpression>();
@Override
public String toString() {
String retval = "";
retval += "INDEX: " + ((index == null) ? "NULL" : (index.getParent().getTypeName() + "." + index.getTypeName())) + "\n";
retval += "USE: " + use.toString() + "\n";
retval += "TYPE: " + lookupType.toString() + "\n";
retval += "DIR: " + sortDirection.toString() + "\n";
retval += "ITER?: " + String.valueOf(keyIterate) + "\n";
retval += "NLIJ?: " + String.valueOf(nestLoopIndexJoin) + "\n";
retval += "IDX EXPRS:\n";
int i = 0;
for (AbstractExpression expr : indexExprs)
retval += "\t(" + String.valueOf(i++) + ") " + expr.toString() + "\n";
retval += "END EXPRS:\n";
i = 0;
for (AbstractExpression expr : endExprs)
retval += "\t(" + String.valueOf(i++) + ") " + expr.toString() + "\n";
retval += "OTHER EXPRS:\n";
i = 0;
for (AbstractExpression expr : otherExprs)
retval += "\t(" + String.valueOf(i++) + ") " + expr.toString() + "\n";
retval += "JOIN EXPRS:\n";
i = 0;
for (AbstractExpression expr : joinExprs)
retval += "\t(" + String.valueOf(i++) + ") " + expr.toString() + "\n";
return retval;
}
}