示例#1
0
string AbstractPlanNode::debug(const string& spacer) const
{
    ostringstream buffer;
    buffer << spacer << "* " << debug() << "\n";
    string info_spacer = spacer + "  |";
    buffer << debugInfo(info_spacer);
    //
    // Inline PlanNodes
    //
    if (!m_inlineNodes.empty()) {
        buffer << info_spacer << "Inline Plannodes: "
               << m_inlineNodes.size() << "\n";
        string internal_spacer = info_spacer + "  ";
        map<PlanNodeType, AbstractPlanNode*>::const_iterator it;
        for (it = m_inlineNodes.begin(); it != m_inlineNodes.end(); it++) {
            buffer << info_spacer << "Inline "
                   << planNodeToString(it->second->getPlanNodeType())
                   << ":\n";
            buffer << it->second->debugInfo(internal_spacer);
        }
    }
    //
    // Traverse the tree
    //
    string child_spacer = spacer + "  ";
    for (int ctr = 0, cnt = static_cast<int>(m_children.size()); ctr < cnt; ctr++) {
        buffer << child_spacer << m_children[ctr]->getPlanNodeType() << "\n";
        buffer << m_children[ctr]->debug(child_spacer);
    }
    return (buffer.str());
}
示例#2
0
// ------------------------------------------------------------------
// UTILITY METHODS
// ------------------------------------------------------------------
string AbstractPlanNode::debug() const
{
    ostringstream buffer;
    buffer << planNodeToString(getPlanNodeType())
           << "[" << getPlanNodeId() << "]";
    return buffer.str();
}
示例#3
0
string AbstractPlanNode::debug(const string& spacer) const
{
    std::ostringstream buffer;
    buffer << spacer << "* " << debug() << "\n";
    std::string info_spacer = spacer + "  |";
    buffer << debugInfo(info_spacer);
    //
    // Inline PlanNodes
    //
    if (!m_inlineNodes.empty()) {
        buffer << info_spacer << "Inline Plannodes: "
               << m_inlineNodes.size() << "\n";
        string internal_spacer = info_spacer + "  ";
        map<PlanNodeType, AbstractPlanNode*>::const_iterator it;
        for (it = m_inlineNodes.begin(); it != m_inlineNodes.end(); it++) {
            buffer << info_spacer << "Inline "
                   << planNodeToString(it->second->getPlanNodeType())
                   << ":\n";
            buffer << it->second->debugInfo(internal_spacer);
        }
    }
    //
    // Output table
    //
    Table* outputTable = getOutputTable();
    buffer << info_spacer << "Output table:\n";
    if (outputTable != NULL) {
        buffer << outputTable->debug(spacer + "  ");
    }
    else {
        buffer << "  " << info_spacer << "<NULL>\n";
    }
    //
    // Input tables
    //
    for (int i = 0; i < getInputTableCount(); ++i) {
        Table* inputTable = getInputTable(i);
        buffer << info_spacer << "Input table " << i << ":\n";
        if (inputTable != NULL) {
            buffer << inputTable->debug(spacer + "  ");
        }
        else {
            buffer << "  " << info_spacer << "<NULL>\n";
        }
    }
    //
    // Traverse the tree
    //
    string child_spacer = spacer + "  ";
    for (int ctr = 0, cnt = static_cast<int>(m_children.size()); ctr < cnt; ctr++) {
        buffer << child_spacer << m_children[ctr]->getPlanNodeType() << "\n";
        buffer << m_children[ctr]->debug(child_spacer);
    }
    return (buffer.str());
}
示例#4
0
AbstractPlanNode* AbstractPlanNode::getInlinePlanNode(PlanNodeType type) const
{
    map<PlanNodeType, AbstractPlanNode*>::const_iterator lookup =
        m_inlineNodes.find(type);
    AbstractPlanNode* ret = NULL;
    if (lookup != m_inlineNodes.end()) {
        ret = lookup->second;
    }
    else {
        VOLT_TRACE("No internal PlanNode with type '%s' is available for '%s'",
                   planNodeToString(type).c_str(),
                   debug().c_str());
    }
    return ret;
}
示例#5
0
std::string debug(const voltdb::AbstractPlanNode* node, std::string spacer) {
    assert(node);
    std::ostringstream buffer;
    //VOLT_ERROR("%s", node->getId().debug().c_str());
    buffer <<  spacer << "->" << planNodeToString(node->getPlanNodeType());
    buffer << "[" << node->getPlanNodeId() << "]:\n";
    //VOLT_ERROR("%s", buffer.str().c_str());

    spacer += "  ";
    if (!node->getChildren().empty()) {
        std::vector<voltdb::AbstractPlanNode*>::const_iterator child;
        for (child = node->getChildren().begin(); child != node->getChildren().end(); ++child) {
            buffer << plannodeutil::debug((*child), spacer);
        }
    }
    return (buffer.str());
}
示例#6
0
voltdb::AbstractPlanNode* getEmptyPlanNode(voltdb::PlanNodeType type) {
    VOLT_TRACE("Creating an empty PlanNode of type '%s'", planNodeToString(type).c_str());
    voltdb::AbstractPlanNode* ret = NULL;
    switch (type) {
        case (voltdb::PLAN_NODE_TYPE_INVALID): {
            throwFatalException("INVALID plan node type");
        }
            break;
        // ------------------------------------------------------------------
        // SeqScan
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_SEQSCAN):
            ret = new voltdb::SeqScanPlanNode();
            break;
        // ------------------------------------------------------------------
        // IndexScan
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_INDEXSCAN):
            ret = new voltdb::IndexScanPlanNode();
            break;
        // ------------------------------------------------------------------
        // IndexCount
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_INDEXCOUNT):
            ret = new voltdb::IndexCountPlanNode();
            break;
        // ------------------------------------------------------------------
        // TableCount
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_TABLECOUNT):
            ret = new voltdb::TableCountPlanNode();
            break;
        // ------------------------------------------------------------------
        // MaterializedScanPlanNode
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_MATERIALIZEDSCAN):
            ret = new voltdb::MaterializedScanPlanNode();
            break;
        // ------------------------------------------------------------------
        // TupleScanPlanNode
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_TUPLESCAN):
            ret = new voltdb::TupleScanPlanNode();
            break;
        // ------------------------------------------------------------------
        // NestLoop
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_NESTLOOP):
            ret = new voltdb::NestLoopPlanNode();
            break;
        // ------------------------------------------------------------------
        // NestLoopIndex
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_NESTLOOPINDEX):
            ret = new voltdb::NestLoopIndexPlanNode();
            break;
        // ------------------------------------------------------------------
        // Update
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_UPDATE):
            ret = new voltdb::UpdatePlanNode();
            break;
        // ------------------------------------------------------------------
        // Insert
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_INSERT):
            ret = new voltdb::InsertPlanNode();
            break;
        // ------------------------------------------------------------------
        // Delete
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_DELETE):
            ret = new voltdb::DeletePlanNode();
            break;
        // ------------------------------------------------------------------
        // Aggregate
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_HASHAGGREGATE):
        case (voltdb::PLAN_NODE_TYPE_AGGREGATE):
        case (voltdb::PLAN_NODE_TYPE_PARTIALAGGREGATE):
            ret = new voltdb::AggregatePlanNode(type);
            break;
        // ------------------------------------------------------------------
        // Union
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_UNION):
            ret = new voltdb::UnionPlanNode();
            break;
        // ------------------------------------------------------------------
        // OrderBy
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_ORDERBY):
            ret = new voltdb::OrderByPlanNode();
            break;
        // ------------------------------------------------------------------
        // Projection
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_PROJECTION):
            ret = new voltdb::ProjectionPlanNode();
            break;
        // ------------------------------------------------------------------
        // Materialize
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_MATERIALIZE):
            ret = new voltdb::MaterializePlanNode();
            break;
        // ------------------------------------------------------------------
        // Send
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_SEND):
            ret = new voltdb::SendPlanNode();
            break;
        // ------------------------------------------------------------------
        // Limit
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_LIMIT):
            ret = new voltdb::LimitPlanNode();
            break;
        // ------------------------------------------------------------------
        // Receive
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_RECEIVE):
            ret = new voltdb::ReceivePlanNode();
            break;
        // ------------------------------------------------------------------
        // Merge Receive
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_MERGERECEIVE):
            ret = new voltdb::MergeReceivePlanNode();
            break;
        // ------------------------------------------------------------------
        // PartitionBy
        // ------------------------------------------------------------------
        case (voltdb::PLAN_NODE_TYPE_PARTITIONBY):
            ret = new voltdb::PartitionByPlanNode();
            break;
        // default: Don't provide a default, let the compiler enforce complete coverage.
    }

    // ------------------------------------------------------------------
    // UNKNOWN
    // ------------------------------------------------------------------
    if (!ret) {
        throwFatalException("Undefined plan node type '%d'", (int)type);
    }
    //VOLT_TRACE("created plannode : %s ", typeid(*ret).name());
    return (ret);
}