本文整理汇总了C++中ExpGenerator::generateSamplingExpr方法的典型用法代码示例。如果您正苦于以下问题:C++ ExpGenerator::generateSamplingExpr方法的具体用法?C++ ExpGenerator::generateSamplingExpr怎么用?C++ ExpGenerator::generateSamplingExpr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpGenerator
的用法示例。
在下文中一共展示了ExpGenerator::generateSamplingExpr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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,
//.........这里部分代码省略.........