本文整理汇总了Java中org.voltdb.catalog.PlanFragment.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java PlanFragment.getParent方法的具体用法?Java PlanFragment.getParent怎么用?Java PlanFragment.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.catalog.PlanFragment
的用法示例。
在下文中一共展示了PlanFragment.getParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractFragmentPredicates
import org.voltdb.catalog.PlanFragment; //导入方法依赖的package包/类
/**
* @param stats_catalog_db
* @param last_cset
* @param root_exp
* @param catalog_tables
*/
public static PredicatePairs extractFragmentPredicates(final PlanFragment catalog_frag,
final boolean convert_params,
final Collection<Table> catalog_tables) throws Exception {
final Statement catalog_stmt = (Statement) catalog_frag.getParent();
final Database catalog_db = CatalogUtil.getDatabase(catalog_stmt);
// if (catalog_frag.guid == 279) LOG.setLevel(Level.DEBUG);
// We need to be clever about what we're doing here
// We always have to examine the fragment (rather than just the entire
// Statement), because
// we don't know whehter they want the multi-sited version or not
final Collection<String> table_keys = CatalogKey.createKeys(catalog_tables);
if (debug.val)
LOG.debug("Extracting column set for fragment #" + catalog_frag.getName() + ": " + catalog_tables);
final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_stmt);
Pair<String, Collection<String>> key = Pair.of(CatalogKey.createKey(catalog_frag), table_keys);
PredicatePairs cset = cache.EXTRACTED_PREDICATES.get(key);
if (cset == null) {
AbstractPlanNode root_node = PlanNodeUtil.getPlanNodeTreeForPlanFragment(catalog_frag);
// LOG.debug("PlanFragment Node:\n" +
// PlanNodeUtil.debug(root_node));
cset = new PredicatePairs();
CatalogUtil.extractPlanNodePredicates(catalog_stmt, catalog_db, cset, root_node, convert_params, catalog_tables);
cache.EXTRACTED_PREDICATES.put(key, cset);
}
return (cset);
}
示例2: getUniqueIdForFragment
import org.voltdb.catalog.PlanFragment; //导入方法依赖的package包/类
/**
* Get a unique id for a plan fragment by munging the indices of it's parents
* and grandparents in the catalog.
*
* @param frag Catalog fragment to identify
* @return unique id for fragment
*/
public static long getUniqueIdForFragment(PlanFragment frag) {
long retval = 0;
CatalogType parent = frag.getParent();
retval = ((long) parent.getParent().getRelativeIndex()) << 32;
retval += ((long) parent.getRelativeIndex()) << 16;
retval += frag.getRelativeIndex();
return retval;
}
示例3: testBuildWorkFragments
import org.voltdb.catalog.PlanFragment; //导入方法依赖的package包/类
/**
* testBuildWorkFragments
*/
public void testBuildWorkFragments() throws Exception {
List<WorkFragment.Builder> builders = new ArrayList<WorkFragment.Builder>();
BatchPlan plan = this.getPlan();
plan.getWorkFragmentsBuilders(TXN_ID, this.stmtCounters, builders);
assertFalse(builders.isEmpty());
for (WorkFragment.Builder builder : builders) {
assertNotNull(builder);
// System.err.println(pf);
// If this WorkFragment is not for the base partition, then
// we should make sure that it only has distributed queries...
if (builder.getPartitionId() != BASE_PARTITION) {
for (int frag_id : builder.getFragmentIdList()) {
PlanFragment catalog_frag = CatalogUtil.getPlanFragment(catalogContext.catalog, frag_id);
assertNotNull(catalog_frag);
Statement catalog_stmt = catalog_frag.getParent();
assertNotNull(catalog_stmt);
assert(catalog_stmt.getMs_fragments().contains(catalog_frag));
} // FOR
}
// The InputDepId for all WorkFragments should always be the same
Set<Integer> all_ids = new HashSet<Integer>(builder.getInputDepIdList());
assertEquals(builder.toString(), 1, all_ids.size());
// System.err.println(StringUtil.SINGLE_LINE);
} // FOR
}
示例4: testFragmentOrder
import org.voltdb.catalog.PlanFragment; //导入方法依赖的package包/类
/**
* testFragmentOrder
*/
public void testFragmentOrder() throws Exception {
Procedure catalog_proc = this.getProcedure(BatchPlannerConflictProc.class);
// Create a big batch and make sure that the fragments are in the correct order
Statement stmts[] = new Statement[]{
catalog_proc.getStatements().getIgnoreCase("ReplicatedInsert"),
catalog_proc.getStatements().getIgnoreCase("ReplicatedSelect")
};
SQLStmt batch[] = new SQLStmt[stmts.length];
ParameterSet params[] = new ParameterSet[stmts.length];
int stmtCounters[] = new int[stmts.length];
for (int i = 0; i < stmts.length; i++) {
batch[i] = new SQLStmt(stmts[i]);
params[i] = new ParameterSet(this.randomStatementParameters(stmts[i]));
stmtCounters[i] = i;
} // FOR
BatchPlanner planner = new BatchPlanner(batch, catalog_proc, p_estimator);
this.touched_partitions.clear();
BatchPlan plan = planner.plan(TXN_ID,
BASE_PARTITION,
catalogContext.getAllPartitionIds(),
this.touched_partitions,
params);
assertNotNull(plan);
assertFalse(plan.hasMisprediction());
List<WorkFragment.Builder> builders = new ArrayList<WorkFragment.Builder>();
plan.getWorkFragmentsBuilders(TXN_ID, stmtCounters, builders);
assertFalse(builders.isEmpty());
List<Statement> batchStmtOrder = new ArrayList<Statement>();
boolean first = true;
Statement last = null;
for (WorkFragment.Builder builder : builders) {
assertNotNull(builder);
for (int frag_id : builder.getFragmentIdList()) {
PlanFragment catalog_frag = CatalogUtil.getPlanFragment(catalog_proc, frag_id);
assertNotNull(catalog_frag);
Statement current = catalog_frag.getParent();
if (last == null || last.equals(current) == false) {
batchStmtOrder.add(current);
}
last = current;
// Make sure that the select doesn't appear before we execute the inserts
if (first) assertNotSame(stmts[1], current);
first = false;
} // FOR
} // FOR
}