bool Table::equals(const voltdb::Table *other) const { if (!(columnCount() == other->columnCount())) return false; if (!(indexCount() == other->indexCount())) return false; if (!(activeTupleCount() == other->activeTupleCount())) return false; if (!(databaseId() == other->databaseId())) return false; if (!(tableId() == other->tableId())) return false; if (!(name() == other->name())) return false; if (!(tableType() == other->tableType())) return false; std::vector<voltdb::TableIndex*> indexes = allIndexes(); std::vector<voltdb::TableIndex*> otherIndexes = other->allIndexes(); if (!(indexes.size() == indexes.size())) return false; for (std::size_t ii = 0; ii < indexes.size(); ii++) { if (!(indexes[ii]->equals(otherIndexes[ii]))) return false; } const voltdb::TupleSchema *otherSchema = other->schema(); if ((!m_schema->equals(otherSchema))) return false; voltdb::TableIterator firstTI(this); voltdb::TableIterator secondTI(other); voltdb::TableTuple firstTuple(m_schema); voltdb::TableTuple secondTuple(otherSchema); while(firstTI.next(firstTuple)) { if (!(secondTI.next(secondTuple))) return false; if (!(firstTuple.equals(secondTuple))) return false; } return true; }
std::string Table::debug(const std::string &spacer) const { VOLT_DEBUG("tabledebug start"); std::ostringstream buffer; std::string infoSpacer = spacer + " |"; buffer << infoSpacer << tableType() << "(" << name() << "):\n"; buffer << infoSpacer << "\tAllocated Tuples: " << allocatedTupleCount() << "\n"; buffer << infoSpacer << "\tNumber of Columns: " << columnCount() << "\n"; // // Columns // buffer << infoSpacer << "===========================================================\n"; buffer << infoSpacer << "\tCOLUMNS\n"; buffer << infoSpacer << m_schema->debug(); //buffer << infoSpacer << " - TupleSchema needs a \"debug\" method. Add one for output here.\n"; #ifdef VOLT_TRACE_ENABLED // // Tuples // if (tableType().compare("LargeTempTable") != 0) { buffer << infoSpacer << "===========================================================\n"; buffer << infoSpacer << "\tDATA\n"; TableIterator iter = const_cast<Table*>(this)->iterator(); TableTuple tuple(m_schema); if (this->activeTupleCount() == 0) { buffer << infoSpacer << "\t<NONE>\n"; } else { std::string lastTuple = ""; while (iter.next(tuple)) { if (tuple.isActive()) { buffer << infoSpacer << "\t" << tuple.debug(this->name().c_str()) << "\n"; } } } buffer << infoSpacer << "===========================================================\n"; } #endif std::string ret(buffer.str()); VOLT_DEBUG("tabledebug end"); return ret; }
const NAString ExtendedQualName::getTextWithSpecialType() const { NAString tableType(getSpecialTypeName()); if (tableType == "") return getText(); else { NAString tableName(getText()); tableName += " ("; tableName += tableType; tableName += ")"; return tableName; } }
std::string Table::debug() { VOLT_TRACE("tabledebug start"); std::ostringstream buffer; buffer << tableType() << "(" << name() << "):\n"; buffer << "\tAllocated Tuples: " << m_allocatedTuples << "\n"; #ifdef MEMCHECK_NOFREELIST buffer << "\tDeleted Tuples: " << m_deletedTupleCount << "\n"; #else buffer << "\tDeleted Tuples: " << m_holeFreeTuples.size() << "\n"; #endif buffer << "\tNumber of Columns: " << columnCount() << "\n"; // // Columns // buffer << "===========================================================\n"; buffer << "\tCOLUMNS\n"; buffer << m_schema->debug(); //buffer << " - TupleSchema needs a \"debug\" method. Add one for output here.\n"; // // Tuples // buffer << "===========================================================\n"; buffer << "\tDATA\n"; TableIterator iter(this); TableTuple tuple(m_schema); if (this->activeTupleCount() == 0) { buffer << "\t<NONE>\n"; } else { std::string lastTuple = ""; while (iter.next(tuple)) { if (tuple.isActive()) { buffer << "\t" << tuple.debug(this->name().c_str()) << "\n"; } } } buffer << "===========================================================\n"; std::string ret(buffer.str()); VOLT_TRACE("tabledebug end"); return ret; }
bool Table::equals(voltdb::Table *other) { if (!(columnCount() == other->columnCount())) return false; if (!(activeTupleCount() == other->activeTupleCount())) return false; if (!(databaseId() == other->databaseId())) return false; if (!(name() == other->name())) return false; if (!(tableType() == other->tableType())) return false; const voltdb::TupleSchema *otherSchema = other->schema(); if ((!m_schema->equals(otherSchema))) return false; voltdb::TableIterator firstTI = iterator(); voltdb::TableIterator secondTI = other->iterator(); voltdb::TableTuple firstTuple(m_schema); voltdb::TableTuple secondTuple(otherSchema); while(firstTI.next(firstTuple)) { if (!(secondTI.next(secondTuple))) return false; if (!(firstTuple.equals(secondTuple))) return false; } return true; }