bool UnionSetOperator::processTuplesDo() {

    // Set to keep candidate tuples.
    TupleSet tuples;

    //
    // For each input table, grab their TableIterator and then append all of its tuples
    // to our ouput table. Only distinct tuples are retained.
    //
    for (size_t ctr = 0, cnt = m_input_tables.size(); ctr < cnt; ctr++) {
        Table* input_table = m_input_tables[ctr];
        assert(input_table);
        TableIterator iterator = input_table->iterator();
        TableTuple tuple(input_table->schema());
        while (iterator.next(tuple)) {
            if (m_is_all || needToInsert(tuple, tuples)) {
                // we got tuple to insert
                if (!m_output_table->insertTuple(tuple)) {
                    VOLT_ERROR("Failed to insert tuple from input table '%s' into"
                               " output table '%s'",
                               input_table->name().c_str(),
                               m_output_table->name().c_str());
                    return false;
                }
            }
        }
    }
    return true;
}
Exemple #2
0
bool UnionSetOperator::processTuples()
{
    // Set to keep candidate tuples.
    TupleSet tuples;

    //
    // For each input table, grab their TableIterator and then append all of its tuples
    // to our ouput table. Only distinct tuples are retained.
    //
    for (size_t ctr = 0, cnt = m_input_tablerefs.size(); ctr < cnt; ctr++) {
        Table* input_table = m_input_tablerefs[ctr].getTable();
        assert(input_table);
        TableIterator iterator = input_table->iterator();
        TableTuple tuple(input_table->schema());
        while (iterator.next(tuple)) {
            if (m_is_all || needToInsert(tuple, tuples)) {
                // we got tuple to insert
                m_output_table->insertTempTuple(tuple);
            }
        }
    }
    return true;
}