use of org.hsqldb_voltpatches.lib.HsqlList in project voltdb by VoltDB.
the class Expression method resolveTableColumns.
// A VoltDB extension to support indexed expressions
private void resolveTableColumns(Table table) {
HsqlList set = new HsqlArrayList();
collectAllColumnExpressions(set);
for (int i = 0; i < set.size(); i++) {
ExpressionColumn array_element = (ExpressionColumn) set.get(i);
ColumnSchema column = table.getColumn(table.getColumnIndex(array_element.getAlias()));
array_element.setAttributesAsColumn(column, false);
}
}
use of org.hsqldb_voltpatches.lib.HsqlList in project voltdb by VoltDB.
the class ParserDDL method getBaseColumnNames.
/// Collect the names of the unique columns underlying a list of indexed expressions.
private OrderedHashSet getBaseColumnNames(java.util.List<Expression> indexExprs) {
OrderedHashSet set = new OrderedHashSet();
HsqlList col_list = new HsqlArrayList();
for (Expression expression : indexExprs) {
expression.collectAllColumnExpressions(col_list);
}
for (int i = 0; i < col_list.size(); i++) {
String colName = ((ExpressionColumn) col_list.get(i)).columnName;
set.add(colName);
}
return set;
}
use of org.hsqldb_voltpatches.lib.HsqlList in project voltdb by VoltDB.
the class Expression method collectRangeVariables.
/**
* collects all range variables in expression tree
*/
void collectRangeVariables(RangeVariable[] rangeVariables, Set set) {
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] != null) {
nodes[i].collectRangeVariables(rangeVariables, set);
}
}
if (subQuery != null && subQuery.queryExpression != null) {
HsqlList unresolvedExpressions = subQuery.queryExpression.getUnresolvedExpressions();
if (unresolvedExpressions != null) {
for (int i = 0; i < unresolvedExpressions.size(); i++) {
Expression e = (Expression) unresolvedExpressions.get(i);
e.collectRangeVariables(rangeVariables, set);
}
}
}
}
use of org.hsqldb_voltpatches.lib.HsqlList in project voltdb by VoltDB.
the class ParserRoutine method readCaseWhen.
private HsqlArrayList readCaseWhen(Routine routine, StatementCompound context) {
HsqlArrayList list = new HsqlArrayList();
RangeVariable[] rangeVariables = context == null ? routine.getParameterRangeVariables() : context.getRangeVariables();
HsqlList unresolved = null;
Expression condition = null;
Statement statement;
Statement[] statements;
do {
readThis(Tokens.WHEN);
condition = XreadBooleanValueExpression();
unresolved = condition.resolveColumnReferences(rangeVariables, rangeVariables.length, unresolved, false);
ExpressionColumn.checkColumnsResolved(unresolved);
unresolved = null;
condition.resolveTypes(session, null);
statement = new StatementSimple(StatementTypes.CONDITION, condition);
list.add(statement);
readThis(Tokens.THEN);
statements = readSQLProcedureStatementList(routine, context);
for (int i = 0; i < statements.length; i++) {
list.add(statements[i]);
}
if (token.tokenType != Tokens.WHEN) {
break;
}
} while (true);
return list;
}
use of org.hsqldb_voltpatches.lib.HsqlList in project voltdb by VoltDB.
the class ParserRoutine method readSimpleCaseWhen.
private HsqlArrayList readSimpleCaseWhen(Routine routine, StatementCompound context) {
HsqlArrayList list = new HsqlArrayList();
RangeVariable[] rangeVariables = context == null ? routine.getParameterRangeVariables() : context.getRangeVariables();
HsqlList unresolved = null;
Expression condition = null;
Statement statement;
Statement[] statements;
Expression predicand = XreadRowValuePredicand();
do {
readThis(Tokens.WHEN);
do {
Expression newCondition = XreadPredicateRightPart(predicand);
if (predicand == newCondition) {
newCondition = new ExpressionLogical(predicand, XreadRowValuePredicand());
}
unresolved = newCondition.resolveColumnReferences(rangeVariables, rangeVariables.length, unresolved, false);
ExpressionColumn.checkColumnsResolved(unresolved);
unresolved = null;
newCondition.resolveTypes(session, null);
if (condition == null) {
condition = newCondition;
} else {
condition = new ExpressionLogical(OpTypes.OR, condition, newCondition);
}
if (token.tokenType == Tokens.COMMA) {
read();
} else {
break;
}
} while (true);
statement = new StatementSimple(StatementTypes.CONDITION, condition);
list.add(statement);
readThis(Tokens.THEN);
statements = readSQLProcedureStatementList(routine, context);
for (int i = 0; i < statements.length; i++) {
list.add(statements[i]);
}
if (token.tokenType != Tokens.WHEN) {
break;
}
} while (true);
return list;
}
Aggregations