Search in sources :

Example 81 with TupleValueExpression

use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.

the class NodeSchema method replaceTableClone.

public NodeSchema replaceTableClone(String tableAlias) {
    NodeSchema copy = new NodeSchema();
    for (int colIndex = 0; colIndex < m_columns.size(); ++colIndex) {
        SchemaColumn column = m_columns.get(colIndex);
        String colAlias = column.getColumnAlias();
        int differentiator = column.getDifferentiator();
        TupleValueExpression tve = new TupleValueExpression(tableAlias, tableAlias, colAlias, colAlias, colIndex, differentiator);
        tve.setTypeSizeAndInBytes(column);
        copy.addColumn(tableAlias, tableAlias, colAlias, colAlias, tve, differentiator);
    }
    return copy;
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression)

Example 82 with TupleValueExpression

use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.

the class OrderByPlanNode method resolveColumnIndexes.

@Override
public void resolveColumnIndexes() {
    // the sort 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();
    resolveSortIndexesUsingSchema(inputSchema);
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression) AbstractExpression(org.voltdb.expressions.AbstractExpression)

Example 83 with TupleValueExpression

use of org.voltdb.expressions.TupleValueExpression in project voltdb by VoltDB.

the class WindowFunctionPlanNode method generateOutputSchema.

@Override
public void generateOutputSchema(Database db) {
    // We only expect one window function here.
    assert (getAggregateFunctionCount() == 1);
    if (m_outputSchema == null) {
        m_outputSchema = new NodeSchema();
    } else {
        assert (getOutputSchema().size() == 0);
    }
    assert (m_children.size() == 1);
    m_children.get(0).generateOutputSchema(db);
    NodeSchema inputSchema = m_children.get(0).getOutputSchema();
    // We already created the TVE for this expression.
    for (int ii = 0; ii < getAggregateFunctionCount(); ii += 1) {
        TupleValueExpression tve = m_outputTVEs.get(ii);
        getOutputSchema().addColumn(tve.getTableName(), tve.getTableAlias(), tve.getColumnName(), tve.getColumnAlias(), tve);
    }
    // Just copy the input columns to the output schema.
    for (SchemaColumn col : inputSchema.getColumns()) {
        getOutputSchema().addColumn(col.clone());
    }
    m_hasSignificantOutputSchema = true;
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression)

Aggregations

TupleValueExpression (org.voltdb.expressions.TupleValueExpression)83 AbstractExpression (org.voltdb.expressions.AbstractExpression)59 SchemaColumn (org.voltdb.plannodes.SchemaColumn)19 Column (org.voltdb.catalog.Column)17 ArrayList (java.util.ArrayList)16 HashSet (java.util.HashSet)14 Constraint (org.voltdb.catalog.Constraint)13 Table (org.voltdb.catalog.Table)10 ColumnRef (org.voltdb.catalog.ColumnRef)9 ParameterValueExpression (org.voltdb.expressions.ParameterValueExpression)9 StmtTableScan (org.voltdb.planner.parseinfo.StmtTableScan)9 JSONException (org.json_voltpatches.JSONException)8 AbstractPlanNode (org.voltdb.plannodes.AbstractPlanNode)8 NodeSchema (org.voltdb.plannodes.NodeSchema)8 ConstantValueExpression (org.voltdb.expressions.ConstantValueExpression)7 VoltXMLElement (org.hsqldb_voltpatches.VoltXMLElement)6 Set (java.util.Set)5 Index (org.voltdb.catalog.Index)5 StmtTargetTableScan (org.voltdb.planner.parseinfo.StmtTargetTableScan)5 ProjectionPlanNode (org.voltdb.plannodes.ProjectionPlanNode)5