Search in sources :

Example 26 with TupleValueExpression

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

the class StmtTargetTableScan method findPartitioningColumns.

private List<SchemaColumn> findPartitioningColumns() {
    if (m_partitioningColumns != null) {
        return m_partitioningColumns;
    }
    if (getIsReplicated()) {
        return null;
    }
    Column partitionCol = m_table.getPartitioncolumn();
    // because it has no recognized partitioning join key.
    if (partitionCol == null) {
        return null;
    }
    String tbName = m_table.getTypeName();
    TupleValueExpression tve = new TupleValueExpression(tbName, m_tableAlias, partitionCol, partitionCol.getIndex());
    String colName = partitionCol.getTypeName();
    SchemaColumn scol = new SchemaColumn(tbName, m_tableAlias, colName, colName, tve);
    m_partitioningColumns = new ArrayList<SchemaColumn>();
    m_partitioningColumns.add(scol);
    return m_partitioningColumns;
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression) SchemaColumn(org.voltdb.plannodes.SchemaColumn) Column(org.voltdb.catalog.Column) SchemaColumn(org.voltdb.plannodes.SchemaColumn)

Example 27 with TupleValueExpression

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

the class AbstractReceivePlanNode method resolveColumnIndexes.

protected void resolveColumnIndexes(NodeSchema outputSchema) {
    // 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();
    assert (inputSchema.equals(outputSchema));
    for (SchemaColumn col : 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);
    }
// output schema for ReceivePlanNode should never be re-sorted
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression) AbstractExpression(org.voltdb.expressions.AbstractExpression)

Example 28 with TupleValueExpression

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

the class AbstractScanPlanNode method setScanColumns.

protected void setScanColumns(List<SchemaColumn> scanColumns) {
    assert (scanColumns != null);
    int i = 0;
    for (SchemaColumn col : scanColumns) {
        TupleValueExpression tve = (TupleValueExpression) col.getExpression();
        int difftor = tve.getDifferentiator();
        m_differentiatorMap.put(difftor, i);
        SchemaColumn clonedCol = col.clone();
        clonedCol.setDifferentiator(i);
        m_tableScanSchema.addColumn(clonedCol);
        ++i;
    }
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression)

Example 29 with TupleValueExpression

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

the class StmtTableScan method resolveTVE.

public AbstractExpression resolveTVE(TupleValueExpression tve) {
    AbstractExpression resolvedExpr = processTVE(tve, tve.getColumnName());
    List<TupleValueExpression> tves = ExpressionUtil.getTupleValueExpressions(resolvedExpr);
    for (TupleValueExpression subqTve : tves) {
        resolveLeafTve(subqTve);
    }
    return resolvedExpr;
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression) AbstractExpression(org.voltdb.expressions.AbstractExpression)

Example 30 with TupleValueExpression

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

the class TestIndexSelection method checkIndexPredicateDoesNotHave.

private void checkIndexPredicateDoesNotHave(AbstractPlanNode pn, String... columns) {
    assertEquals(1, pn.getChildCount());
    pn = pn.getChild(0);
    assertEquals(PlanNodeType.INDEXSCAN, pn.getPlanNodeType());
    IndexScanPlanNode ipn = (IndexScanPlanNode) pn;
    AbstractExpression pred = ipn.getPredicate();
    assertNotNull(pred);
    List<TupleValueExpression> tves = pred.findAllTupleValueSubexpressions();
    for (TupleValueExpression tve : tves) {
        for (String column : columns) {
            assertFalse(tve.getColumnName().equals(column));
        }
    }
}
Also used : TupleValueExpression(org.voltdb.expressions.TupleValueExpression) AbstractExpression(org.voltdb.expressions.AbstractExpression) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

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