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


Java PlanFragment类代码示例

本文整理汇总了Java中org.voltdb.catalog.PlanFragment的典型用法代码示例。如果您正苦于以下问题:Java PlanFragment类的具体用法?Java PlanFragment怎么用?Java PlanFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlanFragment类属于org.voltdb.catalog包,在下文中一共展示了PlanFragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BatchPlan

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * Default Constructor Must call init() before this BatchPlan can be used
 */
@SuppressWarnings("unchecked")
public BatchPlan(int max_round_size) {
    int batch_size = BatchPlanner.this.batchSize;
    int num_partitions = BatchPlanner.this.catalogContext.numberOfPartitions;

    // Round Data
    this.rounds = (Collection<PlanVertex>[][]) new Collection<?>[max_round_size][];
    for (int i = 0; i < this.rounds.length; i++) {
        this.rounds[i] = (Collection<PlanVertex>[]) new Collection<?>[num_partitions];
        // These lists will only be allocated when needed
    } // FOR

    // Batch Data
    this.frag_list = (List<PlanFragment>[]) new List<?>[batch_size];
    this.stmt_partitions = new PartitionSet[batch_size];
    this.stmt_partitions_swap = new PartitionSet[batch_size];
    this.frag_partitions = (Map<PlanFragment, PartitionSet>[]) new HashMap<?, ?>[batch_size];
    this.frag_partitions_swap = (Map<PlanFragment, PartitionSet>[]) new HashMap<?, ?>[batch_size];
    this.singlepartition_bitmap = new boolean[batch_size];
    for (int i = 0; i < batch_size; i++) {
        this.stmt_partitions[i] = new PartitionSet();
        this.frag_partitions[i] = new HashMap<PlanFragment, PartitionSet>();
    } // FOR
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:BatchPlanner.java

示例2: getSortedPlanFragments

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * Return a list of the PlanFragments for the given Statement that are sorted in
 * the order that they must be executed
 * @param catalog_stmt
 * @param singlePartition
 * @return
 */
public static List<PlanFragment> getSortedPlanFragments(Statement catalog_stmt, boolean singlePartition) {
    Map<Statement, List<PlanFragment>> cache = (singlePartition ? PlanNodeUtil.CACHE_SORTED_SP_FRAGMENTS : PlanNodeUtil.CACHE_SORTED_MP_FRAGMENTS);
    List<PlanFragment> ret = cache.get(catalog_stmt);
    if (ret == null) {
        CatalogMap<PlanFragment> catalog_frags = null;
        if (singlePartition && catalog_stmt.getHas_singlesited()) {
            catalog_frags = catalog_stmt.getFragments();
        } else if (catalog_stmt.getHas_multisited()) {
            catalog_frags = catalog_stmt.getMs_fragments();
        }

        if (catalog_frags != null) {
            List<PlanFragment> fragments = (List<PlanFragment>) CollectionUtil.addAll(new ArrayList<PlanFragment>(), catalog_frags);
            sortPlanFragments(fragments);
            ret = Collections.unmodifiableList(fragments);
            cache.put(catalog_stmt, ret);
        }
    }
    return (ret);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:PlanNodeUtil.java

示例3: debugJSON

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * @param catalog_stmt
 * @return
 */
public static String debugJSON(Statement catalog_stmt) {
    String jsonString = Encoder.hexDecodeToString(catalog_stmt.getFullplan());
    String line = "\n----------------------------------------\n";
    String ret = "FULL PLAN ORIG STRING:\n" + jsonString + line;

    for (PlanFragment catalog_frgmt : catalog_stmt.getFragments()) {
        jsonString = Encoder.hexDecodeToString(catalog_frgmt.getPlannodetree());
        try {
            JSONObject jsonObject = new JSONObject(jsonString);
            ret += "FRAGMENT " + catalog_frgmt.getName() + "\n" + jsonObject.toString(2) + line;
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    } // FOR
    return (ret);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:22,代码来源:CatalogUtil.java

示例4: getTablePartitions

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * Return all of the partitions per table for the given Statement object
 * 
 * @param catalog_stmt
 * @param params
 * @param base_partition
 * @return
 * @throws Exception
 */
public Map<String, PartitionSet> getTablePartitions(final Statement catalog_stmt,
                                                    final Object params[],
                                                    final int base_partition) throws Exception {
    Map<String, PartitionSet> all_partitions = new HashMap<String, PartitionSet>();
    CatalogMap<PlanFragment> fragments = (catalog_stmt.getHas_singlesited() ? catalog_stmt.getFragments() : catalog_stmt.getMs_fragments());
    for (PlanFragment catalog_frag : fragments) {
        try {
            Map<String, PartitionSet> frag_partitions = new HashMap<String, PartitionSet>();
            this.calculatePartitionsForFragment(frag_partitions, null, catalog_frag, params, base_partition);
            for (String table_key : frag_partitions.keySet()) {
                if (!all_partitions.containsKey(table_key)) {
                    all_partitions.put(table_key, frag_partitions.get(table_key));
                } else {
                    all_partitions.get(table_key).addAll(frag_partitions.get(table_key));
                }
            } // FOR
        } catch (Throwable ex) {
            throw new Exception("Failed to calculate table partitions for " + catalog_frag.fullName(), ex);
        }
    } // FOR
    return (all_partitions);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:32,代码来源:PartitionEstimator.java

示例5: calculatePartitionsForFragment

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * @param catalog_frag
 * @param params
 * @param base_partition
 * @return
 * @throws Exception
 */
private void calculatePartitionsForFragment(final Map<String, PartitionSet> entry_partitions,
                                            final PartitionSet all_partitions,
                                            final PlanFragment catalog_frag,
                                            final Object params[],
                                            final int base_partition) throws Exception {
    if (trace.val)
        LOG.trace("Estimating partitions for PlanFragment #" + catalog_frag.fullName());
    PartitionEstimator.CacheEntry cache_entry = this.getFragmentCacheEntry(catalog_frag);
    this.calculatePartitionsForCache(cache_entry,
                                     params,
                                     base_partition,
                                     entry_partitions,
                                     all_partitions);
    if (debug.val) {
        if (entry_partitions != null)
            LOG.debug(String.format("%s Table Partitions: %s", catalog_frag.fullName(), entry_partitions));
        if (all_partitions != null)
            LOG.debug(String.format("%s All Partitions: %s", catalog_frag.fullName(), all_partitions));
    }
    return;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:29,代码来源:PartitionEstimator.java

示例6: getFragmentCacheEntry

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
private PartitionEstimator.CacheEntry getFragmentCacheEntry(PlanFragment catalog_frag) throws Exception {
    String frag_key = CatalogKey.createKey(catalog_frag);
    // Check whether we have generate the cache entries for this Statement
    // The CacheEntry object just tells us what input parameter to use for
    // hashing to figure out where we need to go for each table.
    PartitionEstimator.CacheEntry cache_entry = this.cache_fragmentEntries.get(frag_key);
    if (cache_entry == null) {
        synchronized (this) {
            cache_entry = this.cache_fragmentEntries.get(frag_key);
            if (cache_entry == null) {
                Statement catalog_stmt = (Statement) catalog_frag.getParent();
                this.generateCache(catalog_stmt);
                cache_entry = this.cache_fragmentEntries.get(frag_key);
            }
        } // SYNCHRONIZED
    }
    assert (cache_entry != null) : "Failed to retrieve CacheEntry for " + catalog_frag.fullName();
    return (cache_entry);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:PartitionEstimator.java

示例7: initPlanFragments

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
private void initPlanFragments() {
    Set<PlanFragment> allFrags = new HashSet<PlanFragment>();
    for (Procedure proc : database.getProcedures()) {
        for (Statement stmt : proc.getStatements()) {
            allFrags.clear();
            allFrags.addAll(stmt.getFragments());
            allFrags.addAll(stmt.getMs_fragments());
            for (PlanFragment frag : allFrags) {
                Collection<Table> tables = CatalogUtil.getReferencedTables(frag);
                int tableIds[] = new int[tables.size()];
                int i = 0;
                for (Table tbl : tables) {
                    tableIds[i++] = tbl.getRelativeIndex();
                } // FOR
                if (frag.getReadonly()) {
                    this.fragmentReadTables.put(Long.valueOf(frag.getId()), tableIds);
                } else {
                    this.fragmentWriteTables.put(Long.valueOf(frag.getId()), tableIds);
                }
            } // FOR (frag)
        } // FOR (stmt)
    } // FOR (proc)
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:CatalogContext.java

示例8: SQLStmt

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
public SQLStmt(Statement catalog_stmt, CatalogMap<PlanFragment> fragments) {
    this.sqlText = catalog_stmt.getSqltext();
    this.catStmt = catalog_stmt;

    this.numFragGUIDs = fragments.size();
    this.fragGUIDs = new long[this.numFragGUIDs];
    int i = 0;
    for (PlanFragment frag : fragments) {
        this.fragGUIDs[i++] = Integer.parseInt(frag.getName());
    }
    
    this.numStatementParamJavaTypes = catalog_stmt.getParameters().size();
    this.statementParamJavaTypes = new byte[this.numStatementParamJavaTypes];
    for (i = 0; i < this.numStatementParamJavaTypes; i++) {
        this.statementParamJavaTypes[i] = (byte)this.catStmt.getParameters().get(i).getJavatype();
    } // FOR
    this.computeHashCode();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:19,代码来源:SQLStmt.java

示例9: initSQLStmt

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
private final void initSQLStmt(SQLStmt stmt) {
    stmt.numFragGUIDs = stmt.catStmt.getFragments().size();
    PlanFragment fragments[] = stmt.catStmt.getFragments().values();
    stmt.fragGUIDs = new long[stmt.numFragGUIDs];
    for (int ii = 0; ii < stmt.numFragGUIDs; ii++) {
        stmt.fragGUIDs[ii] = Long.parseLong(fragments[ii].getName());
    } // FOR

    stmt.numStatementParamJavaTypes = stmt.catStmt.getParameters().size();
    stmt.statementParamJavaTypes = new byte[stmt.numStatementParamJavaTypes];
    StmtParameter parameters[] = stmt.catStmt.getParameters().values();
    for (int ii = 0; ii < stmt.numStatementParamJavaTypes; ii++) {
        stmt.statementParamJavaTypes[ii] = (byte)parameters[ii].getJavatype();
    } // FOR
    stmt.computeHashCode();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:VoltProcedure.java

示例10: init

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
private void init(Class<? extends VoltProcedure> volt_proc, String stmt_name, Object raw_args[]) {
    this.catalog_proc = this.getProcedure(volt_proc);
    assertNotNull(this.catalog_proc);
    this.catalog_stmt = this.catalog_proc.getStatements().get(stmt_name);
    assertNotNull(this.catalog_stmt);
    
    CatalogMap<PlanFragment> fragments = null;
    if (this.catalog_stmt.getQuerytype() == QueryType.INSERT.getValue()) {
        fragments = this.catalog_stmt.getFragments();
    } else {
        assert(this.catalog_stmt.getHas_multisited());
        fragments = this.catalog_stmt.getMs_fragments();
    }

    // Create a SQLStmt batch
    this.batch = new SQLStmt[] { new SQLStmt(this.catalog_stmt, fragments) };
    this.args = new ParameterSet[] { VoltProcedure.getCleanParams(this.batch[0], raw_args) };
    this.stmtCounters = new int[]{ 0 };
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:TestBatchPlanner.java

示例11: testGetPartitionsPlanFragment

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * testGetPartitionsPlanFragment
 */
public void testGetPartitionsPlanFragment() throws Exception {
    Procedure catalog_proc = this.getProcedure(GetNewDestination.class);
    Statement catalog_stmt = catalog_proc.getStatements().get("GetData");
    assertNotNull(catalog_stmt);
    
    // System.out.println("Num Partitions: " + CatalogUtil.getNumberOfPartitions(catalog_db));
    Object params[] = new Object[] {
        new Long(54),   // S_ID
        new Long(3),    // SF_TYPE
        new Long(0),    // START_TIME
        new Long(22),   // END_TIME
    };
    
    // We should see one PlanFragment with no partitions and then all others need something
    boolean internal_flag = false;
    for (PlanFragment catalog_frag : catalog_stmt.getMs_fragments()) {
        partitions.clear();
        p_estimator.getPartitions(partitions, catalog_frag, params, base_partition);
        if (partitions.isEmpty()) {
            assertFalse(internal_flag);
            internal_flag = true;
        }
    } // FOR
    assertTrue(internal_flag);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:29,代码来源:TestPartitionEstimatorMultiSite.java

示例12: FragIdAndText

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
@SuppressWarnings("deprecation")
FragIdAndText(String stmtName) {
    Statement stmt = m_testProc.getStatements().getIgnoreCase(stmtName);
    PlanFragment frag = null;
    for (PlanFragment f : stmt.getFragments()) {
        frag = f;
    }

    fragId = CatalogUtil.getUniqueIdForFragment(frag);
    sqlText = stmt.getSqltext();

    ActivePlanRepository.addFragmentForTest(
            fragId,
            Encoder.decodeBase64AndDecompressToBytes(frag.getPlannodetree()),
            sqlText);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:TestFragmentProgressUpdate.java

示例13: PlanVertex

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
public PlanVertex(PlanFragment catalog_frag, int stmt_index, int round, int input_dependency_id,
                  int output_dependency_id, boolean is_local) {
    // super(catalog_frag);
    this.catalog_frag = catalog_frag;
    this.frag_id = catalog_frag.getId();
    this.stmt_index = stmt_index;
    this.round = round;
    this.input_dependency_id = input_dependency_id;
    this.output_dependency_id = output_dependency_id;
    this.read_only = catalog_frag.getReadonly();

    this.hash_code = this.frag_id | this.round << 20 | this.stmt_index << 26;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:14,代码来源:BatchPlanner.java

示例14: clear

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * Clear out internal cache
 * 
 * @param num_partitions
 *            The total number of partitions in the cluster
 */
@SuppressWarnings("unchecked")
public static synchronized void clear(int num_partitions) {
    CACHED_FRAGMENT_PARTITION_MAPS = (Map<Statement, Map<PlanFragment, PartitionSet>>[]) new Map<?, ?>[num_partitions];
    for (int i = 0; i < num_partitions; i++) {
        CACHED_FRAGMENT_PARTITION_MAPS[i] = new HashMap<Statement, Map<PlanFragment, PartitionSet>>();
    } // FOR
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:14,代码来源:BatchPlanner.java

示例15: containsPlanNode

import org.voltdb.catalog.PlanFragment; //导入依赖的package包/类
/**
 * Returns true if the given AbstractPlaNode exists in plan tree for the given PlanFragment
 * This includes inline nodes
 * @param catalog_frag
 * @param node
 * @return
 */
public static boolean containsPlanNode(final PlanFragment catalog_frag, final AbstractPlanNode node) {
    final AbstractPlanNode root = getPlanNodeTreeForPlanFragment(catalog_frag);
    final boolean found[] = { false };
    new PlanNodeTreeWalker(true) {
        @Override
        protected void callback(AbstractPlanNode element) {
            if (element.equals(node)) {
                found[0] = true;
                this.stop();
            }
        }
    }.traverse(root);
    return (found[0]);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:22,代码来源:PlanNodeUtil.java


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