本文整理汇总了C++中ValueIdSet类的典型用法代码示例。如果您正苦于以下问题:C++ ValueIdSet类的具体用法?C++ ValueIdSet怎么用?C++ ValueIdSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueIdSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getPotentialOutputs
ValueIdSet AppliedStatMan::getPotentialOutputs(
const CANodeIdSet & jbbcsNodeSet)
{
ValueIdSet potentialOutputs;
for (CANodeId jbbc = jbbcsNodeSet.init();
jbbcsNodeSet.next(jbbc);
jbbcsNodeSet.advance(jbbc))
{
if (NodeAnalysis * jbbcNodeAnalysis = jbbc.getNodeAnalysis())
{
ValueIdSet outputs;
const Join * jbbcParentJoin = jbbcNodeAnalysis->getJBBC()->
getOriginalParentJoin();
if((!jbbcParentJoin) ||
(jbbcParentJoin && jbbcParentJoin->isInnerNonSemiJoin()))
outputs = jbbcNodeAnalysis->getOriginalExpr()->\
getGroupAttr()->getCharacteristicOutputs();
else if (jbbcParentJoin->isLeftJoin())
outputs = jbbcParentJoin->nullInstantiatedOutput();
potentialOutputs.insert(outputs);
}
}
return potentialOutputs;
} // AppliedStatMan::getPotentialOutputs
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:26,代码来源:AppliedStatMan.cpp
示例2: getUserColumnList
// LCOV_EXCL_START - cnu
CostScalar
TableDesc::getBaseRowCntIfUniqueJoinCol(const ValueIdSet &joinedCols)
{
// get the joining columns for this table
ValueIdList userColumns;
// get All user columns for this table;
getUserColumnList(userColumns);
ValueIdSet userColumnSet(userColumns);
ValueIdSet joinedColsCopy(joinedCols);
ValueIdSet thisTableJoinCols = joinedColsCopy.intersect(userColumnSet);
if (thisTableJoinCols.isEmpty() )
return csMinusOne;
CostScalar baseRowCount = csMinusOne;
if (thisTableJoinCols.doColumnsConstituteUniqueIndex(this) )
baseRowCount = tableColStats()[0]->getColStats()->getRowcount();
return baseRowCount;
} // TableDesc::getBaseRowCntIfUniqueJoinCol
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:27,代码来源:TableDesc.cpp
示例3: generateMarkedEntries
void
generateMarkedEntries(Generator *generator, ValueIdSet &marks)
{
for(ValueId vid = marks.init(); marks.next(vid); marks.advance(vid)) {
MapInfo *mapInfo =
generator->getMapInfoAsIs(vid);
if(mapInfo)
mapInfo->codeGenerated();
}
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:11,代码来源:GenItemExpr.cpp
示例4: 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
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:59,代码来源:GenRelSequence.cpp
示例5: 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;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:13,代码来源:TableDesc.cpp
示例6: getLocalPreds
ValueIdSet TableDesc::getLocalPreds()
{
ValueIdSet localPreds;
localPreds.clear();
// We can get this information from TableAnalysis
const TableAnalysis * tableAnalysis = getTableAnalysis();
// if no tableAnalysis exists, return FALSE
if(tableAnalysis)
localPreds = tableAnalysis->getLocalPreds();
return localPreds;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:14,代码来源:TableDesc.cpp
示例7: locateVEGRegionAndMarkToBeMerged
void NormWA::locateVEGRegionAndMarkToBeMergedRecursively(const ValueId & vid)
{
VEGRegion* toBeMergedRegion = locateVEGRegionAndMarkToBeMerged(vid);
if (toBeMergedRegion)
{
ValueIdSet nullInstValues;
toBeMergedRegion->gatherInstantiateNullMembers(nullInstValues);
for (ValueId exprId = nullInstValues.init();
nullInstValues.next(exprId);
nullInstValues.advance(exprId))
{
locateVEGRegionAndMarkToBeMergedRecursively(exprId);
}
}
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:15,代码来源:NormWA.cpp
示例8: getPotentialOutputValues
void MultiJoin::getPotentialOutputValues(ValueIdSet & outputValues) const
{
outputValues.clear();
CANodeIdSet jbbcs = jbbSubset_.getJBBCs();
Int32 arity = getArity();
for (Lng32 i = 0; i < arity; i++)
{
JBBC * jbbci =
child(i)->getGroupAnalysis()->getNodeAnalysis()->getJBBC();
if(jbbci->parentIsLeftJoin())
outputValues.insertList(jbbci->nullInstantiatedOutput());
else
// Default implementation is good enough for innerNonSemi multi join
outputValues += child(i).getGroupAttr()->getCharacteristicOutputs();
}
} // MultiJoin::getPotentialOutputValues()
开发者ID:lanbb,项目名称:incubator-trafodion,代码行数:20,代码来源:MultiJoin.cpp
示例9: child
void PhysSequence::seperateReadAndReturnItems(
//ValueIdSet & readPhaseSet,
//ValueIdSet & returnPhaseSet,
CollHeap *wHeap)
{
ValueIdSet outputFromChild = child(0)->getGroupAttr()->getCharacteristicOutputs();
ValueIdSet seqFuncs = sequenceFunctions();
for(ValueId valId = seqFuncs.init();
seqFuncs.next(valId);
seqFuncs.advance(valId))
{
computeReadNReturnItems(valId,
valId,
//sequenceFunctions(),
//returnSeqFunctions(),
outputFromChild,
wHeap);
}
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:22,代码来源:GenRelSequence.cpp
示例10: 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);
}
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:22,代码来源:HbaseSearchSpec.cpp
示例11: getGroupAttr
// -----------------------------------------------------------------------
// MultJoin::recomputeOuterReferences()
// -----------------------------------------------------------------------
void MultiJoin::recomputeOuterReferences()
{
// ---------------------------------------------------------------------
// Delete all those input values that are no longer referenced on
// this operator.
// ---------------------------------------------------------------------
if (NOT getGroupAttr()->getCharacteristicInputs().isEmpty())
{
ValueIdSet outerRefs = getGroupAttr()->getCharacteristicInputs();
// Weed out those expressions not needed by my selectionPred and joinPred
// xxx instead of taking this from getLocalJoinPreds, should I take it
// from MultiJoin selectionPred??? refer to getLocalJoinPreds definition
// and consider preds that referencing inputs!!!
ValueIdSet exprSet = jbbSubset_.getLocalJoinPreds(); // from JbbSubsetAnalysis
// Need to include LocalDependentPreds later when supported. Ok now for inner MultiJoins
exprSet.weedOutUnreferenced(outerRefs);
// Add back those expressiones needed by my children
Int32 arity = getArity();
// outputs produced by JBBCs in this MultiJoin
ValueIdSet jbbcOutputs;
for (Int32 i = 0; i < arity; i++)
{
outerRefs += child(i)->getGroupAttr()->getCharacteristicInputs();
jbbcOutputs += child(i)->getGroupAttr()->getCharacteristicOutputs();
// these inputs are provided by jbbcs in this MultiJoin
}
// account for TSJs i.e. values flowing from
// one jbbc to another within this MultiJoin
outerRefs -= jbbcOutputs;
getGroupAttr()->setCharacteristicInputs(outerRefs);
}
return;
} // MultiJoin::recomputeOuterReferences()
开发者ID:lanbb,项目名称:incubator-trafodion,代码行数:42,代码来源:MultiJoin.cpp
示例12: isAnyHistWithPredsFakeOrSmallSample
// Is there any column which has a local predicates and no stats
NABoolean TableDesc::isAnyHistWithPredsFakeOrSmallSample(const ValueIdSet &localPreds)
{
// if there are no local predicates return FALSE;
if (localPreds.isEmpty())
return FALSE;
const ColStatDescList & colStatsList = getTableColStats();
// for each predicate, check to see if stats exist
for (ValueId id = localPreds.init();
localPreds.next(id);
localPreds.advance(id))
{
ColStatsSharedPtr colStats = colStatsList.getColStatsPtrForPredicate(id);
if (colStats == NULL)
return FALSE;
if (colStats->isOrigFakeHist() || colStats->isSmallSampleHistogram())
return TRUE;
}
return FALSE;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:24,代码来源:TableDesc.cpp
示例13: 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;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:26,代码来源:TableDesc.cpp
示例14: isKeyIndex
// 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;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:26,代码来源:TableDesc.cpp
示例15: computeReadNReturnItems
void PhysSequence::computeReadNReturnItems( ValueId topSeqVid,
ValueId vid,
const ValueIdSet &outputFromChild,
CollHeap *wHeap)
{
ItemExpr * itmExpr = vid.getItemExpr();
if (outputFromChild.contains(vid))
{
return;
}
//test if itm_minus and then if negative offset ....
if ( itmExpr->getOperatorType() == ITM_OFFSET &&
((ItmSeqOffset *)itmExpr)->getOffsetConstantValue() < 0)
{
readSeqFunctions() -= topSeqVid;
returnSeqFunctions() += topSeqVid;
readSeqFunctions() += itmExpr->child(0)->castToItemExpr()->getValueId();
return;
}
if (itmExpr->getOperatorType() == ITM_MINUS)
{
ItemExpr * chld0 = itmExpr->child(0)->castToItemExpr();
if ( chld0->getOperatorType() == ITM_OFFSET &&
((ItmSeqOffset *)chld0)->getOffsetConstantValue() <0)
{
readSeqFunctions() -= topSeqVid;
returnSeqFunctions() += topSeqVid;
readSeqFunctions() += chld0->child(0)->castToItemExpr()->getValueId();
ItemExpr * chld1 = itmExpr->child(1)->castToItemExpr();
if (chld1->getOperatorType() == ITM_OFFSET &&
((ItmSeqOffset *)chld1)->getOffsetConstantValue() < 0)
{
readSeqFunctions() += chld1->child(0)->castToItemExpr()->getValueId();
}
else
{
readSeqFunctions() += chld1->getValueId();
}
return;
}
}
if (itmExpr->getOperatorType() == ITM_OLAP_MIN ||
itmExpr->getOperatorType() == ITM_OLAP_MAX)
{
ItmSeqOlapFunction * olap = (ItmSeqOlapFunction *)itmExpr;
if (olap->getframeEnd()>0)
{
readSeqFunctions() -= topSeqVid;
returnSeqFunctions() += topSeqVid;
ItemExpr *newChild = new(wHeap) Convert (itmExpr->child(0)->castToItemExpr());
newChild->synthTypeAndValueId(TRUE);
itmExpr->child(0) = newChild;
readSeqFunctions() += newChild->getValueId();
return;
}
}
if (itmExpr->getOperatorType() == ITM_SCALAR_MIN ||
itmExpr->getOperatorType() == ITM_SCALAR_MAX)
{
ItemExpr * chld0 = itmExpr->child(0)->castToItemExpr();
ItemExpr * chld1 = itmExpr->child(1)->castToItemExpr();
if ((chld0->getOperatorType() == ITM_OLAP_MIN && chld1->getOperatorType() == ITM_OLAP_MIN )||
(chld0->getOperatorType() == ITM_OLAP_MAX && chld1->getOperatorType() == ITM_OLAP_MAX ))
{
ItmSeqOlapFunction * olap0 = (ItmSeqOlapFunction *)chld0;
ItmSeqOlapFunction * olap1 = (ItmSeqOlapFunction *)chld1;
if ( olap1->getframeEnd()>0)
{
CMPASSERT(olap0->getframeEnd()==0);
readSeqFunctions() -= topSeqVid;
returnSeqFunctions() += topSeqVid;
readSeqFunctions() += olap0->getValueId();
ItemExpr *newChild = new(wHeap) Convert (olap1->child(0)->castToItemExpr());
newChild->synthTypeAndValueId(TRUE);
olap1->child(0) = newChild;
readSeqFunctions() += newChild->getValueId();
}
else
{
CMPASSERT(olap1->getframeEnd()==0);
readSeqFunctions() -= topSeqVid;
returnSeqFunctions() += topSeqVid;
//.........这里部分代码省略.........
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:101,代码来源:GenRelSequence.cpp
示例16: mapOutputsForUpdate
// ------------------------------------------------------------------------------
// create my colStats based on my child's output, by converting the columns to
// that of mine
// ------------------------------------------------------------------------------
void EstLogProp::mapOutputsForUpdate(const GenericUpdate & updateExpr,
const ValueIdMap & updateSelectValueIdMap)
{
TableDesc * updateTable = updateExpr.getTableDesc();
for ( CollIndex i = 0; i < colStats().entries(); i++ )
{
ColStatDescSharedPtr colStatPtr = (colStats())[i];
const ValueId columnId = colStatPtr->getVEGColumn();
ValueId updateColVEGOutputId;
updateSelectValueIdMap.mapValueIdUp(updateColVEGOutputId, columnId);
ValueId updateBaseColumnId;
if (updateColVEGOutputId != columnId)
{
updateBaseColumnId = updateColVEGOutputId;
ValueIdSet baseColumns;
updateColVEGOutputId.getItemExpr()->findAll( ITM_BASECOLUMN, baseColumns, TRUE, TRUE );
// from all the columns extracted, get the one for Insert table
TableDesc * thisTable = NULL;
for (ValueId column = baseColumns.init(); baseColumns.next(column);
baseColumns.advance(column) )
{
ItemExpr * columnExpr = column.getItemExpr();
thisTable = ((BaseColumn *)columnExpr)->getTableDesc();
if (thisTable == updateTable)
{
// set my column as the base column
updateBaseColumnId = column;
break;
}
}
ColStatsSharedPtr inColStats = colStatPtr->getColStats();
ColStatsSharedPtr colStatsForUpdate(new (STMTHEAP) ColStats (*inColStats,STMTHEAP));
colStatsForUpdate->setStatColumn(updateBaseColumnId.getNAColumn());
// use this ColStat to generate new ColStat corresponding to the char output
// of the Update expression
ColStatDescSharedPtr colStatDescForUpdate(new (STMTHEAP) ColStatDesc(colStatsForUpdate,
updateBaseColumnId, // ValueId of the column that will be used
// as a column name, VEG and mergeStats
STMTHEAP), STMTHEAP);
colStatDescForUpdate->VEGColumn() = updateColVEGOutputId;
colStatDescForUpdate->mergeState().clear() ;
colStatDescForUpdate->mergeState().insert(updateBaseColumnId);
// Remove the old colStat and insert this colStat into the result colStatDescList
colStats().removeAt( i );
colStats().insertDeepCopyAt(i, colStatDescForUpdate, // colStats to be copied
1, // scale
FALSE);
}
}
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:66,代码来源:EstLogProp.cpp
示例17: pickOutputs
// ---------------------------------------------------------------------
// Utility Routine: pickOutputs
//
// From the given ColStatDescList, populate columnStats_ with column
// descriptors that are useful based on the characteristic outputs for
// the group.
//
// Always include in the output the current histograms of the input data,
// and, if the histogram is contained in the required output list, then
// this is a useful histogram and will also be output.
//
// ---------------------------------------------------------------------
void EstLogProp::pickOutputs( ColStatDescList & columnStats,
const EstLogPropSharedPtr& inputEstLogProp,
const ValueIdSet specifiedOutputs,
const ValueIdSet predSet)
{
const ColStatDescList & outerColStatsList = inputEstLogProp->getColStats();
ValueIdSet colsRequiringHistograms = specifiedOutputs;
// (i) see if the selection predicates contain any constant value or a
// constant expression
// (ii) check if there are any columns of this table being joined to some other
// columns, which do not appear as characteristics outputs. There should be
// histograms available for these columns, as these might be needed later.
// This problem was seen for temporary tables created as normal_tables by the
// triggers.
colsRequiringHistograms.addSet(predSet.getColumnsForHistogram());
colStats().setMCSkewedValueLists(columnStats.getMCSkewedValueLists()) ;
NABoolean colStatDescAdded = FALSE;
for (CollIndex i=0; i < columnStats.entries(); i++)
{
// we probably don't need 'em all, but this is the easiest way to
// grab all of the multi-column uec information we'll need later
colStats().insertIntoUecList (columnStats.getUecList()) ;
colStats().setScanRowCountWithoutHint(columnStats.getScanRowCountWithoutHint());
NABoolean found = FALSE;
// Note: The following inserts into a ColStatDescList should not
// have to be deep copies. From this point on, ColStatDescs that
// describe the output of the calling operator are read-only.
ColStatDescSharedPtr colStatDesc = columnStats[i];
// the value-id we're looking for
const ValueId columnId = colStatDesc->getVEGColumn() ;
for (CollIndex j=0 ; j < outerColStatsList.entries() ; j++)
{
if (columnId == outerColStatsList[j]->getVEGColumn() OR
(CmpCommon::context()->showQueryStats()))
{
colStats().insert(colStatDesc) ;
found = TRUE;
if(!colStatDescAdded)
colStatDescAdded = TRUE;
break ; // jump to next ColStatDesc
}
}
// OK, the valueid doesn't match directly -- but there are still a
// couple of things to check in order to verify whether or not we're
// interested in keeping the i'th ColStatDesc ...
ValueId throwaway ; // used by the second clause below
if ( NOT found AND
(columnId != NULL_VALUE_ID) AND
(colsRequiringHistograms.contains (columnId) OR
colsRequiringHistograms.referencesTheGivenValue (columnId, throwaway) OR
columnId.isInvolvedInJoinAndConst() OR
CmpCommon::context()->showQueryStats() )
)
{
colStats().insert(colStatDesc);
found = TRUE;
if(!colStatDescAdded)
colStatDescAdded = TRUE;
}
if (CURRSTMT_OPTDEFAULTS->incorporateSkewInCosting())
{
// if the column is referenced for histogram, but is
// not needed beyond this time , then we shall save its
// max freq, which might be used later in costing if this
// column is a part of the partitioning key
ColStatsSharedPtr stat = colStatDesc->getColStats();
if (!(stat->isVirtualColForHist() ) && NOT found &&
!(stat->isOrigFakeHist() ) )
{
const ValueId col = colStatDesc->getColumn();
ColAnalysis * colAnalysis = col.colAnalysis();
//.........这里部分代码省略.........
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:101,代码来源:EstLogProp.cpp
示例18: CMPASSERT
//.........这里部分代码省略.........
JBBC * rightChild = rightSet.getJBBCs().getFirst().getNodeAnalysis()
->getJBBC();
Join * rightChildParentJoin = rightChild->getOriginalParentJoin();
// If rightChildParentJoin is NULL, then the child is the left
// child of the left most join and is considered to be connected
// via a InnerNonSemi join.
if(rightChildParentJoin)
{
if(rightChildParentJoin->derivedFromRoutineJoin())
derivedFromRoutineJoin = TRUE;
if(rightChildParentJoin->isSemiJoin())
result = new (outHeap) Join(child0, child1, REL_SEMIJOIN, NULL);
if(rightChildParentJoin->isAntiSemiJoin())
result = new (outHeap) Join(child0, child1, REL_ANTI_SEMIJOIN, NULL);
if(rightChildParentJoin->isLeftJoin())
{
// left joins can have filter preds, i.e. predicates that
// are applied as filters after applying the join predicate.
// We need to set them here.
result = new (outHeap) Join(child0, child1, REL_LEFT_JOIN, NULL);
result->setSelectionPredicates(rightChild->getLeftJoinFilterPreds());
}
if(rightChildParentJoin->isRoutineJoin())
{
derivedFromRoutineJoin = TRUE;
result = new (outHeap) Join(child0, child1, REL_ROUTINE_JOIN, NULL);
ValueIdSet routineJoinFilterPreds = rightChild->getRoutineJoinFilterPreds();
ValueIdSet predsToAddToRoutineJoin;
// add covered filter preds
for (ValueId filterPred= routineJoinFilterPreds.init();
routineJoinFilterPreds.next(filterPred);
routineJoinFilterPreds.advance(filterPred) )
{
if(jbbSubset_.coversExpr(filterPred))
predsToAddToRoutineJoin += filterPred;
}
result->setSelectionPredicates(predsToAddToRoutineJoin);
}
if(result)
{
// set the join predicate for special joins, note predicates
// for regular InnerNonSemi joins are set as selection predicates
// in the join relexpr.
result->setJoinPred(rightChild->getPredsWithPredecessors());
result->nullInstantiatedOutput().insert(rightChild->
nullInstantiatedOutput());
}
}
}
// The join to be created is a regular InnerNonSemi join
if (!result)
result = new (outHeap) Join(child0, child1, REL_JOIN, NULL);
// Make sure we carry the derivedFromRoutineJoin flag with us
开发者ID:lanbb,项目名称:incubator-trafodion,代码行数:67,代码来源:MultiJoin.cpp
示例19: computeHistoryRows
// computeHistoryBuffer
//
// Helper function that traverses the set of root sequence functions
// supplied by the compiler and dynamically determines the size
// of the history buffer.
//
void PhysSequence::computeHistoryRows(const ValueIdSet &sequenceFunctions,//historyIds
Lng32 &computedHistoryRows,
Lng32 &unableToCalculate,
NABoolean &unboundedFollowing,
Lng32 &minFollowingRows,
const ValueIdSet &outputFromChild)
{
ValueIdSet children;
ValueIdSet historyAttributes;
Lng32 value = 0;
for(ValueId valId = sequenceFunctions.init();
sequenceFunctions.next(valId);
sequenceFunctions.advance(valId))
{
if(valId.getItemExpr()->isASequenceFunction())
{
ItemExpr *itmExpr = valId.getItemExpr();
switch(itmExpr->getOperatorType())
{
// THIS and NOT THIS are not dynamically computed
//
case ITM_THIS:
case ITM_NOT_THIS:
break;
// The RUNNING functions and LastNotNull all need to go back just one row.
//
case ITM_RUNNING_SUM:
case ITM_RUNNING_COUNT:
case ITM_RUNNING_MIN:
case ITM_RUNNING_MAX:
case ITM_RUNNING_CHANGE:
case ITM_LAST_NOT_NULL:
computedHistoryRows = MAXOF(computedHistoryRows, 2);
break;
///set to unable to compute for now-- will change later to compte values from frameStart_ and frameEnd_
case ITM_OLAP_SUM:
case ITM_OLAP_COUNT:
case ITM_OLAP_MIN:
case ITM_OLAP_MAX:
case ITM_OLAP_RANK:
case ITM_OLAP_DRANK:
{
if ( !outputFromChild.contains(itmExpr->getValueId()))
{
ItmSeqOlapFunction * olap = (ItmSeqOlapFunction*)itmExpr;
if (olap->isFrameStartUnboundedPreceding()) //(olap->getframeStart() == - INT_MAX)
{
computedHistoryRows = MAXOF(computedHistoryRows, 2);
}
else
{
computedHistoryRows = MAXOF(computedHistoryRows, ABS(olap->getframeStart()) + 2);
}
if (!olap->isFrameEndUnboundedFollowing()) //(olap->getframeEnd() != INT_MAX)
{
computedHistoryRows = MAXOF(computedHistoryRows, ABS(olap->getframeEnd()) + 1);
}
if (olap->isFrameEndUnboundedFollowing()) //(olap->getframeEnd() == INT_MAX)
{
unboundedFollowing = TRUE;
if (olap->getframeStart() > 0)
{
minFollowingRows = ((minFollowingRows > olap->getframeStart()) ?
minFollowingRows : olap->getframeStart());
}
} else if (olap->getframeEnd() > 0)
{
minFollowingRows = ((minFollowingRows > olap->getframeEnd()) ?
minFollowingRows : olap->getframeEnd());
}
}
}
break;
// If 'rows since', we cannot determine how much history is needed.
case ITM_ROWS_SINCE:
unableToCalculate = 1;
break;
// The MOVING and OFFSET functions need to go back as far as the value
// of their second child.
//
// The second argument can be:
// Constant: for these, we can use the constant value to set the upper bound
// for the history buffer.
// ItmScalarMinMax(child0, child1) (with operType = ITM_SCALAR_MIN)
// - if child0 or child1 is a constant, then we can use either one
//.........这里部分代码省略.........
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:101,代码来源:GenRelSequence.cpp
示例20: CCMPASSERT
// This method forms the join expression for join on JBBC specified by jbbcId
// inputEstLogProp should not be cacheable
Join * AppliedStatMan::formJoinExprForJoinOnJBBC(
CANodeIdSet jbbSubset,
CANodeId jbbcId,
const ValueIdSet * jbbcLocalPreds,
const ValueIdSet * joinPreds,
const EstLogPropSharedPtr& inputEstLogProp,
const NABoolean cacheable)
{
NABoolean origInputIsCacheable = inputEstLogProp->isCacheable();
if(origInputIsCacheable)
{
inputEstLogProp->setCacheableFlag(FALSE);
CCMPASSERT("Expecting Non Cacheable Input");
}
RelExpr * jbbcExpr = getExprForCANodeId(jbbcId, inputEstLogProp, jbbcLocalPreds);
jbbcExpr->getGroupAttr()->outputLogProp(inputEstLogProp);
RelExpr * jbbSubsetExpr = jbbSubset.jbbcsToJBBSubset()->getPreferredJoin();
if(!jbbSubsetExpr)
if(jbbSubset.entries()==1)
if(!inputEstLogProp->isCacheable())
{
inputEstLogProp->setCacheableFlag(TRUE);
jbbSubsetExpr = getExprForCANodeId(jbbSubset.getFirst(), inputEstLogProp);
inputEstLogProp->setCacheableFlag(FALSE);
}
else
jbbSubsetExpr = getExprForCANodeId(jbbSubset.getFirst(), inputEstLogProp);
else
{
CCMPASSERT("No Subset expression, need at least one entry in set");
}
RelExpr * leftChildExpr = jbbSubsetExpr;
RelExpr * rightChildExpr = jbbcExpr;
GroupAttributes * galeft = jbbSubsetExpr->getGroupAttr();
GroupAttributes * garight = jbbcExpr->getGroupAttr();
// xxx
JBBC * jbbc = jbbcId.getNodeAnalysis()->getJBBC();
Join * jbbcParentJoin = jbbc->getOriginalParentJoin();
ValueIdSet leftOuterJoinFilterPreds;
Join * joinExpr = NULL;
if(jbbcParentJoin)
{
if(jbbcParentJoin->isSemiJoin())
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_SEMIJOIN, NULL);
if(jbbcParentJoin->isAntiSemiJoin())
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_ANTI_SEMIJOIN, NULL);
if(jbbcParentJoin->isLeftJoin())
{
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_LEFT_JOIN, NULL);
leftOuterJoinFilterPreds += jbbc->getLeftJoinFilterPreds();
}
if(joinExpr)
{
joinExpr->setJoinPred(jbbc->getPredsWithPredecessors());
joinExpr->nullInstantiatedOutput().insert(jbbc->nullInstantiatedOutput());
}
}
if(!joinExpr)
{
// now form a JoinExpr with these left and right children.
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_JOIN, NULL);
}
ValueIdSet selPredsAndLOJFilter = leftOuterJoinFilterPreds;
selPredsAndLOJFilter += (*joinPreds);
joinExpr->setSelectionPredicates(selPredsAndLOJFilter);
// set groupAttr of this Join expression
GroupAttributes * gaJoin = new STMTHEAP GroupAttributes();
// set required outputs of Join as sum of characteristic
// outputs of the left and the right children
ValueIdSet requiredOutputs;
requiredOutputs.addSet(getPotentialOutputs(jbbSubset));
requiredOutputs.addSet(getPotentialOutputs(jbbcId));
gaJoin->setCharacteristicOutputs(requiredOutputs);
// set JBBSubset for this group, if all estLogProps are cacheable.
// Else JBBSubset is NULL
//.........这里部分代码省略.........
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:101,代码来源:AppliedStatMan.cpp
注:本文中的ValueIdSet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论