本文整理汇总了C++中ValueIdList::entries方法的典型用法代码示例。如果您正苦于以下问题:C++ ValueIdList::entries方法的具体用法?C++ ValueIdList::entries怎么用?C++ ValueIdList::entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValueIdList
的用法示例。
在下文中一共展示了ValueIdList::entries方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getEquivVEGCols
// -----------------------------------------------------------------------
// Given a column list providing identifiers for columns of this table,
// this method returns a list of VEG expressions and/or base columns that
// show the equivalence of base columns with index columns.
// -----------------------------------------------------------------------
void TableDesc::getEquivVEGCols (const ValueIdList& columnList,
ValueIdList &VEGColumnList) const
{
for (CollIndex i=0; i < columnList.entries(); i++)
{
ItemExpr *ie = columnList[i].getItemExpr();
BaseColumn *bc = NULL;
switch (ie->getOperatorType())
{
case ITM_BASECOLUMN:
bc = (BaseColumn *) ie;
break;
case ITM_INDEXCOLUMN:
bc = (BaseColumn *) ((IndexColumn *) ie)->getDefinition().
getItemExpr();
CMPASSERT(bc->getOperatorType() == ITM_BASECOLUMN);
break;
default:
ABORT("Invalid argument to TableDesc::getEquivVEGCols()\n");
}
CMPASSERT(bc->getTableDesc() == this);
VEGColumnList.insert(getColumnVEGList()[bc->getColNumber()]);
}
}
示例2: isUniqueIndex
NABoolean IndexDesc::isUniqueIndex() const
{
return getNAFileSet()->uniqueIndex();
#pragma nowarn(269) // warning elimination
ValueIdList nonKeyColumnList;
#pragma warn(269) // warning elimination
getNonKeyColumnList(nonKeyColumnList);
// if there are some non-index-key columns(the key of base table),
// then this is a unique index. The primary key of base table is
// not needed to define the key of the index. It is, of course,
// needed to be present in the index as a non-key column.
if (nonKeyColumnList.entries() > 0)
return TRUE;
else
return FALSE;
}
示例3: codeGen
short ProbeCache::codeGen(Generator *generator)
{
ExpGenerator * exp_gen = generator->getExpGenerator();
Space * space = generator->getSpace();
MapTable * last_map_table = generator->getLastMapTable();
ex_cri_desc * given_desc
= generator->getCriDesc(Generator::DOWN);
ex_cri_desc * returned_desc
= new(space) ex_cri_desc(given_desc->noTuples() + 1, space);
// cri descriptor for work atp has 5 entries:
// entry #0 for const
// entry #1 for temp
// entry #2 for hash value of probe input data in Probe Cache Manager
// entry #3 for encoded probe input data in Probe Cache Manager
// enrry #4 for inner table row data in this operator's cache buffer
Int32 work_atp = 1;
ex_cri_desc * work_cri_desc = new(space) ex_cri_desc(5, space);
unsigned short hashValIdx = 2;
unsigned short encodedProbeDataIdx = 3;
unsigned short innerRowDataIdx = 4;
// generate code for child tree, and get its tdb and explain tuple.
child(0)->codeGen(generator);
ComTdb * child_tdb = (ComTdb *)(generator->getGenObj());
ExplainTuple *childExplainTuple = generator->getExplainTuple();
//////////////////////////////////////////////////////
// Generate up to 4 runtime expressions.
//////////////////////////////////////////////////////
// Will use child's char. inputs (+ execution count) for the next
// two runtime expressions.
ValueIdList inputsToUse = child(0).getGroupAttr()->getCharacteristicInputs();
inputsToUse.insert(generator->getOrAddStatementExecutionCount());
// Expression #1 gets the hash value of the probe input data
ValueIdList hvAsList;
// Executor has hard-coded assumption that the result is long,
// so add a Cast node to convert result to a long.
ItemExpr *probeHashAsIe = new (generator->wHeap())
HashDistPartHash(inputsToUse.rebuildExprTree(ITM_ITEM_LIST));
probeHashAsIe->bindNode(generator->getBindWA());
NumericType &nTyp = (NumericType &)probeHashAsIe->getValueId().getType();
GenAssert(nTyp.isSigned() == FALSE,
"Unexpected signed HashDistPartHash.");
GenAssert(probeHashAsIe->getValueId().getType().supportsSQLnullLogical()
== FALSE, "Unexpected nullable HashDistPartHash.");
ItemExpr *hvAsIe = new (generator->wHeap()) Cast(
probeHashAsIe,
new (generator->wHeap())
SQLInt(FALSE, // false == unsigned.
FALSE // false == not nullable.
));
hvAsIe->bindNode(generator->getBindWA());
hvAsList.insert(hvAsIe->getValueId());
ex_expr *hvExpr = NULL;
ULng32 hvLength;
exp_gen->generateContiguousMoveExpr(
hvAsList,
0, // don't add convert node
work_atp,
hashValIdx,
ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
hvLength,
&hvExpr);
GenAssert(hvLength == sizeof(Lng32),
"Unexpected length of result of hash function.");
// Expression #2 encodes the probe input data for storage in
// the ProbeCacheManager.
ValueIdList encodeInputAsList;
CollIndex inputListIndex;
for (inputListIndex = 0;
inputListIndex < inputsToUse.entries();
inputListIndex++) {
ItemExpr *inputIe =
(inputsToUse[inputListIndex].getValueDesc())->getItemExpr();
if (inputIe->getValueId().getType().getVarLenHdrSize() > 0)
{
// This logic copied from Sort::codeGen().
//.........这里部分代码省略.........
示例4: ft_codegen
static short ft_codegen(Generator *generator,
RelExpr &relExpr,
ComTdbFastExtract *&newTdb,
Cardinality estimatedRowCount,
char * targetName,
char * hdfsHost,
Int32 hdfsPort,
char * hiveTableName,
char * delimiter,
char * header,
char * nullString,
char * recordSeparator,
ULng32 downQueueMaxSize,
ULng32 upQueueMaxSize,
ULng32 outputBufferSize,
ULng32 requestBufferSize,
ULng32 replyBufferSize,
ULng32 numOutputBuffers,
ComTdb * childTdb,
NABoolean isSequenceFile)
{
CmpContext *cmpContext = generator->currentCmpContext();
Space *space = generator->getSpace();
ExpGenerator *exp_gen = generator->getExpGenerator();
MapTable *map_table = generator->getMapTable();
MapTable *last_map_table = generator->getLastMapTable();
ex_expr *input_expr = NULL;
ex_expr *output_expr = NULL;
ex_expr * childData_expr = NULL ;
ex_expr * cnvChildData_expr = NULL ;
ULng32 i;
ULng32 requestRowLen = 0;
ULng32 outputRowLen = 0;
ULng32 childDataRowLen = 0;
ULng32 cnvChildDataRowLen = 0;
ExpTupleDesc *requestTupleDesc = NULL;
ExpTupleDesc *outputTupleDesc = NULL;
ExpTupleDesc *childDataTupleDesc = NULL;
ExpTupleDesc *cnvChildDataTupleDesc = NULL;
newTdb = NULL;
OperatorTypeEnum relExprType = relExpr.getOperatorType();
GenAssert(relExprType == REL_FAST_EXTRACT, "Unexpected RelExpr at FastExtract codegen")
FastExtract * fastExtract = (FastExtract *) &relExpr;
const Int32 workAtpNumber = 1;
ex_cri_desc *given_desc = generator->getCriDesc(Generator::DOWN);
ex_cri_desc *returned_desc = NULL;
ex_cri_desc *work_cri_desc = NULL;
returned_desc = given_desc;
// Setup local variables related to the work ATP
unsigned short numWorkTupps = 0;
unsigned short childDataTuppIndex = 0;
unsigned short cnvChildDataTuppIndex = 0;
numWorkTupps = 3;
childDataTuppIndex = numWorkTupps - 1 ;
numWorkTupps ++;
cnvChildDataTuppIndex = numWorkTupps - 1;
work_cri_desc = new (space) ex_cri_desc(numWorkTupps, space);
ExpTupleDesc::TupleDataFormat childReqFormat = ExpTupleDesc::SQLMX_ALIGNED_FORMAT;
ValueIdList childDataVids;
ValueIdList cnvChildDataVids;
const ValueIdList& childVals = fastExtract->getSelectList();
for (i = 0; i < childVals.entries(); i++)
{
ItemExpr &inputExpr = *(childVals[i].getItemExpr());
const NAType &formalType = childVals[i].getType();
ItemExpr *lmExpr = NULL;
ItemExpr *lmExpr2 = NULL;
int res;
lmExpr = &inputExpr; //CreateCastExpr(inputExpr, *inputExpr.getValueId().getType().newCopy(), cmpContext);
res = CreateAllCharsExpr(formalType, // [IN] Child output type
*lmExpr, // [IN] Actual input value
cmpContext, // [IN] Compilation context
lmExpr2 // [OUT] Returned expression
);
GenAssert(res == 0 && lmExpr != NULL,
"Error building expression tree for LM child Input value");
lmExpr->bindNode(generator->getBindWA());
childDataVids.insert(lmExpr->getValueId());
if (lmExpr2)
{
lmExpr2->bindNode(generator->getBindWA());
cnvChildDataVids.insert(lmExpr2->getValueId());
}
} // for (i = 0; i < childVals.entries(); i++)
//.........这里部分代码省略.........
示例5: insertTree
void ItemExprList::insertTree(ItemExpr *tree,
OperatorTypeEnum backBoneType,
NABoolean flattenSBQ, NABoolean flattenUDF)
{
if (tree->getOperatorType() == backBoneType)
{
for (Int32 i = 0; i < tree->getArity(); i++)
{
// Check for NULL list for right linear trees. That is, arity may be
// two, but second child is NULL.
ItemExpr *child = tree->child(i);
if (child)
insertTree(tree->child(i), backBoneType, flattenSBQ, flattenUDF);
}
}
else if (tree->getOperatorType() == ITM_ONE_ROW)
{
Aggregate *agr = (Aggregate *)tree;
if (agr->isOneRowTransformed_)
{
for (Int32 i = 0; i < tree->getArity(); i++)
insertTree(tree->child(i), backBoneType, flattenSBQ, flattenUDF);
}
else
{
// do nothing, postpone this processing until OneRow transformation
// is done
}
}
else if ((flattenSBQ AND tree->isASubquery()) OR
(flattenUDF AND
(tree->getOperatorType() == ITM_USER_DEF_FUNCTION)) AND
(NOT tree->nodeIsTransformed()))
// Added the extra check for transformation above to avoid any issues
// where we might flatten a subquery/MVF a second time around while
// we deal with ValueIdProxies.
// The ValueIdProxy->needToTransformChild()
// flag should be sufficient, but it never hurts to be safe.
{
ValueIdList cols;
NABoolean haveRDesc(FALSE);
if (tree->isASubquery())
{
// flatten the subquery select list
RETDesc *retDesc = ((Subquery*)tree)->getSubquery()->getRETDesc();
if (retDesc)
{
retDesc->getColumnList()->getValueIdList(cols);
if (cols.entries() > 1)
{
haveRDesc = TRUE;
}
}
}
else if (tree->getOperatorType() == ITM_USER_DEF_FUNCTION)
{
// flatten the UDF by adding the additional outputs to the tree
const RoutineDesc *rDesc = ((UDFunction *)tree)->getRoutineDesc();
if (rDesc && rDesc->getOutputColumnList().entries() > 1)
{
cols = rDesc->getOutputColumnList();
haveRDesc = TRUE;
}
}
if (haveRDesc == TRUE)
{
for (CollIndex i = 0; i < cols.entries(); i++)
{
ValueId proxyId;
proxyId = cols[i];
// We create a ValueIdProxy for each element in the subquery's
// select list or for each output parameter of a MVF. The first
// one of these will be marked to be transformed. This allows
// us to get the correct degree of statements containing MVFs or
// subquery with degree > 1 at bind time.
ValueIdProxy *proxyOutput =
new (CmpCommon::statementHeap())
ValueIdProxy( tree->getValueId(),
proxyId,
i);
proxyOutput->synthTypeAndValueId();
// Make sure we transform the subquery or MVF
if (i == 0 ) proxyOutput->setTransformChild(TRUE);
insert(proxyOutput);
}
}
else
insert(tree); // we are processing a valueId of a UDFunction
//.........这里部分代码省略.........
示例6: ft_codegen
static short ft_codegen(Generator *generator,
RelExpr &relExpr,
ComTdbFastExtract *&newTdb,
Cardinality estimatedRowCount,
char * targetName,
char * hdfsHost,
Int32 hdfsPort,
char * hiveTableName,
char * delimiter,
char * header,
char * nullString,
char * recordSeparator,
ULng32 downQueueMaxSize,
ULng32 upQueueMaxSize,
ULng32 outputBufferSize,
ULng32 requestBufferSize,
ULng32 replyBufferSize,
ULng32 numOutputBuffers,
ComTdb * childTdb,
NABoolean isSequenceFile)
{
CmpContext *cmpContext = generator->currentCmpContext();
Space *space = generator->getSpace();
ExpGenerator *exp_gen = generator->getExpGenerator();
MapTable *map_table = generator->getMapTable();
MapTable *last_map_table = generator->getLastMapTable();
ex_expr *input_expr = NULL;
ex_expr *output_expr = NULL;
ex_expr * childData_expr = NULL ;
ex_expr * cnvChildData_expr = NULL ;
ULng32 i;
ULng32 requestRowLen = 0;
ULng32 outputRowLen = 0;
ULng32 childDataRowLen = 0;
ULng32 cnvChildDataRowLen = 0;
ExpTupleDesc *requestTupleDesc = NULL;
ExpTupleDesc *outputTupleDesc = NULL;
ExpTupleDesc *childDataTupleDesc = NULL;
ExpTupleDesc *cnvChildDataTupleDesc = NULL;
newTdb = NULL;
OperatorTypeEnum relExprType = relExpr.getOperatorType();
GenAssert(relExprType == REL_FAST_EXTRACT, "Unexpected RelExpr at FastExtract codegen")
FastExtract * fastExtract = (FastExtract *) &relExpr;
const Int32 workAtpNumber = 1;
ex_cri_desc *given_desc = generator->getCriDesc(Generator::DOWN);
ex_cri_desc *returned_desc = NULL;
ex_cri_desc *work_cri_desc = NULL;
returned_desc = given_desc;
// Setup local variables related to the work ATP
unsigned short numWorkTupps = 0;
unsigned short childDataTuppIndex = 0;
unsigned short cnvChildDataTuppIndex = 0;
numWorkTupps = 3;
childDataTuppIndex = numWorkTupps - 1 ;
numWorkTupps ++;
cnvChildDataTuppIndex = numWorkTupps - 1;
work_cri_desc = new (space) ex_cri_desc(numWorkTupps, space);
ExpTupleDesc::TupleDataFormat childReqFormat = ExpTupleDesc::SQLMX_ALIGNED_FORMAT;
ValueIdList childDataVids;
ValueIdList cnvChildDataVids;
const ValueIdList& childVals = fastExtract->getSelectList();
const NATable *hiveNATable = NULL;
const NAColumnArray *hiveNAColArray = NULL;
// hiveInsertErrMode:
// if 0, do not do error checks.
// if 1, do error check and return error.
// if 2, do error check and ignore row, if error
// if 3, insert null if an error occurs
Lng32 hiveInsertErrMode = 0;
if ((fastExtract) && (fastExtract->isHiveInsert()) &&
(fastExtract->getHiveTableDesc()) &&
(fastExtract->getHiveTableDesc()->getNATable()) &&
((hiveInsertErrMode = CmpCommon::getDefaultNumeric(HIVE_INSERT_ERROR_MODE)) > 0))
{
hiveNATable = fastExtract->getHiveTableDesc()->getNATable();
hiveNAColArray = &hiveNATable->getNAColumnArray();
}
for (i = 0; i < childVals.entries(); i++)
{
ItemExpr &inputExpr = *(childVals[i].getItemExpr());
const NAType &formalType = childVals[i].getType();
ItemExpr *lmExpr = NULL;
ItemExpr *lmExpr2 = NULL;
int res;
lmExpr = &inputExpr;
lmExpr = lmExpr->bindNode(generator->getBindWA());
if (!lmExpr || generator->getBindWA()->errStatus())
{
//.........这里部分代码省略.........
示例7: buildKeyInfo
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
//.........这里部分代码省略.........