/** sums the contents of a latency bucket table. */ private long[] latencySummaryHelper(VoltTable vt) { long sums[] = new long[20]; for (int i = 0; i < vt.getRowCount(); i++) { VoltTableRow row = vt.fetchRow(i); // 20 buckets for (int c = 0; c < 20; c++) { // 7 ignored header columns sums[c] += row.getLong(c + 7); } } return sums; }
public long run(int id) throws VoltAbortException { long numRows = 0; voltQueueSQL(insertSQL, 1, "one"); voltQueueSQL(insertSQL, 2, "two"); voltQueueSQL(insertSQL, 3, "three"); voltExecuteSQL(); // comparing STRINGVAL to integer 1 causes ENG-800 voltQueueSQL(selectSQL, 1); VoltTable results1[] = voltExecuteSQL(true); if (results1[0].getRowCount() == 1) { VoltTableRow row1 = results1[0].fetchRow(0); numRows = row1.getLong(0); } return numRows; }
public long run(int id) throws VoltAbortException { long numRows = 0; voltQueueSQL(insertSQL, 1, 1.1); voltQueueSQL(insertSQL, 2, 2.2); voltQueueSQL(insertSQL, 3, 3.3); voltExecuteSQL(); // comparing FLOATVAL to string causes ENG-800 voltQueueSQL(selectSQL, "onepointone"); VoltTable results1[] = voltExecuteSQL(true); if (results1[0].getRowCount() == 1) { VoltTableRow row1 = results1[0].fetchRow(0); numRows = row1.getLong(0); } return numRows; }
public VoltTable[] run(short w_id, byte d_id, byte[] c_last) { voltQueueSQL(getCustomersByLastName, w_id, d_id, c_last); VoltTable customers = voltExecuteSQL()[0]; // Get the midpoint customer's id final int namecnt = customers.getRowCount(); final int index = (namecnt - 1) / 2; final VoltTableRow customer = customers.fetchRow(index); final long c_id = customer.getLong(C_ID_IDX); // Build an VoltTable with a single customer row final VoltTable customerResultTable = result_template.clone(1024); customerResultTable.addRow( c_id, customer.getStringAsBytes(1), customer.getStringAsBytes(2), customer.getStringAsBytes(3), customer.getDouble(4)); // Do the rest of the work return getOrderStatus(w_id, d_id, c_id, customerResultTable); }