Ejemplo n.º 1
0
bool ReceiveExecutor::p_init(AbstractPlanNode *abstract_node,
                             const catalog::Database* catalog_db,
                             int* tempTableMemoryInBytes) {
    VOLT_TRACE("init Receive Executor");
    assert(tempTableMemoryInBytes);

    ReceivePlanNode* node = dynamic_cast<ReceivePlanNode*>(abstract_node);
    assert(node);

    //
    // Construct the output table
    //
    int num_of_columns = (int)node->getOutputColumnNames().size();
    assert(num_of_columns >= 0);
    assert(num_of_columns == node->getOutputColumnTypes().size());
    assert(num_of_columns == node->getOutputColumnSizes().size());
    const std::vector<std::string> outputColumnNames = node->getOutputColumnNames();
    const std::vector<voltdb::ValueType> outputColumnTypes = node->getOutputColumnTypes();
    const std::vector<int32_t> outputColumnSizes = node->getOutputColumnSizes();
    const std::vector<bool> outputColumnAllowNull(num_of_columns, true);
    TupleSchema *schema = TupleSchema::createTupleSchema(outputColumnTypes, outputColumnSizes, outputColumnAllowNull, true);
    std::string *columnNames = new std::string[num_of_columns];
    for (int ctr = 0; ctr < num_of_columns; ctr++) {
        columnNames[ctr] = node->getOutputColumnNames()[ctr];
    }
    node->setOutputTable(TableFactory::getTempTable(node->databaseId(), "temp", schema, columnNames, tempTableMemoryInBytes));

    delete[] columnNames;
    return true;
}
Ejemplo n.º 2
0
bool ReceiveExecutor::p_execute(const NValueArray &params) {
    int loadedDeps = 0;
    ReceivePlanNode* node = dynamic_cast<ReceivePlanNode*>(m_abstractNode);
    Table* output_table = dynamic_cast<Table*>(node->getOutputTable());

    // iterate dependencies stored in the frontend and union them
    // into the output_table. The engine does this work for peanuts.

    // todo: should pass the transaction's string pool through
    // as the underlying table loader would use it.
    do {
        loadedDeps =
        engine->loadNextDependency(output_table);
    } while (loadedDeps > 0);

    return true;
}
Ejemplo n.º 3
0
bool ReceiveExecutor::p_init(AbstractPlanNode* abstract_node,
                             TempTableLimits* limits)
{
    VOLT_TRACE("init Receive Executor");
    assert(limits);

    ReceivePlanNode* node = dynamic_cast<ReceivePlanNode*>(abstract_node);
    assert(node);

    //
    // Construct the output table
    //
    TupleSchema* schema = node->generateTupleSchema(true);
    int num_of_columns = static_cast<int>(node->getOutputSchema().size());
    std::string* column_names = new std::string[num_of_columns];
    for (int ctr = 0; ctr < num_of_columns; ctr++)
    {
        column_names[ctr] = node->getOutputSchema()[ctr]->getColumnName();
    }
    node->setOutputTable(TableFactory::getTempTable(node->databaseId(),
                                                    "temp",
                                                    schema,
                                                    column_names,
                                                    limits));
    delete[] column_names;
    return true;
}