use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.
the class IndexScanPlanNode method resolveColumnIndexes.
@Override
public void resolveColumnIndexes() {
// IndexScanPlanNode has TVEs that need index resolution in
// several expressions.
// Collect all the TVEs in the AbstractExpression members.
List<TupleValueExpression> index_tves = new ArrayList<>();
index_tves.addAll(ExpressionUtil.getTupleValueExpressions(m_endExpression));
index_tves.addAll(ExpressionUtil.getTupleValueExpressions(m_initialExpression));
index_tves.addAll(ExpressionUtil.getTupleValueExpressions(m_skip_null_predicate));
// and update their indexes against the table schema
for (TupleValueExpression tve : index_tves) {
tve.setColumnIndexUsingSchema(m_tableSchema);
}
// Do the same for each search key expression.
for (AbstractExpression search_exp : m_searchkeyExpressions) {
index_tves = ExpressionUtil.getTupleValueExpressions(search_exp);
// and update their indexes against the table schema
for (TupleValueExpression tve : index_tves) {
tve.setColumnIndexUsingSchema(m_tableSchema);
}
}
// now do the common scan node work
super.resolveColumnIndexes();
}
use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.
the class LimitPlanNode method resolveColumnIndexes.
@Override
public void resolveColumnIndexes() {
// Need to order and resolve indexes of output columns
assert (m_children.size() == 1);
AbstractPlanNode childNode = m_children.get(0);
childNode.resolveColumnIndexes();
NodeSchema inputSchema = childNode.getOutputSchema();
for (SchemaColumn col : m_outputSchema.getColumns()) {
AbstractExpression colExpr = col.getExpression();
// At this point, they'd better all be TVEs.
assert (colExpr instanceof TupleValueExpression);
TupleValueExpression tve = (TupleValueExpression) colExpr;
tve.setColumnIndexUsingSchema(inputSchema);
}
m_outputSchema.sortByTveIndex();
}
use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.
the class TupleScanPlanNode method generateOutputSchema.
@Override
public void generateOutputSchema(Database db) {
if (m_tableSchema == null) {
m_tableSchema = new NodeSchema();
int columnIdx = 1;
for (AbstractExpression colExpr : m_columnList) {
assert (colExpr instanceof ParameterValueExpression);
ParameterValueExpression pve = (ParameterValueExpression) colExpr;
// must produce a tuple value expression for this column.
String columnName = "C" + Integer.toString(columnIdx);
TupleValueExpression tve = new TupleValueExpression(m_targetTableName, m_targetTableAlias, columnName, columnName, pve, columnIdx);
m_tableSchema.addColumn(m_targetTableName, m_targetTableAlias, columnName, columnName, tve);
++columnIdx;
}
m_outputSchema = m_tableSchema;
m_hasSignificantOutputSchema = true;
}
}
use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.
the class TupleScanPlanNode method resolveColumnIndexes.
@Override
public void resolveColumnIndexes() {
// output columns
for (SchemaColumn col : m_outputSchema.getColumns()) {
AbstractExpression colExpr = col.getExpression();
// At this point, they'd better all be TVEs.
assert (colExpr instanceof TupleValueExpression);
TupleValueExpression tve = (TupleValueExpression) colExpr;
tve.setColumnIndexUsingSchema(m_tableSchema);
}
m_outputSchema.sortByTveIndex();
}
use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.
the class WindowFunctionPlanNode method resolveColumnIndexesUsingSchema.
public void resolveColumnIndexesUsingSchema(NodeSchema inputSchema) {
Collection<TupleValueExpression> allTves;
// get all the TVEs in the output columns
for (SchemaColumn col : m_outputSchema.getColumns()) {
AbstractExpression colExpr = col.getExpression();
allTves = ExpressionUtil.getTupleValueExpressions(colExpr);
for (TupleValueExpression tve : allTves) {
int index = tve.setColumnIndexUsingSchema(inputSchema);
if (index == -1) {
// check to see if this TVE is the aggregate output
if (!tve.getTableName().equals(AbstractParsedStmt.TEMP_TABLE_NAME)) {
throw new RuntimeException("Unable to find index for column: " + tve.getColumnName());
}
}
}
}
// sure these should be TVEs in the long term.
for (List<AbstractExpression> agg_exps : m_aggregateExpressions) {
if (agg_exps != null) {
for (AbstractExpression agg_exp : agg_exps) {
allTves = ExpressionUtil.getTupleValueExpressions(agg_exp);
for (TupleValueExpression tve : allTves) {
tve.setColumnIndexUsingSchema(inputSchema);
}
}
}
}
// Aggregates also need to resolve indexes for partition by inputs
for (AbstractExpression group_exp : m_partitionByExpressions) {
allTves = ExpressionUtil.getTupleValueExpressions(group_exp);
for (TupleValueExpression tve : allTves) {
tve.setColumnIndexUsingSchema(inputSchema);
}
}
// one, which is the general case.
for (AbstractExpression obExpr : m_orderByExpressions) {
allTves = ExpressionUtil.getTupleValueExpressions(obExpr);
for (TupleValueExpression tve : allTves) {
tve.setColumnIndexUsingSchema(inputSchema);
}
}
/*
* Is this needed?
*/
resolveSubqueryColumnIndexes();
}
Aggregations