use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class TupleScanPlanNode method explainPlanForNode.
@Override
public String explainPlanForNode(String indent) {
String result = "(";
String connector = "";
for (AbstractExpression arg : m_columnList) {
result += connector + arg.explain(indent);
connector = ", ";
}
result += ")";
return result;
}
use of org.voltdb.expressions.AbstractExpression 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.AbstractExpression 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();
}
use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class NestLoopIndexPlanNode method generateOutputSchema.
@Override
public void generateOutputSchema(Database db) {
// Important safety tip regarding this inlined
// index scan and ITS inlined projection:
// That projection is currently only used/usable as
// a means to narrow the set of columns from the
// indexscan's target table that make it into the
// rest of the plan. the expressions that are
// given to the projection are currently not ever used
IndexScanPlanNode inlineScan = (IndexScanPlanNode) m_inlineNodes.get(PlanNodeType.INDEXSCAN);
assert (inlineScan != null);
inlineScan.generateOutputSchema(db);
assert (m_children.size() == 1);
m_children.get(0).generateOutputSchema(db);
// Join the schema together to form the output schema
// The child subplan's output is the outer table
// The inlined node's output is the inner table.
//
// Note that the inner table's contribution to the join_tuple doesn't include
// all the columns from the inner table---just the ones needed as determined by
// the inlined scan's own inlined projection, as described above.
m_outputSchemaPreInlineAgg = m_children.get(0).getOutputSchema().join(inlineScan.getOutputSchema()).copyAndReplaceWithTVE();
m_hasSignificantOutputSchema = true;
generateRealOutputSchema(db);
// Generate the output schema for subqueries
Collection<AbstractExpression> subqueryExpressions = findAllSubquerySubexpressions();
for (AbstractExpression subqueryExpression : subqueryExpressions) {
assert (subqueryExpression instanceof AbstractSubqueryExpression);
((AbstractSubqueryExpression) subqueryExpression).generateOutputSchema(db);
}
}
use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class NodeSchema method addAllSubexpressionsOfClassFromNodeSchema.
public void addAllSubexpressionsOfClassFromNodeSchema(Set<AbstractExpression> exprs, Class<? extends AbstractExpression> aeClass) {
for (SchemaColumn column : getColumns()) {
AbstractExpression colExpr = column.getExpression();
if (colExpr == null) {
continue;
}
Collection<AbstractExpression> found = colExpr.findAllSubexpressionsOfClass(aeClass);
exprs.addAll(found);
}
}
Aggregations