本文整理汇总了C++中ValueId类的典型用法代码示例。如果您正苦于以下问题:C++ ValueId类的具体用法?C++ ValueId怎么用?C++ ValueId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getValueId
// A transformation method for protecting sequence functions from not
// being evaluated due to short-circuit evaluation.
//
void BiLogic::protectiveSequenceFunctionTransformation(Generator *generator)
{
// Recurse on the children
//
ItemExpr::protectiveSequenceFunctionTransformation(generator);
// Remove the original value id from the node being transformed and
// assign it a new value id.
//
ValueId id = getValueId();
setValueId(NULL_VALUE_ID);
synthTypeAndValueId(TRUE);
// Construct the new subtree.
//
// AND/OR -- force right child evaluation
//
// LOGIC(LEFT_CHILD, RIGHT_CHILD) ==>
// BLOCK(RIGHT_CHILD, LOGIC(LEFT_CHILD, RIGHT_CHILD))
//
ItemExpr *block = new(generator->wHeap()) ItmBlockFunction(child(1), this);
// Replace the old expression with the new expression for the
// orginal value id
//
id.replaceItemExpr(block);
// Run the new expression through type and value id synthesis
//
block->synthTypeAndValueId(TRUE);
}
示例2: sequenceFunctions
void PhysSequence::transformOlapFunctions(CollHeap *wHeap)
{
for(ValueId valId = sequenceFunctions().init();
sequenceFunctions().next(valId);
sequenceFunctions().advance(valId))
{
ItemExpr * itmExpr = valId.getItemExpr();
//NAType *itmType = itmExpr->getValueId().getType().newCopy(wHeap);
if (itmExpr->isOlapFunction())
{
NAType *itmType = itmExpr->getValueId().getType().newCopy(wHeap);
itmExpr = ((ItmSeqOlapFunction*)itmExpr)->transformOlapFunction(wHeap);
CMPASSERT(itmExpr);
if(itmExpr->getValueId() != valId)
{
itmExpr = new (wHeap) Cast(itmExpr, itmType);
itmExpr->synthTypeAndValueId(TRUE);
valId.replaceItemExpr(itmExpr);
itmExpr->getValueId().changeType(itmType);//????
}
}
itmExpr->transformOlapFunctions(wHeap);
}
}
示例3: addConvNode
ItemExpr *
addConvNode(ItemExpr *childExpr,
ValueIdMap *mapping,
CollHeap *wHeap)
{
if(childExpr->getOperatorType() != ITM_CONVERT &&
!childExpr->isASequenceFunction()) {
ValueId topValue;
mapping->mapValueIdUp(topValue,
childExpr->getValueId());
if(topValue == childExpr->getValueId()) {
// add the convert node
ItemExpr *newChild = new(wHeap) Convert (childExpr);
newChild->synthTypeAndValueId(TRUE);
mapping->addMapEntry(newChild->getValueId(),
childExpr->getValueId());
return newChild;
} else {
return topValue.getItemExpr();
}
}
return childExpr;
}
示例4: isIdentityColumnGeneratedAlways
NABoolean TableDesc::isIdentityColumnGeneratedAlways(NAString * value) const
{
// Determine if an IDENTITY column exists and
// has the default class of GENERATED ALWAYS AS IDENTITY.
// Do not return TRUE, if the table type is an INDEX_TABLE.
NABoolean result = FALSE;
for (CollIndex j = 0; j < colList_.entries(); j++)
{
ValueId valId = colList_[j];
NAColumn *column = valId.getNAColumn();
if(column->isIdentityColumnAlways())
{
if (getNATable()->getObjectType() != COM_INDEX_OBJECT)
{
if (value != NULL)
*value = column->getColName();
result = TRUE;
}
}
}
return result;
}
示例5: getEquivalentItmSequenceFunction
ValueId NormWA::getEquivalentItmSequenceFunction(ValueId newSeqId)
{
ValueId equivId = newSeqId;
ItemExpr *newItem = newSeqId.getItemExpr();
ItmSequenceFunction *newSeq = NULL;
if(newItem->isASequenceFunction()) {
newSeq = (ItmSequenceFunction *)newItem;
}
if(newSeq) {
for(ValueId seqId = allSeqFunctions_.init(); allSeqFunctions_.next(seqId);
allSeqFunctions_.advance(seqId) ){
ItemExpr *seq = seqId.getItemExpr();
if(newSeq->isEquivalentForBinding(seq)){
equivId = seqId;
if(newSeq->origOpType() != seq->origOpType()) {
seq->setOrigOpType(seq->getOperatorType());
}
break;
}
}
}
allSeqFunctions_ += equivId;
//
return equivId;
}
示例6: selectionPred
void
RelSequence::addCancelExpr(CollHeap *wHeap)
{
ItemExpr *cPred = NULL;
if (this->partition().entries() > 0)
{
return;
}
if(cancelExpr().entries() > 0)
{
return;
}
for(ValueId valId = selectionPred().init();
selectionPred().next(valId);
selectionPred().advance(valId))
{
ItemExpr *pred = valId.getItemExpr();
// Look for preds that select a prefix of the sequence.
// Rank() < const; Rank <= const; const > Rank; const >= Rank
ItemExpr *op1 = NULL;
ItemExpr *op2 = NULL;
if(pred->getOperatorType() == ITM_LESS ||
pred->getOperatorType() == ITM_LESS_EQ)
{
op1 = pred->child(0);
op2 = pred->child(1);
}
else if (pred->getOperatorType() == ITM_GREATER ||
pred->getOperatorType() == ITM_GREATER_EQ)
{
op1 = pred->child(1);
op2 = pred->child(0);
}
NABoolean negate;
if (op1 && op2 &&
(op2->getOperatorType() == ITM_CONSTANT ||
op2->getOperatorType() == ITM_DYN_PARAM) &&
(op1->getOperatorType() == ITM_OLAP_RANK ||
op1->getOperatorType() == ITM_OLAP_DRANK ||
(op1->getOperatorType() == ITM_OLAP_COUNT &&
op1->child(0)->getOperatorType() == ITM_CONSTANT &&
!op1->child(0)->castToConstValue(negate)->isNull())))
{
cPred = new(wHeap) UnLogic(ITM_NOT, pred);
//break at first occurence
break;
}
}
if(cPred)
{
cPred->synthTypeAndValueId(TRUE);
cancelExpr().insert(cPred->getValueId());
}
}
示例7: getSystemColumnList
// -----------------------------------------------------------------------
// TableDesc::getSystemColumnList()
// -----------------------------------------------------------------------
void TableDesc::getSystemColumnList(ValueIdList &columnList) const
{
for (CollIndex i = 0; i < colList_.entries(); i++) {
ValueId valId = colList_[i];
NAColumn *column = valId.getNAColumn();
if (column->isSystemColumn())
columnList.insert(valId);
}
}
示例8: new
// PhysSequence::computeHistoryAttributes
//
// Helper function to compute the attribute for the history buffer based
// on the items projected from the child and the computed history items.
// Also, adds the attribute information the the map table.
//
void
PhysSequence::computeHistoryAttributes(Generator *generator,
MapTable *localMapTable,
Attributes **attrs,
const ValueIdSet &historyIds) const
{
// Get a local handle on some of the generator objects.
//
CollHeap *wHeap = generator->wHeap();
// Populate the attribute vector with the flattened list of sequence
// functions and/or sequence function arguments that must be in the
// history row. Add convert nodes for the items that are not sequence
// functions to force them to be moved into the history row.
//
if(NOT historyIds.isEmpty())
{
Int32 i = 0;
ValueId valId;
for (valId = historyIds.init();
historyIds.next(valId);
historyIds.advance(valId))
{
// If this is not a sequence function, then insert a convert
// node.
//
if(!valId.getItemExpr()->isASequenceFunction())
{
// Get a handle on the original expression and erase
// the value ID.
//
ItemExpr *origExpr = valId.getItemExpr();
origExpr->setValueId(NULL_VALUE_ID);
origExpr->markAsUnBound();
// Construct the cast expression with the original expression
// as the child -- must have undone the child value ID to
// avoid recursion later.
//
ItemExpr *castExpr = new(wHeap)
Cast(origExpr, &(valId.getType()));
// Replace the expression for the original value ID and the
// synthesize the types and value ID for the new expression.
//
valId.replaceItemExpr(castExpr);
castExpr->synthTypeAndValueId(TRUE);
}
attrs[i++] = (generator->addMapInfoToThis(localMapTable, valId, 0))->getAttr();
}
}
} // PhysSequence::computeHistoryAttributes
示例9: hasIdentityColumnInClusteringKey
NABoolean TableDesc::hasIdentityColumnInClusteringKey() const
{
ValueIdSet pKeyColumns = clusteringIndex_->getIndexKey();
NAColumn * column = NULL;
for(ValueId id = pKeyColumns.init(); pKeyColumns.next(id);
pKeyColumns.advance(id))
{
column = id.getNAColumn();
if (column && column->isIdentityColumn())
return TRUE;
}
return FALSE;
}
示例10: getIdentityColumn
// -----------------------------------------------------------------------
// TableDesc::getIdentityColumn()
// -----------------------------------------------------------------------
void TableDesc::getIdentityColumn(ValueIdList &columnList) const
{
for (CollIndex i = 0; i < colList_.entries(); i++)
{
ValueId valId = colList_[i];
NAColumn *column = valId.getNAColumn();
if (column->isIdentityColumn())
{
columnList.insert(valId);
break; // Break when you find the first,
// as there can only be one Identity column per table.
}
}
}
示例11:
ex_expr *
PhysSequence::generateChildProjectExpression(Generator *generator,
MapTable *mapTable,
MapTable *localMapTable,
const ValueIdSet &childProjectIds) const
{
ex_expr * projectExpr = NULL;
if(NOT childProjectIds.isEmpty())
{
// Generate the clauses for the expression
//
generator->getExpGenerator()->generateSetExpr(childProjectIds,
ex_expr::exp_ARITH_EXPR,
&projectExpr);
// Add the projected values to the local map table.
//
ValueId valId;
for(valId = childProjectIds.init();
childProjectIds.next(valId);
childProjectIds.advance(valId))
{
// Get the attribute information from the convert destination.
//
Attributes *newAttr = mapTable->getMapInfo(valId)->getAttr();
// Add the original value to the local map table with the
// attribute information from the convert desination.
//
MapInfo *mapInfo = localMapTable->addMapInfoToThis
(valId.getItemExpr()->child(0)->getValueId(), newAttr);
// Nothing more needs to be done for this item.
//
mapInfo->codeGenerated();
}
}
return projectExpr;
} // PhysSequence::generateChildProjectExpression
示例12: getDefinition
// TableDesc::isKeyIndex()
// Parameter is an secondary index on the table. Table checks to see
// if the keys of the secondary index is built using the primary key
// of the table. If it is return true otherwise false.
NABoolean TableDesc::isKeyIndex(const IndexDesc * idesc) const
{
ValueIdSet pKeyColumns = clusteringIndex_->getIndexKey();
ValueIdSet indexColumns = idesc->getIndexKey();
ValueIdSet basePKeys=pKeyColumns.convertToBaseIds();
for(ValueId id = indexColumns.init(); indexColumns.next(id);
indexColumns.advance(id))
{
ValueId baseId = ((BaseColumn *)(((IndexColumn *)id.getItemExpr())->
getDefinition().getItemExpr()))->getValueId();
if(NOT basePKeys.contains(baseId))
{
return FALSE;
}
}
return TRUE;
}
示例13: addColumnNames
void HbaseSearchSpec::addColumnNames(const ValueIdSet& vs)
{
// TEMP TEMP. Not all needed column names are being set up.
// for now, return without populating result.
// that will cause all columns to be retrieved.
//return;
for (ValueId vid = vs.init(); vs.next(vid); vs.advance(vid)) {
ItemExpr* ie = vid.getItemExpr();
NAString colName;
if ( ie->getOperatorType() == ITM_BASECOLUMN ) {
colName = ((BaseColumn*)ie)->getColName();
} else
if ( ie->getOperatorType() == ITM_INDEXCOLUMN ) {
colName = ((IndexColumn*)ie)->getNAColumn()->getIndexColName();
}
if (NOT colNames_.contains(colName))
colNames_.insert(colName);
}
}
示例14: setPrimaryKeyColumns
// this method sets the primary key columns. It goes through all the columns
// of the table, and collects the columns which are marked as primary keys
void TableDesc::setPrimaryKeyColumns()
{
ValueIdSet primaryColumns;
for ( CollIndex j = 0 ; j < colList_.entries() ; j++ )
{
ValueId valId = colList_[j];
NAColumn *column = valId.getNAColumn();
if ( column->isPrimaryKey() )
{
primaryColumns.insert(valId) ;
// mark column as referenced for histogram, as we may need its histogram
// during plan generation
if ((column->isUserColumn() || column->isSaltColumn() ) &&
(column->getNATable()->getSpecialType() == ExtendedQualName::NORMAL_TABLE) )
column->setReferencedForMultiIntHist();
}
}
primaryKeyColumns_ = primaryColumns;
}
示例15: new
short ExpGenerator::buildKeyInfo(keyRangeGen ** keyInfo, // out -- generated object
Generator * generator,
const NAColumnArray & keyColumns,
const ValueIdList & listOfKeyColumns,
const ValueIdList & beginKeyPred,
const ValueIdList & endKeyPred,
const SearchKey * searchKey,
const MdamKey * mdamKeyPtr,
const NABoolean reverseScan,
unsigned short keytag,
const ExpTupleDesc::TupleDataFormat tf,
// the next few parameters are here
// as part of a horrible kludge for
// the PartitionAccess::codeGen()
// method, which lacks a SearchKey
// object and therefore exposes
// things like the exclusion
// expressions; with luck, later work
// in the Optimizer will result in a
// much cleaner interface
const NABoolean useTheHorribleKludge,
ItemExpr * beginKeyExclusionExpr,
ItemExpr * endKeyExclusionExpr,
ex_expr_lean ** unique_key_expr,
ULng32 *uniqueKeyLen,
NABoolean doKeyEncodeOpt,
Lng32 * firstKeyColOffset,
Int32 in_key_atp_index
)
{
Space * space = generator->getSpace();
const Int32 work_atp = 1;
const Int32 key_atp_index = (in_key_atp_index <= 0 ? 2 : in_key_atp_index);
const Int32 exclude_flag_atp_index = 3;
const Int32 data_conv_error_atp_index = 4;
const Int32 key_column_atp_index = 5; // used only for Mdam
const Int32 key_column2_atp_index = 6; // used only for Mdam MDAM_BETWEEN pred;
// code in BiLogic::mdamPredGenSubrange
// and MdamColumn::buildDisjunct
// requires this to be 1 more than
// key_column_atp_index
ULng32 keyLen;
// add an entry to the map table for work Atp
MapTable *keyBufferPartMapTable = generator->appendAtEnd();
// generate a temporary variable, which will be used for handling
// data conversion errors during key building
ValueIdList temp_varb_list;
ItemExpr * dataConversionErrorFlag = new(generator->wHeap())
HostVar("_sys_dataConversionErrorFlag",
new(generator->wHeap()) SQLInt(TRUE,FALSE), // int not null
TRUE);
ULng32 temp_varb_tupp_len;
dataConversionErrorFlag->bindNode(generator->getBindWA());
temp_varb_list.insert(dataConversionErrorFlag->getValueId());
processValIdList(temp_varb_list,
ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
temp_varb_tupp_len, // out
work_atp,
data_conv_error_atp_index);
NABoolean doEquiKeyPredOpt = FALSE;
#ifdef _DEBUG
if (getenv("DO_EQUI_KEY_PRED_OPT"))
doEquiKeyPredOpt
= (searchKey ? searchKey->areAllChosenPredsEqualPreds() : FALSE);
#endif
if (mdamKeyPtr == NULL)
{
// check to see if there is a begin key expression; if there
// isn't, don't generate a key object
if (beginKeyPred.entries() == 0)
*keyInfo = 0;
else
{
// For subset and range operators, generate the begin key
// expression, end key expression, begin key exclusion expression
// and end key exclusion expression. For unique operators,
// generate only the begin key exppression.
ex_expr *bk_expr = 0;
ex_expr *ek_expr = 0;
ex_expr *bk_excluded_expr = 0;
ex_expr *ek_excluded_expr = 0;
short bkey_excluded = 0;
short ekey_excluded = 0;
generateKeyExpr(keyColumns,
beginKeyPred,
work_atp,
key_atp_index,
dataConversionErrorFlag,
tf,
keyLen, // out
//.........这里部分代码省略.........