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


Java VoltTable.getRowCount方法代码示例

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


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

示例1: makeCustomerName

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private void makeCustomerName(VoltTable table) {
    // Customer Name! Booyah! Shaq Attaq!
    VoltTable batch = new VoltTable(table);
    if (debug.val)
        LOG.debug(String.format("Loading replicated CUSTOMER_NAME table [tuples=%d]", table.getRowCount()));
    try {
        for (int i = 0, cnt = table.getRowCount(); i < cnt; i++) {
            if (this.stop) return;
            batch.add(table.fetchRow(i));
            if (batch.getRowCount() == replicated_batch_size) {
                if (debug.val)
                    LOG.debug(String.format("Loading replicated CUSTOMER_NAME table [tuples=%d/%d]", i, cnt));
                loadVoltTable("CUSTOMER_NAME", batch);
                batch.clearRowData();
            }
        } // FOR
        if (batch.getRowCount() > 0) {
            loadVoltTable("CUSTOMER_NAME", batch);
            batch.clearRowData();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        table.clearRowData();
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:27,代码来源:TPCCLoader.java

示例2: storeTableInMap

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Store
 * 
 * @param map
 * @param vt
 */
public static void storeTableInMap(final Map<String, Object[]> map, final VoltTable vt) {
    assert (vt != null);
    assert (map != null);

    int num_rows = vt.getRowCount();
    while (vt.advanceRow()) {
        int row_idx = vt.getActiveRowIndex();
        for (int i = 0, cnt = vt.getColumnCount(); i < cnt; i++) {
            String col_name = vt.getColumnName(i);
            VoltType vtype = vt.getColumnType(i);
            if (row_idx == 0) {
                map.put(col_name, new Object[num_rows]);
            }
            map.get(col_name)[row_idx] = vt.get(col_name, vtype);
        } // FOR
    } // WHILE
}
 
开发者ID:s-store,项目名称:s-store,代码行数:24,代码来源:ProcedureUtil.java

示例3: checkTable

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private void checkTable(Client client, String tableName, String orderByCol, int expectedRows) {
    if (expectedRows > 200000) {
        System.out.println("Table too large to retrieve with select *");
        System.out.println("Skipping integrity check");
    }
    VoltTable result = null;
    try {
        result = client.callProcedure("SaveRestoreSelect", tableName).getResults()[0];

    } catch (Exception e) {
        e.printStackTrace();
    }
    final int rowCount = result.getRowCount();
    assertEquals(expectedRows, rowCount);

    // System.out.println("Check table :: \n"+result);

    int i = 0;
    while (result.advanceRow()) {
        assertEquals(i, result.getLong(0));
        assertEquals("name_" + i, result.getString(1));
        assertEquals(i, result.getLong(2));
        assertEquals(new Double(i), result.getDouble(3));
        ++i;
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:27,代码来源:TestSnapshotSaveAndRestoreReplicatedTable.java

示例4: run

import org.voltdb.VoltTable; //导入方法依赖的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,项目名称:s-store,代码行数:26,代码来源:SP3GetSecurityID.java

示例5: genAccessInfo

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Populate Access_Info table per benchmark spec.
 */
void genAccessInfo(Table catalog_tbl) {
    final VoltTable table = CatalogUtil.getVoltTable(catalog_tbl);
    int[] arr = { 1, 2, 3, 4 };

    int[] ai_types = TM1Util.subArr(arr, 1, 4);
    long total = 0;
    for (long s_id = 0; s_id < this.subscriberSize; s_id++) {
        for (int ai_type : ai_types) {
            Object row[] = new Object[table.getColumnCount()];
            row[0] = s_id;
            row[1] = ai_type;
            row[2] = TM1Util.number(0, 255);
            row[3] = TM1Util.number(0, 255);
            row[4] = TM1Util.astring(3, 3);
            row[5] = TM1Util.astring(5, 5);
            table.addRow(row);
            total++;
        } // FOR
        if (table.getRowCount() >= TM1Constants.BATCH_SIZE) {
            if (d) LOG.debug(String.format("%s: %6d / %d",
                             TM1Constants.TABLENAME_ACCESS_INFO, total, ai_types.length * subscriberSize));
            loadVoltTable(TM1Constants.TABLENAME_ACCESS_INFO, table);
            table.clearRowData();
        }
    } // WHILE
    if (table.getRowCount() > 0) {
        if (d) LOG.debug(String.format("%s: %6d / %d",
                         TM1Constants.TABLENAME_ACCESS_INFO, total, ai_types.length * subscriberSize));
        loadVoltTable(TM1Constants.TABLENAME_ACCESS_INFO, table);
        table.clearRowData();
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:36,代码来源:TM1Loader.java

示例6: displayResult

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private void displayResult() throws Exception
{
    {
        // print out
        if(runner.display==true)
        {
            // get one round result
            InputClientConnection anothericc = runner.getRandomConnection();
            VoltTable table = getResult(anothericc.client, "GetResults");
        
            System.out.println("Getting result from node -" + anothericc.hostname + "...");
            if(table != null)
            {
                int rowsize = table.getRowCount();
                System.out.println("batch:" + batch.getID() + " - total words: " + batch.getSize() + " - words:"+ rowsize);
                System.out.println("--------------BEGIN------------");
                int igroup = 5;
                String groupoutput = "";
                for(int rowindex=0; rowindex<rowsize; rowindex++)
                {
                    String word = table.fetchRow(rowindex).getString(0);
                    int num = (int)table.fetchRow(rowindex).getLong(1);
                    word = String.format("%-15s - ", word);
                    String strNum = String.format("%5d    ", num);
                    groupoutput += word + strNum;
                    if(rowindex % igroup == (igroup-1)){
                        System.out.println( groupoutput );
                        groupoutput = "";
                    }
                }
                System.out.println("--------------END--------------");
            }
        }
    }

}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:37,代码来源:BatchRunner.java

示例7: 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,项目名称:s-store,代码行数:15,代码来源:JDBC4Statement.java

示例8: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public VoltTable[] run(String[] broker_list, String sector_name) throws VoltAbortException {
    // it seems we should return only the volumes
    VoltTable result = new VoltTable(new VoltTable.ColumnInfo("volume", VoltType.FLOAT));
    
    List<Double> volumes = new ArrayList<Double>();
    for (int i = 0; i < broker_list.length; i++) {
        voltQueueSQL(getBrokerInfo, broker_list[i], sector_name);
        VoltTable brok_res = voltExecuteSQL()[0];
        
        if (brok_res.getRowCount() > 0) {
            double vol = 0;
            for (int j = 0; j < brok_res.getRowCount(); j++) {
                vol += brok_res.fetchRow(j).getDouble(1);
            }
            volumes.add(vol);
        }
    }
    
    // sort the values
    Collections.sort(volumes);
    
    // populating the result table in reverse order (since we need order by desc)
    for (int i = volumes.size() - 1; i >= 0; i--) {
        result.addRow(volumes.get(i));
    }
    
    return new VoltTable[] {result};
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:29,代码来源:BrokerVolume.java

示例9: generateTableData

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Load the tuples for the given table name
 * @param tableName
 */
protected void generateTableData(String tableName) {
    LOG.debug("Starting data generator for '" + tableName + "'");
    final AbstractTableGenerator generator = this.generators.get(tableName);
    assert(generator != null);
    long tableSize = generator.getTableSize();
    long batchSize = generator.getBatchSize();
    final AtomicLong table_ctr = this.table_sizes.get(tableName); 
    VoltTable table = generator.getVoltTable();
    
    LOG.info("Loading " + tableSize + " tuples for table '" + tableName + "'");
    while (generator.hasMore()) {
        generator.addRow();
        if (table.getRowCount() >= batchSize) {
            if (table_ctr.get() % 100000 == 0) LOG.info(String.format(tableName + ": loading %d rows (id %d of %d)", table.getRowCount(), generator.getCount(), tableSize));
            loadVoltTable(tableName, table);
            table_ctr.addAndGet(table.getRowCount());
            table.clearRowData();
        }
    } // WHILE
    if (table.getRowCount() > 0) {
        LOG.info(tableName + ": loading final " + table.getRowCount() + " rows.");
        loadVoltTable(tableName, table);
        this.table_sizes.get(tableName).addAndGet(table.getRowCount());
        table.clearRowData();
    }
    LOG.info(tableName + ": Inserted " + this.table_sizes.get(tableName) + " tuples");
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:32,代码来源:MapReduceLoader.java

示例10: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp4Data, long[] extraArgs) {
  	
for (int i=0; i < sp4Data.getRowCount(); i++) {
	VoltTableRow row = sp4Data.fetchRow(i);
	double tradePrice = row.getDouble("T_TRADE_PRICE");
	double quantity = (double)row.getLong("T_QTY");
	Double commission = row.getDouble("T_COMM");
	Double fee = row.getDouble("T_CHRG");
	long tradeID = row.getLong("T_ID");
	long batchID = row.getLong("batch_id");
	String messageText = "";
	String messageData = "";
	
	if(commission != null && commission > tradePrice*quantity){
		messageText = "Invalid trade commission";
		messageData = "T_ID=" + tradeID + ", T_COMM=" + commission;
		voltQueueSQL(insertMessage, batchID,"DimTrade","Alert",messageText,messageData,partId);
	}
	if(fee != null && fee > tradePrice*quantity){
		messageText = "Invalid trade fee";
		messageData = "T_ID=" + tradeID + ", T_CHRG=" + fee;
		voltQueueSQL(insertMessage, batchID, "DimTrade","Alert",messageText,messageData,partId);
	}

	voltQueueSQL(insertDimTrade, row.getLong("T_ID"), row.getLong("SK_BrokerID"), 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"),
			row.getLong("SK_SecurityID"), row.getLong("SK_CompanyID"), (int) row.getLong("T_QTY"),
			row.getDouble("T_BID_PRICE"), row.getLong("SK_CustomerID"), row.getLong("SK_AccountID"),
			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);
	
	voltExecuteSQL();
}
      // Set the return value to 0: successful vote
      return TPCDIConstants.PROC_SUCCESSFUL;
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:SP5InsertTrade.java

示例11: generateCustomers

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 *   Populate customers table per benchmark spec.
 */
void generateCustomers() {
    int cid = 0;
    VoltTable customerTbl = initializeCustomerDataTable();
    Object row[] = new Object[customerTbl.getColumnCount()];

    while (cid < kMaxCustomers / m_scalefactor) {
        int col = 0;
        row[col++] = new Integer(cid++);
        for (int j=0; j < 20; ++j) {
            row[col++] = astring(6,8);
        }
        for (int j=0; j < 20; ++j) {
            row[col++] = number(0, 1<<30);
        }
        assert (col == customerTbl.getColumnCount());
        customerTbl.addRow(row);

        if (customerTbl.getRowCount() >= kCustomerBatchSize) {
            System.err.printf("CUSTOMERS: loading %d rows (cid %d of %d)\n",
                              customerTbl.getRowCount(), cid, (kMaxCustomers / m_scalefactor));
            loadTable("CUSTOMERS", customerTbl);
             customerTbl.clearRowData();
        }
    }
    System.err.println("CUSTOMERS: loading final " + customerTbl.getRowCount() + " rows.");
    loadTable("CUSTOMERS", customerTbl);
    customerTbl.clearRowData();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:32,代码来源:Loader.java

示例12: makeItems

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/** generate replicated tables, ITEM and CUSTOMER_NAME. */
public void makeItems(int itemStart, int itemFinish) {
    // create ITEMS here to reduce memory consumption
    VoltTable items = new VoltTable(new VoltTable.ColumnInfo("I_ID", VoltType.INTEGER),
                                    new VoltTable.ColumnInfo("I_IM_ID", VoltType.INTEGER),
                                    new VoltTable.ColumnInfo("I_NAME", VoltType.STRING),
                                    new VoltTable.ColumnInfo("I_PRICE", VoltType.FLOAT),
                                    new VoltTable.ColumnInfo("I_DATA", VoltType.STRING));
    
    
    
    // items.ensureRowCapacity(parameters.items);
    // items.ensureStringCapacity(parameters.items * 96);
    // Select 10% of the rows to be marked "original"
    if (debug.val)
        LOG.debug(String.format("Loading replicated ITEM table [tuples=%d]", m_parameters.num_items));
    HashSet<Integer> originalRows = selectUniqueIds(m_parameters.num_items / 10, 1, m_parameters.num_items);
    for (int i = itemStart; i < itemFinish; ++i) {
        // if we're on a 10% boundary, print out some nice status info
        // if (i % (m_parameters.items / 10) == 0)
        // System.err.printf("   %d%%\n", (i * 100) /
        // m_parameters.items);

        boolean original = originalRows.contains(i);
        generateItem(items, i, original);
        
        // Items! Sail yo ho!
        if (items.getRowCount() == replicated_batch_size) {
            if (debug.val)
                LOG.debug(String.format("Loading replicated ITEM table [tuples=%d/%d]", i, m_parameters.num_items));
            loadVoltTable("ITEM", items);
            items.clearRowData();
        }
        if (this.stop) return;
    } // FOR
    if (items.getRowCount() > 0) {
        String extra = "";
        if (items.getRowCount() < m_parameters.num_items) extra = String.format(" [tuples=%d/%d]", m_parameters.num_items-items.getRowCount(), m_parameters.num_items);
        if (debug.val)
            LOG.debug("Loading replicated ITEM table" + extra);
        loadVoltTable("ITEM", items);
        items.clearRowData();
    }
    items = null;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:46,代码来源:TPCCLoader.java

示例13: genSpeAndCal

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Populate Special_Facility table and CallForwarding table per benchmark
 * spec.
 */
void genSpeAndCal(Table catalog_spe, Table catalog_cal) {
    VoltTable speTbl = CatalogUtil.getVoltTable(catalog_spe);
    VoltTable calTbl = CatalogUtil.getVoltTable(catalog_cal);

    long speTotal = 0;
    long calTotal = 0;
    int[] arrSpe = { 1, 2, 3, 4 };
    int[] arrCal = { 0, 8, 6 };

    for (long s_id = 0; s_id < this.subscriberSize; s_id++) {
        int[] sf_types = TM1Util.subArr(arrSpe, 1, 4);
        for (int sf_type : sf_types) {
            Object row_spe[] = new Object[speTbl.getColumnCount()];
            row_spe[0] = s_id;
            row_spe[1] = sf_type;
            row_spe[2] = TM1Util.isActive();
            row_spe[3] = TM1Util.number(0, 255);
            row_spe[4] = TM1Util.number(0, 255);
            row_spe[5] = TM1Util.astring(5, 5);
            speTbl.addRow(row_spe);
            speTotal++;

            // now call_forwarding
            int[] start_times = TM1Util.subArr(arrCal, 0, 3);
            for (int start_time : start_times) {
                Object row_cal[] = new Object[calTbl.getColumnCount()];
                row_cal[0] = s_id;
                row_cal[1] = sf_type;
                row_cal[2] = start_time;
                row_cal[3] = start_time + TM1Util.number(1, 8);
                row_cal[4] = TM1Util.nstring(15, 15);
                calTbl.addRow(row_cal);
                calTotal++;
            } // FOR
        } // FOR

        if (calTbl.getRowCount() >= TM1Constants.BATCH_SIZE) {
            if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_CALL_FORWARDING, calTotal));
            loadVoltTable(TM1Constants.TABLENAME_CALL_FORWARDING, calTbl);
            calTbl.clearRowData();
            assert(calTbl.getRowCount() == 0);
        }
        if (speTbl.getRowCount() >= TM1Constants.BATCH_SIZE) {
            if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_SPECIAL_FACILITY, speTotal));
            loadVoltTable(TM1Constants.TABLENAME_SPECIAL_FACILITY, speTbl);
            speTbl.clearRowData();
            assert(speTbl.getRowCount() == 0);
        }
    } // WHILE
    if (calTbl.getRowCount() > 0) {
        if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_CALL_FORWARDING, calTotal));
        loadVoltTable(TM1Constants.TABLENAME_CALL_FORWARDING, calTbl);
        calTbl.clearRowData();
        assert(calTbl.getRowCount() == 0);
    }
    if (speTbl.getRowCount() > 0) {
        if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_SPECIAL_FACILITY, speTotal));
        loadVoltTable(TM1Constants.TABLENAME_SPECIAL_FACILITY, speTbl);
        speTbl.clearRowData();
        assert(speTbl.getRowCount() == 0);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:67,代码来源:TM1Loader.java

示例14: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public VoltTable run() {

        voltQueueSQL(getCurrentLocation);
        VoltTable i[] = voltExecuteSQL();

        Double lat = i[0].fetchRow(0).getDouble("c_lat");
        Double lon = i[0].fetchRow(0).getDouble("c_lon");
        Integer month = new Integer((int) i[0].fetchRow(0).getLong("c_month"));

//        Double a = SeaflowUtil.roundToHalf(lon);
//        Double b = SeaflowUtil.roundToHalf(lat);

        int k = 3;

        List<Double> tempMult = new ArrayList<>();
        List<Double> salMult = new ArrayList<>();
        List<Vector2D> tempVect = new ArrayList<>();
        List<Vector2D> salVect = new ArrayList<>();

        voltQueueSQL(getTemperatureStrip, lon - k, lat + k, lon - k, lat + k, month);
        VoltTable v = voltExecuteSQL()[0];

        for (int j = 0; j < v.getRowCount(); j++) {
            VoltTableRow row = v.fetchRow(j);

            Double thisLat = row.getDouble("a_lat");
            if (row.wasNull()) continue;

            Double thisLon = row.getDouble("a_lon");
            if (row.wasNull() || thisLon == lon || thisLat == lat) continue;

            Double thisTemp = row.getDouble("a_temp");
            if (!row.wasNull()) {
                tempVect.add(new Vector2D(1 / (thisLon - lon), 1 / (thisLat - lat)));
                tempMult.add(thisTemp);
            }

            Double thisSal = row.getDouble("a_salinity");
            if (!row.wasNull()) {
                salVect.add(new Vector2D(1 / (thisLon - lon), 1 / (thisLat - lat)));
                salMult.add(thisSal);
            }
        }

        Vector2D posTempSum = new Vector2D(tempMult, tempVect);
        Vector2D posSaltSum = new Vector2D(salMult, salVect);

        Vector2D posTempPosSaltSum = new Vector2D(1.0, posTempSum, 1.0, posSaltSum);
        Vector2D posTempNegSaltSum = new Vector2D(1.0, posTempSum, -1.0, posSaltSum);
        Vector2D negTempPosSaltSum = new Vector2D(-1.0, posTempSum, 1.0, posSaltSum);
        Vector2D negTempNegSaltSum = new Vector2D(-1.0, posTempSum, -1.0, posSaltSum);


        double posTempDegrees = toDegrees(posTempSum);
        double posSaltDegrees = toDegrees(posSaltSum);
        double negTempDegrees = (posTempDegrees + 180.0) % 360.0;
        double negSaltDegrees = (posSaltDegrees + 180.0) % 360.0;

        double posTempSaltPosSaltDegrees = toDegrees(posTempPosSaltSum);
        double posTempSaltNegSaltDegrees = toDegrees(posTempNegSaltSum);
        double negTempSaltPosSaltDegrees = toDegrees(negTempPosSaltSum);
        double negTempSaltNegSaltDegrees = toDegrees(negTempNegSaltSum);

        voltQueueSQL(multiUpdateSteering, posTempDegrees, negTempDegrees, posSaltDegrees, negSaltDegrees, posTempSaltPosSaltDegrees, posTempSaltNegSaltDegrees, negTempSaltPosSaltDegrees, negTempSaltNegSaltDegrees);
        voltQueueSQL(getSteering);

        VoltTable result[] = voltExecuteSQL();

        return result[1];

    }
 
开发者ID:s-store,项目名称:s-store,代码行数:72,代码来源:MultiSteering.java

示例15: execute

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
     * Execute stmt with args, and put result, which is an array of columns,
     * into map
     * 
     * @param map
     *            the container of results of executing stmt
     * @param sp
     *            the store procedure that executes stmt
     * @param stmt
     *            the SQLStmt to be executed
     * @param args
     *            the argument needed by stmt
     * @param keys
     *            the names of columns in map
     * @param value_refs
     *            the references of values matching the keys. Each reference is
     *            one of {column_index, column_name, key_name}
     * @return the size of the first VoltTable among the array of VoltTable
     *         returned by executing stmt
     */
    public static int execute(Map<String, Object[]> map, VoltProcedure sp, SQLStmt stmt, Object[] args, String[] keys, Object[] value_refs) {
        LOG.info("Executing SQL: " + stmt);
System.out.println("ProcedureUtil line 97: " + args.length);
        String debug = "PARAMS:";
        for (Object arg : args) {
            debug += " " + arg;
        }
        LOG.info(debug);

        sp.voltQueueSQL(stmt, args);
        VoltTable table = sp.voltExecuteSQL()[0];
        System.out.println(table);

        if (keys == null) {
            assert (value_refs == null);
            return -1;
        }

        assert (keys.length == value_refs.length);

        int row_count = table.getRowCount();
System.out.println("ProcedureUtil line 116: " + row_count);
        // each key corresponds to a column of length row_count
        for (String key : keys)
            map.put(key, new Object[row_count]);

        // for update, delete, insert, keys is empty
        if (keys.length > 0) {
            for (int i = 0; i < row_count; i++) {
                VoltTableRow row = table.fetchRow(i);
                for (int j = 0; j < keys.length; j++) {
                    Object[] vals = map.get(keys[j]);
                    Object ref = value_refs[j];
                    if (ref instanceof Integer) {
                        // ref is column_index
                        vals[i] = row.get(j, table.getColumnType(j));
                    } else {
                        assert (ref instanceof String);
                        int idx = table.getColumnIndex((String) ref);
                        if (idx >= 0) {
                            // ref is column_name
                            vals[i] = row.get(idx, table.getColumnType(idx));
                        } else {
                            // ref is key_name
                            if (map.get(ref).length == 1) {
                                vals[i] = map.get(ref)[0];
                            } else {
                                vals[i] = map.get(ref)[i];
                            }
                        }
                    }
                }
            }
        }

        return row_count;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:78,代码来源:ProcedureUtil.java


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