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


Java VoltTable.resetRowPosition方法代码示例

本文整理汇总了Java中org.voltdb.VoltTable.resetRowPosition方法的典型用法代码示例。如果您正苦于以下问题:Java VoltTable.resetRowPosition方法的具体用法?Java VoltTable.resetRowPosition怎么用?Java VoltTable.resetRowPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.VoltTable的用法示例。


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

示例1: storeData

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Store Data from MapOutput table into reduceInput table
 * ReduceInput table is the result of all incoming mapOutput table from other partitions
 * @see edu.brown.hstore.txns.AbstractTransaction#storeData(int, org.voltdb.VoltTable)
 */
@Override
public synchronized Status storeData(int partition, VoltTable vt) {
    VoltTable input = this.getReduceInputByPartition(partition);
    
    assert(input != null);
    if (debug.val)
        LOG.debug(String.format("StoreData into Partition #%d: RowCount=%d ",
                partition, vt.getRowCount()));
    
    if (debug.val)
        LOG.debug(String.format("<StoreData, change to ReduceInputTable> to Partition:%d>\n %s",partition,vt));
    while (vt.advanceRow()) {
        VoltTableRow row = vt.fetchRow(vt.getActiveRowIndex());
        assert(row != null);
        input.add(row);
    }
    vt.resetRowPosition();
    
    return Status.OK;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:26,代码来源:MapReduceTransaction.java

示例2: createVerticalPartitionPlan

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private SynthesizedPlanFragment[] createVerticalPartitionPlan(LocalTransaction ts, MaterializedViewInfo catalog_view, VoltTable table) {
    Table virtual_tbl = catalog_view.getDest();
    VoltTable vt = CatalogUtil.getVoltTable(virtual_tbl);
    Collection<Column> virtual_cols = CatalogUtil.getColumns(catalog_view.getGroupbycols());
    
    table.resetRowPosition();
    while (table.advanceRow()) {
        int i = 0;
        Object row[] = new Object[virtual_cols.size()];
        for (Column catalog_col : CatalogUtil.getSortedCatalogItems(virtual_cols, "index")) {
            if (trace.val)
                LOG.trace(String.format("Adding %s [%d] to virtual column %d",
                          table.getColumnName(catalog_col.getIndex()), catalog_col.getIndex(), i));
            row[catalog_col.getIndex()] = table.get(catalog_col.getIndex());
        } // FOR
        vt.addRow(row);
    } // WHILE
    if (debug.val)
        LOG.info(String.format("Vertical Partition %s -> %s\n",
                 catalog_view.getParent().getName(), virtual_tbl.getName()) + vt);
    
    return (createReplicatedPlan(ts, virtual_tbl, vt));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:LoadMultipartitionTable.java

示例3: csv

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Dump out a VoltTable as a CSV to the given writer
 * If the header flag is set to true, then the output will include 
 * the column names in the first row
 * @param out
 * @param vt
 * @param write_header
 */
public static void csv(Writer out, VoltTable vt, boolean header) {
    CSVWriter writer = new CSVWriter(out);
    
    if (header) {
        String cols[] = new String[vt.getColumnCount()];
        for (int i = 0; i < cols.length; i++) {
            cols[i] = vt.getColumnName(i);
        } // FOR
        writer.writeNext(cols);
    }
    vt.resetRowPosition();
    while (vt.advanceRow()) {
        String row[] = vt.getRowStringArray();
        assert(row != null);
        assert(row.length == vt.getColumnCount());
        writer.writeNext(row);
    } // WHILE
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:27,代码来源:VoltTableUtil.java

示例4: combineTables

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Combine multiple VoltTables into a single table
 * 
 * @param vts
 * @return
 */
public static VoltTable combineTables(final VoltTable... vts) {
    assert (vts.length > 0);
    ColumnInfo cols[] = new ColumnInfo[vts[0].getColumnCount()];
    for (int i = 0; i < cols.length; i++) {
        cols[i] = new ColumnInfo(vts[0].getColumnName(i), vts[0].getColumnType(i));
    } // FOR

    VoltTable ret = new VoltTable(cols);
    for (VoltTable vt : vts) {
        assert (vt.getColumnCount() == ret.getColumnCount());
        vt.resetRowPosition();
        while (vt.advanceRow()) {
            ret.add(vt.cloneRow());
        } // WHILE
    } // FOR
    return (ret);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:ProcedureUtil.java

示例5: evictData

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private VoltTable evictData() throws Exception {
     VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
     assertEquals(1, results.length);
     // System.err.println(VoltTableUtil.format(results));
     for (String col : statsFields) {
results[0].advanceRow(); 
         int idx = results[0].getColumnIndex(col);
         assertEquals(0, results[0].getLong(idx));    
     } // FOR
     
     // Now force the EE to evict our boys out
     // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
     VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 1024, 1);

     System.err.println("-------------------------------");
     System.err.println(VoltTableUtil.format(evictResult));
     assertNotNull(evictResult);
     assertEquals(1, evictResult.getRowCount());
     assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
     evictResult.resetRowPosition();
     boolean adv = evictResult.advanceRow();
     assertTrue(adv);
     return (evictResult);
 }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:TestAntiCacheManagerTPCC.java

示例6: evictData

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private VoltTable evictData() throws Exception {
     VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
     assertEquals(1, results.length);
     // System.err.println(VoltTableUtil.format(results));
     for (String col : statsFields) {
results[0].advanceRow(); 
         int idx = results[0].getColumnIndex(col);
         assertEquals(0, results[0].getLong(idx));    
     } // FOR

     // Now force the EE to evict our boys out
     // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
     VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 500, 1);

     System.err.println("-------------------------------");
     System.err.println(VoltTableUtil.format(evictResult));
     assertNotNull(evictResult);
     assertEquals(1, evictResult.getRowCount());
     //assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
     evictResult.resetRowPosition();
     boolean adv = evictResult.advanceRow();
     assertTrue(adv);
       return (evictResult);
 }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:TestAntiCacheManager.java

示例7: testTicket511_ViolateUniquenessWithLargeString

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public void testTicket511_ViolateUniquenessWithLargeString() throws Exception {
    Client client = getClient();
    System.out.println("STARTING testTicket511_ViolateUniquenessWithLargeString");
    byte stringData[] = new byte[60000];
    java.util.Arrays.fill(stringData, (byte)'a');

    client.callProcedure("InsertBigString", 0, new String(stringData, "UTF-8"));

    java.util.Arrays.fill(stringData, (byte)'b');
    boolean threwException = false;
    try {
        client.callProcedure("InsertBigString", 0, new String(stringData, "UTF-8"));
    } catch (ProcCallException e) {
        threwException = true;
        assertTrue(e.getMessage().contains("CONSTRAINT VIOLATION"));
        assertTrue(e.getCause().getMessage().toUpperCase().contains("UNIQUE"));
        if (!isHSQL()) {
            VoltTable table = ((ConstraintFailureException)e.getCause()).getTuples();
            table.resetRowPosition();
            assertTrue(table.advanceRow());
            assertTrue(java.util.Arrays.equals(stringData, table.getStringAsBytes(2)));
        }
    }
    assertTrue(threwException);
}
 
开发者ID:s-store,项目名称:s-store,代码行数:26,代码来源:TestFailuresSuite.java

示例8: getTupleIds

import org.voltdb.VoltTable; //导入方法依赖的package包/类
protected void getTupleIds(String targetTableName, VoltTable tsTracking, Collection<Integer> tupleIds) {
    tsTracking.resetRowPosition();
    while (tsTracking.advanceRow()) {
        String tableName = tsTracking.getString(0);
        if (targetTableName.equalsIgnoreCase(tableName)) {
            tupleIds.add((int)tsTracking.getLong(1));
        }
    } // WHILE
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:10,代码来源:OptimisticConflictChecker.java

示例9: createTrimmedResultSet

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private JDBC4ResultSet createTrimmedResultSet(VoltTable input) throws SQLException
{
    VoltTable result = input;
    if (maxRows > 0 && input.getRowCount() > maxRows) {
        VoltTable trimmed = new VoltTable(input.getTableSchema());
        input.resetRowPosition();
        for (int i = 0; i < maxRows; i++) {
            input.advanceRow();
            trimmed.add(input.cloneRow());
        }
        result = trimmed;
    }
    return new JDBC4ResultSet(this, result);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:JDBC4Statement.java

示例10: checkConstraints

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private boolean checkConstraints(String procName, ClientResponse response) {
    boolean isSatisfied = true;
    int orig_position = -1;

    // Check if all the tables in the result set satisfy the constraints.
    for (int i = 0; isSatisfied && i < response.getResults().length; i++) {
        Pair<String, Integer> key = Pair.of(procName, i);
        if (!m_constraints.containsKey(key))
            continue;

        VoltTable table = response.getResults()[i];
        orig_position = table.getActiveRowIndex();
        table.resetRowPosition();

        // Iterate through all rows and check if they satisfy the
        // constraints.
        while (isSatisfied && table.advanceRow()) {
            isSatisfied = Verification.checkRow(m_constraints.get(key), table);
        }

        // Have to reset the position to its original position.
        if (orig_position < 0)
            table.resetRowPosition();
        else
            table.advanceToRow(orig_position);
    }

    if (!isSatisfied)
        LOG.error("Transaction " + procName + " failed check");

    return isSatisfied;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:33,代码来源:BenchmarkComponent.java

示例11: testEvictTuplesMultiple

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
   * testMultipleEvictions
   */
  @Test
  public void testEvictTuplesMultiple() throws Exception {
      // Just checks whether we can call evictBlock multiple times
      this.loadData();

      VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
      assertEquals(1, results.length);
      System.err.println(VoltTableUtil.format(results));

results[0].advanceRow(); 
      for (String col : statsFields) {
          int idx = results[0].getColumnIndex(col);
          assertEquals(0, results[0].getLong(idx));    
      } // FOR
      System.err.println(StringUtil.repeat("=", 100));
      
      // Now force the EE to evict our boys out in multiple rounds
      VoltTable evictResult = null;
      for (int i = 0; i < 5; i++) {
          if (i > 0) {
              System.err.println(StringUtil.repeat("-", 100));
              ThreadUtil.sleep(1000);
          }
          System.err.println("Eviction #" + i);
          evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 512, 1);
          System.err.println(VoltTableUtil.format(evictResult));
          assertNotNull(evictResult);
          assertEquals(1, evictResult.getRowCount());
          assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
          evictResult.resetRowPosition();
          boolean adv = evictResult.advanceRow();
          assertTrue(adv);
      } // FOR
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:TestAntiCacheManagerTPCC.java

示例12: testEvictTuplesMultiple

import org.voltdb.VoltTable; //导入方法依赖的package包/类
@Test
  public void testEvictTuplesMultiple() throws Exception {
      // Just checks whether we can call evictBlock multiple times
      this.loadData();

      VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
      assertEquals(1, results.length);
      System.err.println(VoltTableUtil.format(results));

results[0].advanceRow(); 
      for (String col : statsFields) {
          int idx = results[0].getColumnIndex(col);
          assertEquals(0, results[0].getLong(idx));    
      } // FOR
      System.err.println(StringUtil.repeat("=", 100));
      
      // Now force the EE to evict our boys out in multiple rounds
      VoltTable evictResult = null;
      for (int i = 0; i < 5; i++) {
          if (i > 0) {
              System.err.println(StringUtil.repeat("-", 100));
              ThreadUtil.sleep(1000);
          }
          System.err.println("Eviction #" + i);
          evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 512, 1);
          System.err.println(VoltTableUtil.format(evictResult));
          assertNotNull(evictResult);
          assertEquals(1, evictResult.getRowCount());
          assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
          evictResult.resetRowPosition();
          boolean adv = evictResult.advanceRow();
          assertTrue(adv);
      } // FOR
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:35,代码来源:TestAntiCacheManager.java


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