Пример #1
0
TupleSchema* AbstractPlanNode::generateTupleSchema(const std::vector<SchemaColumn*>& outputSchema)
{
    int schema_size = static_cast<int>(outputSchema.size());
    vector<voltdb::ValueType> columnTypes;
    vector<int32_t> columnSizes;
    vector<bool> columnAllowNull(schema_size, true);
    vector<bool> columnInBytes;

    for (int i = 0; i < schema_size; i++)
    {
        //TODO: SchemaColumn is a sad little class that holds an expression pointer,
        // a column name that only really comes in handy in one quirky special case,
        // (see UpdateExecutor::p_init) and a bunch of other stuff that doesn't get used.
        // Someone should put that class out of our misery.
        SchemaColumn* col = outputSchema[i];
        AbstractExpression * expr = col->getExpression();
        columnTypes.push_back(expr->getValueType());
        columnSizes.push_back(expr->getValueSize());
        columnInBytes.push_back(expr->getInBytes());
    }

    TupleSchema* schema =
        TupleSchema::createTupleSchema(columnTypes, columnSizes,
                                       columnAllowNull, columnInBytes);
    return schema;
}
Пример #2
0
void AggregatePlanNode::collectOutputExpressions(std::vector<AbstractExpression*>& outputColumnExpressions) const
{
    const std::vector<SchemaColumn*>& outputSchema = getOutputSchema();
    size_t size = outputSchema.size();
    outputColumnExpressions.resize(size);
    for (int ii = 0; ii < size; ii++) {
        SchemaColumn* outputColumn = outputSchema[ii];
        outputColumnExpressions[ii] = outputColumn->getExpression();
    }
}
Пример #3
0
void AbstractReceivePlanNode::schemaDebugInfo(std::ostringstream& buffer, const std::vector<SchemaColumn*>& schema,
    const std::string& schema_name, const std::string& spacer) {
    buffer << spacer << schema_name << " Table Columns[" << schema.size() << "]:\n";
    for (int ctr = 0, cnt = (int)schema.size(); ctr < cnt; ctr++) {
        SchemaColumn* col = schema[ctr];
        buffer << spacer << "  [" << ctr << "] ";
        buffer << "name=" << col->getColumnName() << " : ";
        buffer << "size=" << col->getExpression()->getValueSize() << " : ";
        buffer << "type=" << col->getExpression()->getValueType() << "\n";
    }
}
Пример #4
0
std::string ReceivePlanNode::debugInfo(const std::string& spacer) const
{
    std::ostringstream buffer;
    buffer << spacer << "Incoming Table Columns["
           << getOutputSchema().size() << "]:\n";
    for (int ctr = 0, cnt = (int)getOutputSchema().size(); ctr < cnt; ctr++) {
        SchemaColumn* col = getOutputSchema()[ctr];
        buffer << spacer << "  [" << ctr << "] ";
        buffer << "name=" << col->getColumnName() << " : ";
        buffer << "size=" << col->getExpression()->getValueSize() << " : ";
        buffer << "type=" << col->getExpression()->getValueType() << "\n";
    }
    return buffer.str();
}
Пример #5
0
TupleSchema*
AbstractPlanNode::generateTupleSchema(bool allowNulls)
{
    int schema_size = static_cast<int>(m_outputSchema.size());
    vector<voltdb::ValueType> columnTypes;
    vector<int32_t> columnSizes;
    vector<bool> columnAllowNull(schema_size, allowNulls);

    for (int i = 0; i < schema_size; i++)
    {
        SchemaColumn* col = m_outputSchema[i];
        columnTypes.push_back(col->getExpression()->getValueType());
        columnSizes.push_back(col->getExpression()->getValueSize());
    }

    TupleSchema* schema =
        TupleSchema::createTupleSchema(columnTypes, columnSizes,
                                       columnAllowNull, true);
    return schema;
}