本文整理汇总了C++中TableTuple::debug方法的典型用法代码示例。如果您正苦于以下问题:C++ TableTuple::debug方法的具体用法?C++ TableTuple::debug怎么用?C++ TableTuple::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableTuple
的用法示例。
在下文中一共展示了TableTuple::debug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p_execute
bool IndexScanExecutor::p_execute(const NValueArray ¶ms)
{
assert(m_node);
assert(m_node == dynamic_cast<IndexScanPlanNode*>(m_abstractNode));
assert(m_outputTable);
assert(m_outputTable == static_cast<TempTable*>(m_node->getOutputTable()));
// update local target table with its most recent reference
Table* targetTable = m_node->getTargetTable();
TableIndex *tableIndex = targetTable->index(m_node->getTargetIndexName());
TableTuple searchKey(tableIndex->getKeySchema());
searchKey.moveNoHeader(m_searchKeyBackingStore);
assert(m_lookupType != INDEX_LOOKUP_TYPE_EQ ||
searchKey.getSchema()->columnCount() == m_numOfSearchkeys);
int activeNumOfSearchKeys = m_numOfSearchkeys;
IndexLookupType localLookupType = m_lookupType;
SortDirectionType localSortDirection = m_sortDirection;
// INLINE PROJECTION
// Set params to expression tree via substitute()
assert(m_numOfColumns == m_outputTable->columnCount());
if (m_projectionNode != NULL && m_projectionAllTupleArray == NULL)
{
for (int ctr = 0; ctr < m_numOfColumns; ctr++)
{
assert(m_projectionNode->getOutputColumnExpressions()[ctr]);
m_projectionExpressions[ctr]->substitute(params);
assert(m_projectionExpressions[ctr]);
}
}
//
// INLINE LIMIT
//
LimitPlanNode* limit_node = dynamic_cast<LimitPlanNode*>(m_abstractNode->getInlinePlanNode(PLAN_NODE_TYPE_LIMIT));
//
// SEARCH KEY
//
searchKey.setAllNulls();
VOLT_TRACE("Initial (all null) search key: '%s'", searchKey.debugNoHeader().c_str());
for (int ctr = 0; ctr < activeNumOfSearchKeys; ctr++) {
m_searchKeyArray[ctr]->substitute(params);
NValue candidateValue = m_searchKeyArray[ctr]->eval(NULL, NULL);
try {
searchKey.setNValue(ctr, candidateValue);
}
catch (const SQLException &e) {
// This next bit of logic handles underflow and overflow while
// setting up the search keys.
// e.g. TINYINT > 200 or INT <= 6000000000
// re-throw if not an overflow or underflow
// currently, it's expected to always be an overflow or underflow
if ((e.getInternalFlags() & (SQLException::TYPE_OVERFLOW | SQLException::TYPE_UNDERFLOW)) == 0) {
throw e;
}
// handle the case where this is a comparison, rather than equality match
// comparison is the only place where the executor might return matching tuples
// e.g. TINYINT < 1000 should return all values
if ((localLookupType != INDEX_LOOKUP_TYPE_EQ) &&
(ctr == (activeNumOfSearchKeys - 1))) {
if (e.getInternalFlags() & SQLException::TYPE_OVERFLOW) {
if ((localLookupType == INDEX_LOOKUP_TYPE_GT) ||
(localLookupType == INDEX_LOOKUP_TYPE_GTE)) {
// gt or gte when key overflows returns nothing
return true;
}
else {
// for overflow on reverse scan, we need to
// do a forward scan to find the correct start
// point, which is exactly what LTE would do.
// so, set the lookupType to LTE and the missing
// searchkey will be handled by extra post filters
localLookupType = INDEX_LOOKUP_TYPE_LTE;
}
}
if (e.getInternalFlags() & SQLException::TYPE_UNDERFLOW) {
if ((localLookupType == INDEX_LOOKUP_TYPE_LT) ||
(localLookupType == INDEX_LOOKUP_TYPE_LTE)) {
// lt or lte when key underflows returns nothing
return true;
}
else {
// don't allow GTE because it breaks null handling
localLookupType = INDEX_LOOKUP_TYPE_GT;
}
}
// if here, means all tuples with the previous searchkey
// columns need to be scaned. Note, if only one column,
// then all tuples will be scanned
activeNumOfSearchKeys--;
if (localSortDirection == SORT_DIRECTION_TYPE_INVALID) {
//.........这里部分代码省略.........
示例2: p_execute
bool IndexScanExecutor::p_execute(const NValueArray ¶ms)
{
assert(m_node);
assert(m_node == dynamic_cast<IndexScanPlanNode*>(m_abstractNode));
// update local target table with its most recent reference
Table* targetTable = m_node->getTargetTable();
TableIndex *tableIndex = targetTable->index(m_node->getTargetIndexName());
IndexCursor indexCursor(tableIndex->getTupleSchema());
TableTuple searchKey(tableIndex->getKeySchema());
searchKey.moveNoHeader(m_searchKeyBackingStore);
assert(m_lookupType != INDEX_LOOKUP_TYPE_EQ ||
searchKey.getSchema()->columnCount() == m_numOfSearchkeys);
int activeNumOfSearchKeys = m_numOfSearchkeys;
IndexLookupType localLookupType = m_lookupType;
SortDirectionType localSortDirection = m_sortDirection;
//
// INLINE LIMIT
//
LimitPlanNode* limit_node = dynamic_cast<LimitPlanNode*>(m_abstractNode->getInlinePlanNode(PLAN_NODE_TYPE_LIMIT));
TableTuple temp_tuple;
ProgressMonitorProxy pmp(m_engine, this);
if (m_aggExec != NULL) {
const TupleSchema * inputSchema = tableIndex->getTupleSchema();
if (m_projectionNode != NULL) {
inputSchema = m_projectionNode->getOutputTable()->schema();
}
temp_tuple = m_aggExec->p_execute_init(params, &pmp, inputSchema, m_outputTable);
} else {
temp_tuple = m_outputTable->tempTuple();
}
// Short-circuit an empty scan
if (m_node->isEmptyScan()) {
VOLT_DEBUG ("Empty Index Scan :\n %s", m_outputTable->debug().c_str());
if (m_aggExec != NULL) {
m_aggExec->p_execute_finish();
}
return true;
}
//
// SEARCH KEY
//
bool earlyReturnForSearchKeyOutOfRange = false;
searchKey.setAllNulls();
VOLT_TRACE("Initial (all null) search key: '%s'", searchKey.debugNoHeader().c_str());
for (int ctr = 0; ctr < activeNumOfSearchKeys; ctr++) {
NValue candidateValue = m_searchKeyArray[ctr]->eval(NULL, NULL);
if (candidateValue.isNull()) {
// when any part of the search key is NULL, the result is false when it compares to anything.
// do early return optimization, our index comparator may not handle null comparison correctly.
earlyReturnForSearchKeyOutOfRange = true;
break;
}
try {
searchKey.setNValue(ctr, candidateValue);
}
catch (const SQLException &e) {
// This next bit of logic handles underflow, overflow and search key length
// exceeding variable length column size (variable lenght mismatch) when
// setting up the search keys.
// e.g. TINYINT > 200 or INT <= 6000000000
// VarChar(3 bytes) < "abcd" or VarChar(3) > "abbd"
// re-throw if not an overflow, underflow or variable length mismatch
// currently, it's expected to always be an overflow or underflow
if ((e.getInternalFlags() & (SQLException::TYPE_OVERFLOW | SQLException::TYPE_UNDERFLOW | SQLException::TYPE_VAR_LENGTH_MISMATCH)) == 0) {
throw e;
}
// handle the case where this is a comparison, rather than equality match
// comparison is the only place where the executor might return matching tuples
// e.g. TINYINT < 1000 should return all values
if ((localLookupType != INDEX_LOOKUP_TYPE_EQ) &&
(ctr == (activeNumOfSearchKeys - 1))) {
if (e.getInternalFlags() & SQLException::TYPE_OVERFLOW) {
if ((localLookupType == INDEX_LOOKUP_TYPE_GT) ||
(localLookupType == INDEX_LOOKUP_TYPE_GTE)) {
// gt or gte when key overflows returns nothing except inline agg
earlyReturnForSearchKeyOutOfRange = true;
break;
}
else {
// for overflow on reverse scan, we need to
// do a forward scan to find the correct start
// point, which is exactly what LTE would do.
// so, set the lookupType to LTE and the missing
// searchkey will be handled by extra post filters
localLookupType = INDEX_LOOKUP_TYPE_LTE;
//.........这里部分代码省略.........
示例3: p_execute
bool InsertExecutor::p_execute(const NValueArray ¶ms) {
assert(m_node == dynamic_cast<InsertPlanNode*>(m_abstractNode));
assert(m_node);
assert(m_inputTable == dynamic_cast<TempTable*>(m_node->getInputTable()));
assert(m_inputTable);
// Target table can be StreamedTable or PersistentTable and must not be NULL
// Update target table reference from table delegate
Table* targetTable = m_node->getTargetTable();
assert(targetTable);
assert((targetTable == dynamic_cast<PersistentTable*>(targetTable)) ||
(targetTable == dynamic_cast<StreamedTable*>(targetTable)));
PersistentTable* persistentTable = m_isStreamed ?
NULL : static_cast<PersistentTable*>(targetTable);
TableTuple upsertTuple = TableTuple(targetTable->schema());
VOLT_TRACE("INPUT TABLE: %s\n", m_inputTable->debug().c_str());
// count the number of successful inserts
int modifiedTuples = 0;
Table* outputTable = m_node->getOutputTable();
assert(outputTable);
TableTuple templateTuple = m_templateTuple.tuple();
std::vector<int>::iterator it;
for (it = m_nowFields.begin(); it != m_nowFields.end(); ++it) {
templateTuple.setNValue(*it, NValue::callConstant<FUNC_CURRENT_TIMESTAMP>());
}
VOLT_DEBUG("This is a %s-row insert on partition with id %d",
m_node->getChildren()[0]->getPlanNodeType() == PLAN_NODE_TYPE_MATERIALIZE ?
"single" : "multi", m_engine->getPartitionId());
VOLT_DEBUG("Offset of partition column is %d", m_partitionColumn);
//
// An insert is quite simple really. We just loop through our m_inputTable
// and insert any tuple that we find into our targetTable. It doesn't get any easier than that!
//
TableTuple inputTuple(m_inputTable->schema());
assert (inputTuple.sizeInValues() == m_inputTable->columnCount());
TableIterator iterator = m_inputTable->iterator();
while (iterator.next(inputTuple)) {
for (int i = 0; i < m_node->getFieldMap().size(); ++i) {
// Most executors will just call setNValue instead of
// setNValueAllocateForObjectCopies.
//
// However, We need to call
// setNValueAlocateForObjectCopies here. Sometimes the
// input table's schema has an inlined string field, and
// it's being assigned to the target table's outlined
// string field. In this case we need to tell the NValue
// where to allocate the string data.
templateTuple.setNValueAllocateForObjectCopies(m_node->getFieldMap()[i],
inputTuple.getNValue(i),
ExecutorContext::getTempStringPool());
}
VOLT_TRACE("Inserting tuple '%s' into target table '%s' with table schema: %s",
templateTuple.debug(targetTable->name()).c_str(), targetTable->name().c_str(),
targetTable->schema()->debug().c_str());
// if there is a partition column for the target table
if (m_partitionColumn != -1) {
// get the value for the partition column
NValue value = templateTuple.getNValue(m_partitionColumn);
bool isLocal = m_engine->isLocalSite(value);
// if it doesn't map to this site
if (!isLocal) {
if (!m_multiPartition) {
throw ConstraintFailureException(
dynamic_cast<PersistentTable*>(targetTable),
templateTuple,
"Mispartitioned tuple in single-partition insert statement.");
}
// don't insert
continue;
}
}
// for multi partition export tables, only insert into one
// place (the partition with hash(0)), if the data is from a
// replicated source. If the data is coming from a subquery
// with partitioned tables, we need to perform the insert on
// every partition.
if (m_isStreamed && m_multiPartition && !m_sourceIsPartitioned) {
bool isLocal = m_engine->isLocalSite(ValueFactory::getBigIntValue(0));
if (!isLocal) continue;
}
if (! m_isUpsert) {
// try to put the tuple into the target table
//.........这里部分代码省略.........