本文整理汇总了C++中PersistentTable::allocatedTupleCount方法的典型用法代码示例。如果您正苦于以下问题:C++ PersistentTable::allocatedTupleCount方法的具体用法?C++ PersistentTable::allocatedTupleCount怎么用?C++ PersistentTable::allocatedTupleCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersistentTable
的用法示例。
在下文中一共展示了PersistentTable::allocatedTupleCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p_execute
bool DeleteExecutor::p_execute(const NValueArray ¶ms) {
// target table should be persistenttable
// update target table reference from table delegate
PersistentTable* targetTable = dynamic_cast<PersistentTable*>(m_node->getTargetTable());
assert(targetTable);
TableTuple targetTuple(targetTable->schema());
int64_t modified_tuples = 0;
if (m_truncate) {
VOLT_TRACE("truncating table %s...", targetTable->name().c_str());
// count the truncated tuples as deleted
modified_tuples = targetTable->visibleTupleCount();
VOLT_TRACE("Delete all rows from table : %s with %d active, %d visible, %d allocated",
targetTable->name().c_str(),
(int)targetTable->activeTupleCount(),
(int)targetTable->visibleTupleCount(),
(int)targetTable->allocatedTupleCount());
// empty the table either by table swap or iteratively deleting tuple-by-tuple
targetTable->truncateTable(m_engine);
}
else {
assert(m_inputTable);
assert(m_inputTuple.sizeInValues() == m_inputTable->columnCount());
assert(targetTuple.sizeInValues() == targetTable->columnCount());
TableIterator inputIterator = m_inputTable->iterator();
while (inputIterator.next(m_inputTuple)) {
//
// OPTIMIZATION: Single-Sited Query Plans
// If our beloved DeletePlanNode is apart of a single-site query plan,
// then the first column in the input table will be the address of a
// tuple on the target table that we will want to blow away. This saves
// us the trouble of having to do an index lookup
//
void *targetAddress = m_inputTuple.getNValue(0).castAsAddress();
targetTuple.move(targetAddress);
// Delete from target table
if (!targetTable->deleteTuple(targetTuple, true)) {
VOLT_ERROR("Failed to delete tuple from table '%s'",
targetTable->name().c_str());
return false;
}
}
modified_tuples = m_inputTable->tempTableTupleCount();
VOLT_TRACE("Deleted %d rows from table : %s with %d active, %d visible, %d allocated",
(int)modified_tuples,
targetTable->name().c_str(),
(int)targetTable->activeTupleCount(),
(int)targetTable->visibleTupleCount(),
(int)targetTable->allocatedTupleCount());
}
TableTuple& count_tuple = m_node->getOutputTable()->tempTuple();
count_tuple.setNValue(0, ValueFactory::getBigIntValue(modified_tuples));
// try to put the tuple into the output table
if (!m_node->getOutputTable()->insertTuple(count_tuple)) {
VOLT_ERROR("Failed to insert tuple count (%ld) into"
" output table '%s'",
static_cast<long int>(modified_tuples),
m_node->getOutputTable()->name().c_str());
return false;
}
m_engine->addToTuplesModified(modified_tuples);
return true;
}