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


Java VoltTableUtil.getRandomRow方法代码示例

本文整理汇总了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));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:16,代码来源:TestAntiCacheManagerTPCC.java

示例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);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:12,代码来源:TestAntiCachePerformance.java

示例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
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:30,代码来源:TestHStoreSite.java

示例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));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:58,代码来源:TestDependencyTrackerPrefetch.java

示例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());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:64,代码来源:TestPartitionExecutorSpecExec.java

示例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);
    }        
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:45,代码来源:TestSQLFeaturesSuite.java


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