use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class QueryExpression method getUnionColumns.
private HashMappedList getUnionColumns() {
if (unionCorresponding || leftQueryExpression == null) {
HashMappedList columns = ((TableDerived) resultTable).columnList;
HashMappedList list = new HashMappedList();
for (int i = 0; i < unionColumnMap.length; i++) {
ColumnSchema column = (ColumnSchema) columns.get(i);
list.add(column.getName().name, column);
}
return list;
}
return leftQueryExpression.getUnionColumns();
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class QuerySpecification method getEquiJoinExpressions.
public Expression getEquiJoinExpressions(OrderedHashSet nameSet, RangeVariable rightRange, boolean fullList) {
HashSet set = new HashSet();
Expression result = null;
OrderedHashSet joinColumnNames = new OrderedHashSet();
for (int i = 0; i < rangeVariableList.size(); i++) {
RangeVariable range = (RangeVariable) rangeVariableList.get(i);
HashMappedList columnList = range.rangeTable.columnList;
for (int j = 0; j < columnList.size(); j++) {
ColumnSchema column = (ColumnSchema) columnList.get(j);
String name = range.getColumnAlias(j);
boolean columnInList = nameSet.contains(name);
boolean namedJoin = range.namedJoinColumns != null && range.namedJoinColumns.contains(name);
boolean repeated = !namedJoin && !set.add(name);
if (repeated && (!fullList || columnInList)) {
throw Error.error(ErrorCode.X_42578, name);
}
if (!columnInList) {
continue;
}
joinColumnNames.add(name);
int position = rightRange.rangeTable.getColumnIndex(name);
ColumnSchema rightColumn = rightRange.rangeTable.getColumn(position);
Expression e = new ExpressionLogical(range, column, rightRange, rightColumn);
result = ExpressionLogical.andExpressions(result, e);
ExpressionColumn col = range.getColumnExpression(name);
if (col == null) {
col = new ExpressionColumn(new Expression[] { e.getLeftNode(), e.getRightNode() }, name);
range.addNamedJoinColumnExpression(name, col);
} else {
col.nodes = (Expression[]) ArrayUtil.resizeArray(col.nodes, col.nodes.length + 1);
col.nodes[col.nodes.length - 1] = e.getRightNode();
}
rightRange.addNamedJoinColumnExpression(name, col);
}
}
if (fullList && !joinColumnNames.containsAll(nameSet)) {
throw Error.error(ErrorCode.X_42501);
}
rightRange.addNamedJoinColumns(joinColumnNames);
return result;
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class QueryExpression method getResultColumnNames.
public HsqlName[] getResultColumnNames() {
if (resultTable == null) {
return leftQueryExpression.getResultColumnNames();
}
HashMappedList list = ((TableDerived) resultTable).columnList;
HsqlName[] resultColumnNames = new HsqlName[list.size()];
for (int i = 0; i < resultColumnNames.length; i++) {
resultColumnNames[i] = ((ColumnSchema) list.get(i)).getName();
}
return resultColumnNames;
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class QuerySpecification method createResultTable.
@Override
void createResultTable(Session session) {
HsqlName tableName;
HashMappedList columnList;
int tableType;
tableName = session.database.nameManager.getSubqueryTableName();
tableType = persistenceScope == TableBase.SCOPE_STATEMENT ? TableBase.SYSTEM_SUBQUERY : TableBase.RESULT_TABLE;
columnList = new HashMappedList();
for (int i = 0; i < indexLimitVisible; i++) {
Expression e = exprColumns[i];
SimpleName simpleName = e.getSimpleName();
String nameString = simpleName.name;
HsqlName name = session.database.nameManager.newColumnSchemaHsqlName(tableName, simpleName);
if (!accessibleColumns[i]) {
nameString = HsqlNameManager.getAutoNoNameColumnString(i);
}
ColumnSchema column = new ColumnSchema(name, e.dataType, true, false, null);
columnList.add(nameString, column);
}
try {
resultTable = new TableDerived(session.database, tableName, tableType, columnTypes, columnList, null);
} catch (Exception e) {
}
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class QueryExpression method createResultTable.
void createResultTable(Session session) {
HsqlName tableName;
HashMappedList columnList;
int tableType;
tableName = session.database.nameManager.getSubqueryTableName();
tableType = persistenceScope == TableBase.SCOPE_STATEMENT ? TableBase.SYSTEM_SUBQUERY : TableBase.RESULT_TABLE;
columnList = leftQueryExpression.getUnionColumns();
try {
resultTable = new TableDerived(session.database, tableName, tableType, unionColumnTypes, columnList, null);
} catch (Exception e) {
}
}
Aggregations