本文整理汇总了Java中org.voltdb.utils.VoltTableUtil.getRandomRow方法的典型用法代码示例。如果您正苦于以下问题:Java VoltTableUtil.getRandomRow方法的具体用法?Java VoltTableUtil.getRandomRow怎么用?Java VoltTableUtil.getRandomRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.utils.VoltTableUtil
的用法示例。
在下文中一共展示了VoltTableUtil.getRandomRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadData
import org.voltdb.utils.VoltTableUtil; //导入方法依赖的package包/类
private void loadData() throws Exception {
// Load in a bunch of dummy data for this table
VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
assertNotNull(vt);
for (int i = 0; i < NUM_TUPLES; i++) {
Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
row[0] = i;
vt.addRow(row);
} // FOR
this.executor.loadTable(1000l, catalog_tbl, vt, false);
VoltTable stats[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
assertEquals(1, stats.length);
System.err.println(VoltTableUtil.format(stats));
}
示例2: loadData
import org.voltdb.utils.VoltTableUtil; //导入方法依赖的package包/类
private void loadData(int tuples) throws Exception {
// Load in a bunch of dummy data for this table
VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
assertNotNull(vt);
for (int i = 0; i < tuples; i++) {
Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
row[0] = i;
vt.addRow(row);
} // FOR
this.executor.loadTable(1000l, catalog_tbl, vt, false);
}
示例3: loadData
import org.voltdb.utils.VoltTableUtil; //导入方法依赖的package包/类
private void loadData(Table catalog_tbl) throws Exception {
// Load some data directly into the EEs without going through transactions
VoltTable vts[] = {
CatalogUtil.getVoltTable(catalog_tbl),
CatalogUtil.getVoltTable(catalog_tbl)
};
assertEquals(NUM_PARTITIONS, vts.length);
AbstractHasher hasher = p_estimator.getHasher();
Column sub_nbr = catalog_tbl.getColumns().getIgnoreCase("SUB_NBR");
Column sf_type = catalog_tbl.getColumns().getIgnoreCase("SF_TYPE");
Column start_time = catalog_tbl.getColumns().getIgnoreCase("START_TIME");
for (int i = 0; i < NUM_TUPLES; i++) {
Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
row[0] = Integer.valueOf(i);
// Column Fixes
if (sub_nbr != null) row[sub_nbr.getIndex()] = row[0].toString();
if (sf_type != null) row[sf_type.getIndex()] = 1l;
if (start_time != null) row[start_time.getIndex()] = 1l;
vts[hasher.hash(row[0])].addRow(row);
} // FOR
for (int i = 0; i < vts.length; i++) {
PartitionExecutor executor = hstore_site.getPartitionExecutor(i);
executor.loadTable((long)i, catalog_tbl, vts[i], false);
// System.err.println(catalog_tbl + " - " + i + "\n" + VoltTableUtil.format(vts[i]) + "\n");
} // FOR
}
示例4: setUp
import org.voltdb.utils.VoltTableUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp(ProjectType.TPCC);
this.addPartitions(NUM_PARTITIONS);
this.executor = new MockPartitionExecutor(0, catalogContext, p_estimator);
assertNotNull(this.executor);
this.catalog_proc = this.getProcedure(TARGET_PROCEDURE);
this.catalog_proc.setPrefetchable(true);
this.catalog_stmt = this.getStatement(catalog_proc, TARGET_STATEMENT);
this.catalog_stmt.setPrefetchable(true);
Collection<Column> outputCols = PlanNodeUtil.getOutputColumnsForStatement(this.catalog_stmt);
this.prefetchResult = CatalogUtil.getVoltTable(outputCols);
Object row[] = VoltTableUtil.getRandomRow(this.prefetchResult);
row[0] = new Long(999999);
this.prefetchResult.addRow(row);
for (int i = 0; i < this.prefetchParamsHash.length; i++) {
this.prefetchBatch[i] = new SQLStmt(this.catalog_stmt);
this.prefetchParamsHash[i] = this.prefetchParams[i].hashCode();
this.prefetchStmtCounters[i] = PREFETCH_STMT_COUNTER;
} // FOR
Partition catalog_part = catalogContext.getPartitionById(BASE_PARTITION);
assertNotNull(catalog_part);
this.hstore_site = HStore.initialize(catalogContext, ((Site)catalog_part.getParent()).getId(), HStoreConf.singleton());
this.hstore_site.addPartitionExecutor(BASE_PARTITION, executor);
this.depTracker = hstore_site.getDependencyTracker(BASE_PARTITION);
this.depTrackerDbg = this.depTracker.getDebugContext();
// Create a BatchPlan for our batch
BatchPlanner planner = new BatchPlanner(this.prefetchBatch, this.catalog_proc, p_estimator);
planner.setPrefetchFlag(true);
this.plan = planner.plan(TXN_ID,
BASE_PARTITION,
catalogContext.getAllPartitionIds(),
this.touchedPartitions,
this.prefetchParams);
List<WorkFragment.Builder> ftasks = new ArrayList<WorkFragment.Builder>();
this.plan.getWorkFragmentsBuilders(TXN_ID, this.prefetchStmtCounters, ftasks);
this.prefetchFragment = CollectionUtil.first(ftasks);
assert(this.prefetchFragment.getFragmentIdCount() > 0);
assertEquals(this.prefetchFragment.getFragmentIdCount(), this.prefetchFragment.getStmtCounterCount());
assertTrue(this.prefetchFragment.getPrefetch());
assertEquals(REMOTE_PARTITION, this.prefetchFragment.getPartitionId());
this.ts = new LocalTransaction(hstore_site);
this.ts.testInit(TXN_ID,
BASE_PARTITION,
null,
catalogContext.getAllPartitionIds(),
this.catalog_proc);
this.ts.initializePrefetch();
this.depTracker.addTransaction(ts);
assertNull(this.ts.getCurrentRoundState(BASE_PARTITION));
}
示例5: setUp
import org.voltdb.utils.VoltTableUtil; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp(this.builder);
initializeCatalog(1, 1, NUM_PARTITIONS);
for (TransactionCounter tc : TransactionCounter.values()) {
tc.clear();
} // FOR
Site catalog_site = CollectionUtil.first(catalogContext.sites);
this.hstore_conf = HStoreConf.singleton();
this.hstore_conf.site.specexec_enable = true;
this.hstore_conf.site.txn_client_debug = true;
this.hstore_conf.site.txn_counters = true;
this.hstore_conf.site.exec_voltdb_procinfo = true;
this.hstore_conf.site.pool_profiling = true;
this.hstore_site = this.createHStoreSite(catalog_site, hstore_conf);
this.client = createClient();
assertFalse(this.lockBefore.hasQueuedThreads());
assertFalse(this.notifyBefore.hasQueuedThreads());
assertFalse(this.lockAfter.hasQueuedThreads());
this.baseExecutor = this.hstore_site.getPartitionExecutor(BASE_PARTITION);
assertNotNull(this.baseExecutor);
this.remoteExecutor = this.hstore_site.getPartitionExecutor(BASE_PARTITION+1);
assertNotNull(this.remoteExecutor);
assertNotSame(this.baseExecutor.getPartitionId(), this.remoteExecutor.getPartitionId());
this.executors = new PartitionExecutor[]{ this.baseExecutor, this.remoteExecutor };
this.dtxnProc = this.getProcedure(DtxnTester.class);
this.spProc = this.getProcedure(GetSubscriberData.class);
// Make sure that we replace the conflict checker on the remote partition
// so that it can schedule our speculative txns
PartitionExecutor.Debug remoteDebug = this.remoteExecutor.getDebugContext();
remoteDebug.getSpecExecScheduler().getDebugContext().setConflictChecker(this.checker);
// Make sure that we always set to false to ensure that the dtxn won't abort
// unless the test case really wants it to
DtxnTester.SHOULD_ABORT.set(false);
this.lockBefore.drainPermits();
this.lockAfter.drainPermits();
this.notifyBefore.drainPermits();
this.notifyAfter.drainPermits();
// We want to always insert one SUBSCRIBER record per partition so
// that we can play with them. Set VLR_LOCATION to zero so that
// can check whether it has been modified
Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
Column catalog_col = this.getColumn(catalog_tbl, "VLR_LOCATION");
VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
for (int i = 0; i < NUM_PARTITIONS; i++) {
Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
row[0] = new Long(i);
row[catalog_col.getIndex()] = 0l;
vt.addRow(row);
} // FOR
String procName = VoltSystemProcedure.procCallName(LoadMultipartitionTable.class);
ClientResponse cr = this.client.callProcedure(procName, catalog_tbl.getName(), vt);
assertEquals(cr.toString(), Status.OK, cr.getStatus());
}
示例6: testQueryOrder
import org.voltdb.utils.VoltTableUtil; //导入方法依赖的package包/类
/**
* testQueryOrder
*/
public void testQueryOrder() throws Exception {
System.err.println("CURRENT: " + ClassUtil.getCurrentMethodName());
// This checks that we get the execution order of queries correct.
// In a single query batch we will first execute an update on a replicated
// table and then execute a second query that will read from that table. The
// second query should get the new value from the first query and not the
// original value.
Client client = this.getClient();
CatalogContext catalogContext = this.getCatalogContext();
Table catalog_tbl = catalogContext.getTableByName(TPCCConstants.TABLENAME_ITEM);
assertTrue(catalog_tbl.getIsreplicated());
int expectedNumItems = 10;
VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
for (int i = 0; i < expectedNumItems; i++) {
Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
row[0] = i;
vt.addRow(row);
} // FOR
RegressionSuiteUtil.load(client, catalog_tbl, vt);
long numItems = RegressionSuiteUtil.getRowCount(client, catalog_tbl);
assertEquals(expectedNumItems, numItems);
String procName = UpdateItemName.class.getSimpleName();
long itemId = this.getRandom().number(TPCCConstants.STARTING_ITEM, numItems);
String itemName = "Tone Loc";
ClientResponse cr = client.callProcedure(procName, itemId, itemName);
assertEquals(cr.toString(), Status.OK, cr.getStatus());
assertEquals(cr.toString(), 1, cr.getResults().length);
try {
if(cr.getResults()[0].getRowCount() != 0){
assertTrue(cr.toString(), cr.getResults()[0].advanceRow());
assertEquals(itemName, cr.getResults()[0].getString(0));
}
} catch (Throwable ex) {
System.err.printf("TARGET: %d/%s\n", itemId, itemName);
cr = RegressionSuiteUtil.sql(client, "SELECT * FROM " + TPCCConstants.TABLENAME_ITEM);
System.err.println(VoltTableUtil.format(cr.getResults()));
throw new Exception(ex);
}
}