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


C++ TableIndex::getSize方法代码示例

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


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

示例1: p_execute


//.........这里部分代码省略.........
    //
    // POST EXPRESSION
    //
    assert (m_node->getPredicate() == NULL);

    //
    // COUNT NULL EXPRESSION
    //
    AbstractExpression* countNULLExpr = m_node->getSkipNullPredicate();
    // For reverse scan edge case NULL values and forward scan underflow case.
    if (countNULLExpr != NULL) {
        VOLT_DEBUG("COUNT NULL Expression:\n%s", countNULLExpr->debug(true).c_str());
    }

    bool reverseScanNullEdgeCase = false;
    bool reverseScanMovedIndexToScan = false;
    if (m_numOfSearchkeys < m_numOfEndkeys &&
            (m_endType == INDEX_LOOKUP_TYPE_LT || m_endType == INDEX_LOOKUP_TYPE_LTE)) {
        reverseScanNullEdgeCase = true;
        VOLT_DEBUG("Index count: reverse scan edge null case." );
    }


    // An index count has two cases: unique and non-unique
    int64_t rkStart = 0, rkEnd = 0, rkRes = 0;
    int leftIncluded = 0, rightIncluded = 0;

    if (m_numOfSearchkeys != 0) {
        // Deal with multi-map
        VOLT_DEBUG("INDEX_LOOKUP_TYPE(%d) m_numSearchkeys(%d) key:%s",
                   localLookupType, activeNumOfSearchKeys, searchKey.debugNoHeader().c_str());
        if (searchKeyUnderflow == false) {
            if (localLookupType == INDEX_LOOKUP_TYPE_GT) {
                rkStart = tableIndex->getCounterLET(&searchKey, true);
            } else {
                // handle start inclusive cases.
                if (tableIndex->hasKey(&searchKey)) {
                    leftIncluded = 1;
                    rkStart = tableIndex->getCounterLET(&searchKey, false);

                    if (reverseScanNullEdgeCase) {
                        tableIndex->moveToKeyOrGreater(&searchKey);
                        reverseScanMovedIndexToScan = true;
                    }
                } else {
                    rkStart = tableIndex->getCounterLET(&searchKey, true);
                }
            }
        } else {
            // Do not count null row or columns
            tableIndex->moveToKeyOrGreater(&searchKey);
            assert(countNULLExpr);
            long numNULLs = countNulls(tableIndex, countNULLExpr);
            rkStart += numNULLs;
            VOLT_DEBUG("Index count[underflow case]: "
                    "find out %ld null rows or columns are not counted in.", numNULLs);

        }
    }
    if (reverseScanNullEdgeCase) {
        // reverse scan case
        if (!reverseScanMovedIndexToScan && localLookupType != INDEX_LOOKUP_TYPE_GT) {
            tableIndex->moveToEnd(true);
        }
        assert(countNULLExpr);
        long numNULLs = countNulls(tableIndex, countNULLExpr);
        rkStart += numNULLs;
        VOLT_DEBUG("Index count[reverse case]: "
                "find out %ld null rows or columns are not counted in.", numNULLs);
    }

    if (m_numOfEndkeys != 0) {
        if (endKeyOverflow) {
            rkEnd = tableIndex->getCounterGET(&endKey, true);
        } else {
            IndexLookupType localEndType = m_endType;
            if (localEndType == INDEX_LOOKUP_TYPE_LT) {
                rkEnd = tableIndex->getCounterGET(&endKey, false);
            } else {
                if (tableIndex->hasKey(&endKey)) {
                    rightIncluded = 1;
                    rkEnd = tableIndex->getCounterGET(&endKey, true);
                } else {
                    rkEnd = tableIndex->getCounterGET(&endKey, false);
                }
            }
        }
    } else {
        rkEnd = tableIndex->getSize();
        rightIncluded = 1;
    }
    rkRes = rkEnd - rkStart - 1 + leftIncluded + rightIncluded;
    VOLT_DEBUG("Index Count ANSWER %ld = %ld - %ld - 1 + %d + %d\n",
            (long)rkRes, (long)rkEnd, (long)rkStart, leftIncluded, rightIncluded);
    tmptup.setNValue(0, ValueFactory::getBigIntValue( rkRes ));
    m_outputTable->insertTuple(tmptup);

    VOLT_DEBUG ("Index Count :\n %s", m_outputTable->debug().c_str());
    return true;
}
开发者ID:AsherBond,项目名称:voltdb,代码行数:101,代码来源:indexcountexecutor.cpp


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