當前位置: 首頁>>代碼示例>>Java>>正文


Java VoltTableRow類代碼示例

本文整理匯總了Java中org.voltdb.VoltTableRow的典型用法代碼示例。如果您正苦於以下問題:Java VoltTableRow類的具體用法?Java VoltTableRow怎麽用?Java VoltTableRow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


VoltTableRow類屬於org.voltdb包,在下文中一共展示了VoltTableRow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: storeData

import org.voltdb.VoltTableRow; //導入依賴的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: addHostData

import org.voltdb.VoltTableRow; //導入依賴的package包/類
@Override
void addHostData(VoltTableRow row) throws IOException {
    assert (row.getString("TABLE").equals(getTableName()));

    if (m_totalPartitions == 0) {
        // XXX this cast should be okay unless we exceed MAX_INT partitions
        m_totalPartitions = (int) row.getLong("TOTAL_PARTITIONS");
    }
    checkSiteConsistency(row); // throws if inconsistent

    int originalPartitionId = (int) row.getLong("PARTITION");
    m_partitionsSeen.add(originalPartitionId);
    int currentHostId = (int) row.getLong("CURRENT_HOST_ID");
    Set<Pair<Integer, Integer>> partitions_at_host = null;
    if (!(m_partitionsAtHost.containsKey(currentHostId))) {
        partitions_at_host = new HashSet<Pair<Integer, Integer>>();
        m_partitionsAtHost.put(currentHostId, partitions_at_host);
    }
    partitions_at_host = m_partitionsAtHost.get(currentHostId);

    partitions_at_host.add(Pair.of(originalPartitionId, (int) row.getLong("ORIGINAL_HOST_ID")));
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:23,代碼來源:PartitionedTableSaveFileState.java

示例3: constructTableState

import org.voltdb.VoltTableRow; //導入依賴的package包/類
private TableSaveFileState constructTableState(
        VoltTableRow row)
{
    TableSaveFileState table_state = null;
    String table_name = row.getString("TABLE");
    if (row.getString("IS_REPLICATED").equals("TRUE"))
    {
        table_state = new ReplicatedTableSaveFileState(table_name, m_allowExport);
        table_state.setSystemProcedureExecutionContext(this.m_context);
    }
    else if (row.getString("IS_REPLICATED").equals("FALSE"))
    {
        table_state = new PartitionedTableSaveFileState(table_name, m_allowExport);
        table_state.setSystemProcedureExecutionContext(this.m_context);
    }
    else
    {
        // XXX not reached
        assert(false);
    }
    return table_state;
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:23,代碼來源:ClusterSaveFileState.java

示例4: hashToSnapshot

import org.voltdb.VoltTableRow; //導入依賴的package包/類
private void hashToSnapshot(VoltTableRow r, HashMap<String, Snapshot> aggregates) {
    assert (r.getString("RESULT").equals("SUCCESS"));
    assert ("TRUE".equals(r.getString("READABLE")));
    final String path = r.getString("PATH");
    final String nonce = r.getString("NAME").substring(0, r.getString("NAME").indexOf('-'));
    final String combined = path + nonce;
    Snapshot s = aggregates.get(combined);
    if (s == null) {
        s = new Snapshot(r);
        aggregates.put(combined, s);
    } else {
        if (r.getLong("CREATED") != s.m_createTime) {
            return;
        }
        s.processRow(r);
    }
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:18,代碼來源:SnapshotScan.java

示例5: reduce

import org.voltdb.VoltTableRow; //導入依賴的package包/類
public void reduce(String key, Iterator<VoltTableRow> rows) {
        long count = 0;
        for (VoltTableRow r : CollectionUtil.iterable(rows)) {
            assert(r != null);
            //Long ct = (Long)r.getLong(1);
            long ct = (long)r.getLong(1);
            count+=ct;

            //System.out.println("....key is: " + key + " Value: "+count);
        } // FOR
      
//        while (rows.hasNext()) {
//            System.out.println("[row]: "+ key);
//            count++;
//        }
        
        Object new_row[] = {
            key,
            count
        };
        
        this.reduceOutput.addRow(new_row);
    }
 
開發者ID:s-store,項目名稱:s-store,代碼行數:24,代碼來源:TestReduceInputIterator.java

示例6: run

import org.voltdb.VoltTableRow; //導入依賴的package包/類
public VoltTable[] run(long acct_id) throws VoltAbortException {
    voltQueueSQL(getTradeStatus, acct_id);
    voltQueueSQL(getName, acct_id);
    
    // we need only the first table
    VoltTable ts = voltExecuteSQL()[0];
    VoltTable result = trade_status_ret_template.clone(256);
    
    for (int i = 0; i < ts.getRowCount(); i++) {
        VoltTableRow ts_row = ts.fetchRow(i);
        
        String status_name = ts_row.getString("ST_NAME");
        long trade_id = ts_row.getLong("T_ID");
        
        result.addRow(status_name, trade_id);
    }
    
    return new VoltTable[] {result};
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:20,代碼來源:TradeStatus.java

示例7: testLongStringUsage

import org.voltdb.VoltTableRow; //導入依賴的package包/類
public void testLongStringUsage() throws IOException {
    System.err.println("CURRENT: " + ClassUtil.getCurrentMethodName());
    final int STRLEN = 5000;

    Client client = getClient();

    String longStringPart = "volt!";
    StringBuilder sb = new StringBuilder();
    while(sb.length() < STRLEN)
        sb.append(longStringPart);
    String longString = sb.toString();
    assertEquals(STRLEN, longString.length());

    VoltTable[] results = null;
    try {
        results = client.callProcedure("WorkWithBigString", 1, longString).getResults();
    } catch (ProcCallException e) {
        e.printStackTrace();
        fail();
    }
    assertEquals(1, results.length);
    VoltTableRow row = results[0].fetchRow(0);

    assertEquals(1, row.getLong(0));
    assertEquals(0, row.getString(2).compareTo(longString));
}
 
開發者ID:s-store,項目名稱:s-store,代碼行數:27,代碼來源:TestSQLFeaturesSuite.java

示例8: run

import org.voltdb.VoltTableRow; //導入依賴的package包/類
public long run(int partId, VoltTable sp2Data, long[] extraArgs) {


    	
		for (int i=0; i < sp2Data.getRowCount(); i++) {
			VoltTableRow row = sp2Data.fetchRow(i);
			String symbol = row.getString("T_S_SYMB");
			voltQueueSQL(getSecurityID, symbol, partId);
			VoltTable v[] = voltExecuteSQL();
			long SK_SecurityID = v[0].fetchRow(0).getLong(0);
			long SK_CompanyID = v[0].fetchRow(0).getLong(1);

			voltQueueSQL(insertSP3Out, row.getLong("T_ID"), row.getLong("SK_CreateDateID"), row.getLong("SK_CreateTimeID"),
					row.getLong("SK_CloseDateID"), row.getLong("SK_CloseTimeID"), row.getString("Status"), row.getString("Type"),
					(short) row.getLong("T_IS_CASH"), SK_SecurityID, SK_CompanyID, (int) row.getLong("T_QTY"),
					row.getDouble("T_BID_PRICE"), (int) row.getLong("T_CA_ID"), row.getString("T_EXEC_NAME"),
					row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"), row.getDouble("T_COMM"), row.getDouble("T_TAX"),
					row.getLong("batch_id"), partId);

			int destinationPartition = TPCDIUtil.hashCode(TPCDIConstants.DIMACCOUNT_TABLE,String.valueOf(row.getLong("T_CA_ID")));
			voltExecuteSQLDownStream("SP3out", destinationPartition);
		}
        // Set the return value to 0: successful vote
        return TPCDIConstants.PROC_SUCCESSFUL;
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:26,代碼來源:SP3GetSecurityID.java

示例9: run

import org.voltdb.VoltTableRow; //導入依賴的package包/類
public long run(int partId, VoltTable sp2Data, long[] extraArgs) {


    	
		for (int i=0; i < sp2Data.getRowCount(); i++) {
			VoltTableRow row = sp2Data.fetchRow(i);
			String symbol = row.getString("T_S_SYMB");
			voltQueueSQL(getSecurityID, symbol, partId);
			VoltTable v[] = voltExecuteSQL();
			long SK_SecurityID = v[0].fetchRow(0).getLong(0);
			long SK_CompanyID = v[0].fetchRow(0).getLong(1);

			voltQueueSQL(insertSP3Out, row.getLong("T_ID"), row.getLong("SK_CreateDateID"), row.getLong("SK_CreateTimeID"),
					row.getLong("SK_CloseDateID"), row.getLong("SK_CloseTimeID"), row.getString("Status"), row.getString("Type"),
					(short) row.getLong("T_IS_CASH"), SK_SecurityID, SK_CompanyID, (int) row.getLong("T_QTY"),
					row.getDouble("T_BID_PRICE"), (int) row.getLong("T_CA_ID"), row.getString("T_EXEC_NAME"),
					row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"), row.getDouble("T_COMM"), row.getDouble("T_TAX"),
					row.getLong("batch_id"), partId);

			int destinationPartition = TPCDIUtil.hashCode(String.valueOf(row.getLong("T_CA_ID")), TPCDIConstants.NUM_PARTITIONS);
			voltExecuteSQLDownStream("SP3out", destinationPartition);
		}
        // Set the return value to 0: successful vote
        return TPCDIConstants.PROC_SUCCESSFUL;
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:26,代碼來源:SP3GetSecurityID.java

示例10: reduce

import org.voltdb.VoltTableRow; //導入依賴的package包/類
@Override
public void reduce(Long key, Iterator<VoltTableRow> rows) {
    double sum_ol_amount = 0;
    
    VoltTableRow row = null;
    for (VoltTableRow r : CollectionUtil.iterable(rows)) {
        assert(r != null);
        row = r;
        sum_ol_amount += row.getDouble(3);
    } // FOR

    Object new_row[] = {
            key,
            row.getLong(1),
            row.getLong(2),
            sum_ol_amount,
            row.getTimestampAsTimestamp(4)
    };
    this.reduceEmit(new_row);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:21,代碼來源:MRquery3.java

示例11: run

import org.voltdb.VoltTableRow; //導入依賴的package包/類
public VoltTable[] run(short w_id, byte d_id, double h_amount, short c_w_id, byte c_d_id, String c_last, TimestampType timestamp) throws VoltAbortException {
//        voltQueueSQL(getCustomersByLastName, c_last, c_d_id, c_w_id);
        voltQueueSQL(getCidByLastName, c_last, c_d_id, c_w_id);
        final VoltTable customersIds = voltExecuteSQL()[0];
        final int namecnt = customersIds.getRowCount();
        if (namecnt == 0) {
            throw new VoltAbortException("no customers with last name: " + c_last + " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customerIdRow = customersIds.fetchRow(index);
        final int c_id = (int)customerIdRow.getLong(C_ID_IDX);
        
        voltQueueSQL(getCustomersByCustomerId, c_id, c_d_id, c_w_id);
        final VoltTableRow customer = voltExecuteSQL()[0].fetchRow(0);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:19,代碼來源:paymentByCustomerName.java

示例12: reduce

import org.voltdb.VoltTableRow; //導入依賴的package包/類
@Override
public void reduce(Long key, Iterator<VoltTableRow> rows) {
    long sum_high = 0;
    long sum_low = 0;
    for (VoltTableRow r : CollectionUtil.iterable(rows)) {
        assert(r != null);
        sum_high += rows.next().getLong(1);
        sum_low += rows.next().getLong(2);
    } // FOR

    Object new_row[] = {
            key,
            sum_high,
            sum_low
    };
    this.reduceEmit(new_row);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:18,代碼來源:MRquery12.java

示例13: map

import org.voltdb.VoltTableRow; //導入依賴的package包/類
@Override
public void map(VoltTableRow row) {
    long key = row.getLong(0); // A_NAME
    long quantity = row.getLong(1);
    double amount = row.getDouble(2);
    double price = row.getDouble(3);
    long ct = row.getLong(4);
    Object new_row[] = {
            key,
            quantity, // FIXME row.getLong(1)
            amount,
            price,
            ct
    };
    this.mapEmit(key, new_row);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:17,代碼來源:MRqueryJoinAgg.java

示例14: compareTables

import org.voltdb.VoltTableRow; //導入依賴的package包/類
private void compareTables(VoltTable vt0, VoltTable vt1) {
        assertEquals(vt0.getRowCount(), vt1.getRowCount());
        assertEquals(vt0.getColumnCount(), vt1.getColumnCount());
        assert(vt1.getColumnCount() > 0);
        int rows = 0;
        while (vt0.advanceRow() && vt1.advanceRow()) {
            VoltTableRow row0 = vt0.fetchRow(vt0.getActiveRowIndex());
            VoltTableRow row1 = vt1.fetchRow(vt1.getActiveRowIndex());
            
            for (int i = 0; i < vt0.getColumnCount(); i++) {
//                System.err.println(i + ": " + row1.get(i));
                assertEquals(row0.get(i), row1.get(i));
            } // FOR
            rows++;
        } // WHILE
        assert(rows > 0);
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:18,代碼來源:TestMapReduceTransaction.java

示例15: compare

import org.voltdb.VoltTableRow; //導入依賴的package包/類
@Override
public int compare(Object arg0, Object arg1) {
    VoltTableRow r1 = (VoltTableRow)arg0;
    VoltTableRow r2 = (VoltTableRow)arg1;

    String r1d1 = (String) r1.get(0, VoltType.STRING);
    String r1d2 = (String) r1.get(1, VoltType.STRING);
    String r2d1 = (String) r2.get(0, VoltType.STRING);
    String r2d2 = (String) r2.get(1, VoltType.STRING);

    int r1d1_pos = Integer.valueOf(r1d1.substring(3));
    int r1d2_pos = Integer.valueOf(r1d2.substring(3));
    int r2d1_pos = Integer.valueOf(r2d1.substring(3));
    int r2d2_pos = Integer.valueOf(r2d2.substring(3));

    System.out.printf("comparing (%s, %s) to (%s, %s)\n",
            r1d1, r1d2, r2d1, r2d2);

    if (r1d1_pos != r2d1_pos)
        return r1d1_pos - r2d1_pos;

    if (r1d2_pos != r2d2_pos)
        return r1d2_pos - r2d2_pos;

    return 0;
}
 
開發者ID:s-store,項目名稱:s-store,代碼行數:27,代碼來源:TestPlansGroupBySuite.java


注:本文中的org.voltdb.VoltTableRow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。