Examples of TupleValueExpression


Examples of org.voltdb.expressions.TupleValueExpression

            List<ColumnRef> indexedColRefs = CatalogUtil.getSortedCatalogItems(m_catalogIndex.getColumns(), "index");
            for (int i = 0; i <= nextKeyIndex; i++) {
                ColumnRef colRef = indexedColRefs.get(i);
                Column col = colRef.getColumn();
                TupleValueExpression tve = new TupleValueExpression(m_targetTableName, m_targetTableAlias,
                        col.getTypeName(), col.getTypeName());

                tve.setTypeSizeBytes(col.getType(), col.getSize(), col.getInbytes());

                tve.resolveForTable((Table)m_catalogIndex.getParent());
                indexedExprs.add(tve);
            }
        } else {
            try {
                indexedExprs = AbstractExpression.fromJSONArrayString(exprsjson, m_tableScan);
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

        for (SchemaColumn col : m_outputSchema.getColumns())
        {
            // At this point, they'd better all be TVEs.
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index = tve.resolveColumnIndexesUsingSchema(input_schema);
            tve.setColumnIndex(index);
        }
        m_outputSchema.sortByTveIndex();
    }
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

        NodeSchema input_schema = m_children.get(0).getOutputSchema();
        for (SchemaColumn col : m_outputSchema.getColumns())
        {
            // At this point, they'd better all be TVEs.
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index = tve.resolveColumnIndexesUsingSchema(input_schema);
            tve.setColumnIndex(index);
        }
        m_outputSchema.sortByTveIndex();
    }
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

            // If not, mark this flag true to get initialized in EE.
            m_hasSignificantOutputSchema = m_children.size() == 0 ? true : false;

            // This TVE is magic and repeats unfortunately like this
            // throughout the planner.  Consolidate at some point --izzy
            TupleValueExpression tve = new TupleValueExpression(
                    "VOLT_TEMP_TABLE", "VOLT_TEMP_TABLE", "modified_tuples", "modified_tuples", 0);
            tve.setValueType(VoltType.BIGINT);
            tve.setValueSize(VoltType.BIGINT.getLengthInBytesForFixedTypes());
            SchemaColumn col = new SchemaColumn("VOLT_TEMP_TABLE",
                                                "VOLT_TEMP_TABLE",
                                                "modified_tuples",
                                                "modified_tuples",
                                                tve);
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

        assert (input_schema.equals(m_outputSchema));
        for (SchemaColumn col : m_outputSchema.getColumns())
        {
            // At this point, they'd better all be TVEs.
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index = tve.resolveColumnIndexesUsingSchema(input_schema);
            tve.setColumnIndex(index);
        }
        m_outputSchema.sortByTveIndex();
    }
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

            new TreeMap<Integer, SchemaColumn>();
        for (SchemaColumn col : m_outputSchemaPreInlineAgg.getColumns())
        {
            // Right now these all need to be TVEs
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index = outer_schema.getIndexOfTve(tve);
            int tableIdx = 0;   // 0 for outer table
            if (index == -1)
            {
                index = tve.resolveColumnIndexesUsingSchema(index_schema);
                if (index == -1)
                {
                    throw new RuntimeException("Unable to find index for column: " +
                                               col.toString());
                }
                sort_cols.put(index + outer_schema.size(), col);
                tableIdx = 1;   // 1 for inner table
            }
            else
            {
                sort_cols.put(index, col);
            }
            tve.setColumnIndex(index);
            tve.setTableIndex(tableIdx);
        }
        // rebuild the output schema from the tree-sorted columns
        NodeSchema new_output_schema = new NodeSchema();
        for (SchemaColumn col : sort_cols.values())
        {
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

            new TreeMap<Integer, SchemaColumn>();
        for (SchemaColumn col : m_outputSchemaPreInlineAgg.getColumns())
        {
            // Right now these all need to be TVEs
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index = tve.resolveColumnIndexesUsingSchema(outer_schema);
            if (index == -1)
            {
                index = tve.resolveColumnIndexesUsingSchema(inner_schema);
                if (index == -1)
                {
                    throw new RuntimeException("Unable to find index for column: " +
                                               col.toString());
                }
                sort_cols.put(index + outer_schema.size(), col);
            }
            else
            {
                sort_cols.put(index, col);
            }
            tve.setColumnIndex(index);
        }
        // rebuild the output schema from the tree-sorted columns
        NodeSchema new_output_schema = new NodeSchema();
        for (SchemaColumn col : sort_cols.values())
        {
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

                CatalogMap<Column> cols = db.getTables().getExact(m_targetTableName).getColumns();
                // you don't strictly need to sort this, but it makes diff-ing easier
                for (Column col : CatalogUtil.getSortedCatalogItems(cols, "index"))
                {
                    // must produce a tuple value expression for this column.
                    TupleValueExpression tve = new TupleValueExpression(
                            m_targetTableName, m_targetTableAlias, col.getTypeName(), col.getTypeName(),
                            col.getIndex());

                    tve.setTypeSizeBytes(col.getType(), col.getSize(), col.getInbytes());
                    m_tableSchema.addColumn(new SchemaColumn(m_targetTableName,
                                                             m_targetTableAlias,
                                                             col.getTypeName(),
                                                             col.getTypeName(),
                                                             tve));
                }
            }
        }

        // Until the scan has an implicit projection rather than an explicitly
        // inlined one, the output schema generation is going to be a bit odd.
        // It will depend on two bits of state: whether any scan columns were
        // specified for this table and whether or not there is an inlined
        // projection.
        //
        // If there is an inlined projection, then we'll just steal that
        // output schema as our own.
        // If there is no inlined projection, then, if there are no scan columns
        // specified, use the entire table's schema as the output schema.
        // Otherwise add an inline projection that projects the scan columns
        // and then take that output schema as our own.
        // These have the effect of repeatably generating the correct output
        // schema if called again and again, but also allowing the planner
        // to overwrite the inline projection and still have the right thing
        // happen
        ProjectionPlanNode proj =
            (ProjectionPlanNode)getInlinePlanNode(PlanNodeType.PROJECTION);
        if (proj != null)
        {
            // Does this operation needs to change complex expressions
            // into tuple value expressions with an column alias?
            // Is this always true for clone?  Or do we need a new method?
            m_outputSchema = proj.getOutputSchema().copyAndReplaceWithTVE();
            m_hasSignificantOutputSchema = false; // It's just a cheap knock-off of the projection's
        }
        else
        {
            if (m_tableScanSchema.size() != 0)
            {
                // Order the scan columns according to the table schema
                // before we stick them in the projection output
                List<TupleValueExpression> scan_tves =
                    new ArrayList<TupleValueExpression>();
                for (SchemaColumn col : m_tableScanSchema.getColumns())
                {
                    assert(col.getExpression() instanceof TupleValueExpression);
                    scan_tves.addAll(ExpressionUtil.getTupleValueExpressions(col.getExpression()));
                }
                // and update their indexes against the table schema
                for (TupleValueExpression tve : scan_tves)
                {
                    int index = tve.resolveColumnIndexesUsingSchema(m_tableSchema);
                    tve.setColumnIndex(index);
                }
                m_tableScanSchema.sortByTveIndex();
                // Create inline projection to map table outputs to scan outputs
                ProjectionPlanNode projectionNode = new ProjectionPlanNode();
                projectionNode.setOutputSchema(m_tableScanSchema);
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

            // and sort them by table schema index order.
            for (SchemaColumn col : m_outputSchema.getColumns())
            {
                // At this point, they'd better all be TVEs.
                assert(col.getExpression() instanceof TupleValueExpression);
                TupleValueExpression tve = (TupleValueExpression)col.getExpression();
                int index = tve.resolveColumnIndexesUsingSchema(m_tableSchema);
                tve.setColumnIndex(index);
            }
            m_outputSchema.sortByTveIndex();
        }

        // The outputschema of an inline limit node is completely irrelevant to the EE except that
View Full Code Here

Examples of org.voltdb.expressions.TupleValueExpression

        NodeSchema input_schema = m_children.get(0).getOutputSchema();
        for (SchemaColumn col : m_outputSchema.getColumns())
        {
            // At this point, they'd better all be TVEs.
            assert(col.getExpression() instanceof TupleValueExpression);
            TupleValueExpression tve = (TupleValueExpression)col.getExpression();
            int index = tve.resolveColumnIndexesUsingSchema(input_schema);
            tve.setColumnIndex(index);
        }
        m_outputSchema.sortByTveIndex();

        // Find the proper index for the sort columns.  Not quite
        // sure these should be TVEs in the long term.
        List<TupleValueExpression> sort_tves =
            new ArrayList<TupleValueExpression>();
        for (AbstractExpression sort_exps : m_sortExpressions)
        {
            sort_tves.addAll(ExpressionUtil.getTupleValueExpressions(sort_exps));
        }
        for (TupleValueExpression tve : sort_tves)
        {
            int index = tve.resolveColumnIndexesUsingSchema(input_schema);
            tve.setColumnIndex(index);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.