当前位置: 首页>>代码示例>>C++>>正文


C++ SeqScanPlanNode::isEmptyScan方法代码示例

本文整理汇总了C++中SeqScanPlanNode::isEmptyScan方法的典型用法代码示例。如果您正苦于以下问题:C++ SeqScanPlanNode::isEmptyScan方法的具体用法?C++ SeqScanPlanNode::isEmptyScan怎么用?C++ SeqScanPlanNode::isEmptyScan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SeqScanPlanNode的用法示例。


在下文中一共展示了SeqScanPlanNode::isEmptyScan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: p_execute

bool SeqScanExecutor::p_execute(const NValueArray &params) {
    SeqScanPlanNode* node = dynamic_cast<SeqScanPlanNode*>(m_abstractNode);
    assert(node);
    Table* output_table = node->getOutputTable();
    assert(output_table);

    // Short-circuit an empty scan
    if (node->isEmptyScan()) {
        VOLT_DEBUG ("Empty Seq Scan :\n %s", output_table->debug().c_str());
        return true;
    }

    Table* input_table = (node->isSubQuery()) ?
            node->getChildren()[0]->getOutputTable():
            node->getTargetTable();

    assert(input_table);

    //* for debug */std::cout << "SeqScanExecutor: node id " << node->getPlanNodeId() <<
    //* for debug */    " input table " << (void*)input_table <<
    //* for debug */    " has " << input_table->activeTupleCount() << " tuples " << std::endl;
    VOLT_TRACE("Sequential Scanning table :\n %s",
               input_table->debug().c_str());
    VOLT_DEBUG("Sequential Scanning table : %s which has %d active, %d"
               " allocated",
               input_table->name().c_str(),
               (int)input_table->activeTupleCount(),
               (int)input_table->allocatedTupleCount());

    //
    // OPTIMIZATION: NESTED PROJECTION
    //
    // Since we have the input params, we need to call substitute to
    // change any nodes in our expression tree to be ready for the
    // projection operations in execute
    //
    int num_of_columns = -1;
    ProjectionPlanNode* projection_node = dynamic_cast<ProjectionPlanNode*>(node->getInlinePlanNode(PLAN_NODE_TYPE_PROJECTION));
    if (projection_node != NULL) {
        num_of_columns = static_cast<int> (projection_node->getOutputColumnExpressions().size());
    }
    //
    // OPTIMIZATION: NESTED LIMIT
    // How nice! We can also cut off our scanning with a nested limit!
    //
    LimitPlanNode* limit_node = dynamic_cast<LimitPlanNode*>(node->getInlinePlanNode(PLAN_NODE_TYPE_LIMIT));

    //
    // OPTIMIZATION:
    //
    // If there is no predicate and no Projection for this SeqScan,
    // then we have already set the node's OutputTable to just point
    // at the TargetTable. Therefore, there is nothing we more we need
    // to do here
    //
    if (node->getPredicate() != NULL || projection_node != NULL ||
        limit_node != NULL || m_aggExec != NULL)
    {
        //
        // Just walk through the table using our iterator and apply
        // the predicate to each tuple. For each tuple that satisfies
        // our expression, we'll insert them into the output table.
        //
        TableTuple tuple(input_table->schema());
        TableIterator iterator = input_table->iteratorDeletingAsWeGo();
        AbstractExpression *predicate = node->getPredicate();

        if (predicate)
        {
            VOLT_TRACE("SCAN PREDICATE :\n%s\n", predicate->debug(true).c_str());
        }

        int limit = -1;
        int offset = -1;
        if (limit_node) {
            limit_node->getLimitAndOffsetByReference(params, limit, offset);
        }

        int tuple_ctr = 0;
        int tuple_skipped = 0;
        TempTable* output_temp_table = dynamic_cast<TempTable*>(output_table);

        ProgressMonitorProxy pmp(m_engine, this);
        TableTuple temp_tuple;
        if (m_aggExec != NULL) {
            const TupleSchema * inputSchema = input_table->schema();
            if (projection_node != NULL) {
                inputSchema = projection_node->getOutputTable()->schema();
            }
            temp_tuple = m_aggExec->p_execute_init(params, &pmp,
                    inputSchema, output_temp_table);
        } else {
            temp_tuple = output_temp_table->tempTuple();
        }

        while ((limit == -1 || tuple_ctr < limit) && iterator.next(tuple))
        {
            VOLT_TRACE("INPUT TUPLE: %s, %d/%d\n",
                       tuple.debug(input_table->name()).c_str(), tuple_ctr,
                       (int)input_table->activeTupleCount());
//.........这里部分代码省略.........
开发者ID:87439247,项目名称:voltdb,代码行数:101,代码来源:seqscanexecutor.cpp


注:本文中的SeqScanPlanNode::isEmptyScan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。