本文整理汇总了C++中ExpGenerator::generateExpr方法的典型用法代码示例。如果您正苦于以下问题:C++ ExpGenerator::generateExpr方法的具体用法?C++ ExpGenerator::generateExpr怎么用?C++ ExpGenerator::generateExpr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpGenerator
的用法示例。
在下文中一共展示了ExpGenerator::generateExpr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: child
//.........这里部分代码省略.........
attrs,
ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
historyRecLen,
historyAtp,
historyAtpIndex,
&historyDesc,
ExpTupleDesc::SHORT_FORMAT);
NADELETEBASIC(attrs, wHeap);
#pragma nowarn(1506) // warning elimination
returnCriDesc->setTupleDescriptor(historyAtpIndex, historyDesc);
#pragma warn(1506) // warning elimination
#pragma nowarn(1506) // warning elimination
historyCriDesc->setTupleDescriptor(historyAtpIndex, historyDesc);
#pragma warn(1506) // warning elimination
// If there are any sequence function items, generate the sequence
// function expressions.
//
ex_expr * readSeqExpr = NULL;
if(NOT readSeqFunctions().isEmpty())
{
ValueIdSet seqVals = readSeqFunctions();
seqVals += sequencedColumns();
seqVals += movePartIdsExpr();
expGen->generateSequenceExpression(seqVals,
readSeqExpr);
}
ex_expr *checkPartChangeExpr = NULL;
if (!checkPartitionChangeExpr().isEmpty()) {
ItemExpr * newCheckPartitionChangeTree=
checkPartitionChangeExpr().rebuildExprTree(ITM_AND,TRUE,TRUE);
expGen->generateExpr(newCheckPartitionChangeTree->getValueId(),
ex_expr::exp_SCAN_PRED,
&checkPartChangeExpr);
}
//unsigned long rowLength;
ex_expr * returnExpr = NULL;
if(NOT returnSeqFunctions().isEmpty())
{
expGen->generateSequenceExpression(returnSeqFunctions(),
returnExpr);
}
// Generate expression to evaluate predicate on the output
//
ex_expr *postPred = 0;
if (! selectionPred().isEmpty()) {
ItemExpr * newPredTree =
selectionPred().rebuildExprTree(ITM_AND,TRUE,TRUE);
expGen->generateExpr(newPredTree->getValueId(), ex_expr::exp_SCAN_PRED,
&postPred);
}
// Reset ATP's to zero for parent.
//
localMapTable->setAllAtp(0);
// Generate expression to evaluate the cancel expression
示例2: codeGen
//.........这里部分代码省略.........
&input_tuple_desc,
ExpTupleDesc::LONG_FORMAT);
// add all columns from this SP to the map table.
ULng32 tupleLength;
exp_gen->processValIdList(getTableDesc()->getColumnList(),
ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
tupleLength,
work_atp,
work_atp_index);
// Generate expression to move the output row returned by the
// stored proc back to parent.
ULng32 outputRowlen_ = 0;
MapTable * returnedMapTable = 0;
exp_gen->generateContiguousMoveExpr(getTableDesc()->getColumnList(),
-1 /*add conv nodes*/,
0, returned_desc->noTuples() - 1,
ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
outputRowlen_,
&output_expr,
&output_tuple_desc,
ExpTupleDesc::LONG_FORMAT,
&returnedMapTable);
// Now generate expressions used to extract or move input or
// output values. See class ExSPInputOutput.
ExSPInputOutput * extractInputExpr = NULL;
ExSPInputOutput * moveOutputExpr = NULL;
generateSPIOExpr(this, generator,
extractInputExpr,
moveOutputExpr);
// done with expressions at this operator. Remove the appended map tables.
generator->removeAll(last_map_table);
// append the map table containing the returned columns
generator->appendAtEnd(returnedMapTable);
NAString procNameAsNAString(procName_);
char * sp_name =
space->allocateAndCopyToAlignedSpace(procNameAsNAString,
procNameAsNAString.length(), 0);
ExpGenerator *expGen = generator->getExpGenerator();
// expression to conditionally return 0 or more rows.
ex_expr *predExpr = NULL;
// generate tuple selection expression, if present
if(NOT selectionPred().isEmpty())
{
ItemExpr* pred = selectionPred().rebuildExprTree(ITM_AND,TRUE,TRUE);
expGen->generateExpr(pred->getValueId(),ex_expr::exp_SCAN_PRED,&predExpr);
}
ComTdbStoredProc * sp_tdb = new(space)
ComTdbStoredProc(sp_name,
input_expr,
inputRowlen_,
output_expr,
outputRowlen_,
work_cri_desc,
work_atp_index,
given_desc,
returned_desc,
extractInputExpr,
moveOutputExpr,
2,
1024,
(Cardinality) getGroupAttr()->
getOutputLogPropList()[0]->
getResultCardinality().value(),
5,
64000, //10240
predExpr,
(UInt16) arkcmpInfo_);
generator->initTdbFields(sp_tdb);
if(!generator->explainDisabled())
{
generator->setExplainTuple(
addExplainInfo(sp_tdb, 0, 0, generator));
}
// Do not infer that any transaction started can
// be in READ ONLY mode if ISPs are present.
generator->setNeedsReadWriteTransaction(TRUE);
generator->setCriDesc(given_desc, Generator::DOWN);
generator->setCriDesc(returned_desc, Generator::UP);
generator->setGenObj(this, sp_tdb);
// Some built-in functions require a TMF transaction
// because they get their information from catman
generator->setTransactionFlag(getRequiresTMFTransaction());
return 0;
}
示例3: child
short
PhysSample::codeGen(Generator *generator)
{
// Get a local handle on some of the generator objects.
//
CollHeap *wHeap = generator->wHeap();
Space *space = generator->getSpace();
MapTable *mapTable = generator->getMapTable();
ExpGenerator *expGen = generator->getExpGenerator();
// Allocate a new map table for this node. This must be done
// before generating the code for my child so that this local
// map table will be sandwiched between the map tables already
// generated and the map tables generated by my offspring.
//
// Only the items available as output from this node will
// be put in the local map table. Before exiting this function, all of
// my offsprings map tables will be removed. Thus, none of the outputs
// from nodes below this node will be visible to nodes above it except
// those placed in the local map table and those that already exist in
// my ancestors map tables. This is the standard mechanism used in the
// generator for managing the access to item expressions.
//
MapTable *localMapTable = generator->appendAtEnd();
// Since this operation doesn't modify the row on the way down the tree,
// go ahead and generate the child subtree. Capture the given composite row
// descriptor and the child's returned TDB and composite row descriptor.
//
ex_cri_desc * givenCriDesc = generator->getCriDesc(Generator::DOWN);
child(0)->codeGen(generator);
ComTdb *childTdb = (ComTdb*)generator->getGenObj();
ex_cri_desc * childCriDesc = generator->getCriDesc(Generator::UP);
ExplainTuple *childExplainTuple = generator->getExplainTuple();
// Geneate the sampling expression.
//
ex_expr *balExpr = NULL;
Int32 returnFactorOffset = 0;
ValueId val;
val = balanceExpr().init();
if(balanceExpr().next(val))
expGen->generateSamplingExpr(val, &balExpr, returnFactorOffset);
// Alias the sampleColumns() so that they reference the underlying
// expressions directly. This is done to avoid having to generate and
// execute a project expression that simply moves the columns from
// one tupp to another to reflect the application of the sampledCol
// function.
//
// ValueId valId;
// for(valId = sampledColumns().init();
// sampledColumns().next(valId);
// sampledColumns().advance(valId))
// {
// MapInfo *mapInfoChild = localMapTable->getMapInfoAsIs
// (valId.getItemExpr()->child(0)->castToItemExpr()->getValueId());
// GenAssert(mapInfoChild, "Sample::codeGen -- no child map info.");
// Attributes *attr = mapInfoChild->getAttr();
// MapInfo *mapInfo = localMapTable->addMapInfoToThis(valId, attr);
// mapInfo->codeGenerated();
// }
// check if any of the columns inthe sampled columns are lob columns. If so, return an error.
ValueId valId;
for(valId = sampledColumns().init();
sampledColumns().next(valId);
sampledColumns().advance(valId))
{
const NAType &colType = valId.getType();
if ((colType.getFSDatatype() == REC_BLOB) ||
(colType.getFSDatatype() == REC_CLOB))
{
*CmpCommon::diags() << DgSqlCode(-4322);
GenExit();
}
}
// Now, remove all attributes from the map table except the
// the stuff in the local map table -- the result of this node.
//
// localMapTable->removeAll();
// Generate the expression to evaluate predicate on the sampled row.
//
ex_expr *postPred = 0;
if (!selectionPred().isEmpty()) {
ItemExpr * newPredTree
= selectionPred().rebuildExprTree(ITM_AND,TRUE,TRUE);
expGen->generateExpr(newPredTree->getValueId(), ex_expr::exp_SCAN_PRED,
&postPred);
}
// Construct the Sample TDB.
//
ComTdbSample *sampleTdb
= new(space) ComTdbSample(NULL,
balExpr,
returnFactorOffset,
postPred,
childTdb,
//.........这里部分代码省略.........