use of org.voltdb.VoltTable in project voltdb by VoltDB.
the class MatchChecks method getStats.
protected static long[] getStats(Client client) {
// check the start time, end time, and row count to calculate TPS
long[] stats = new long[3];
ClientResponse response = doAdHoc(client, "select count(*), since_epoch(Second, max(insert_time)), since_epoch(Second, min(insert_time)) from KAFKAIMPORTTABLE1;");
VoltTable countQueryResult = response.getResults()[0];
countQueryResult.advanceRow();
stats[0] = (long) countQueryResult.get(0, VoltType.BIGINT);
stats[1] = (long) countQueryResult.get(1, VoltType.BIGINT);
stats[2] = (long) countQueryResult.get(2, VoltType.BIGINT);
// double tps = (double) importRowCount / (double) elapsedMicroSecs;
return stats;
}
use of org.voltdb.VoltTable in project voltdb by VoltDB.
the class MatchChecks method checkPounderResults.
public static boolean checkPounderResults(long expected_rows, Client client) {
// make sure import table has expected number of rows, and without gaps
// we check the row count, then use min & max to infer the range is complete
long importRowCount = 0;
long importMax = 0;
long importMin = 0;
// check row count in import table
// String table = alltypes ? "KafkaImportTable2" : "KafkaImportTable1";
ClientResponse response = doAdHoc(client, "select count(key), min(key), max(key) from kafkaimporttable1");
VoltTable countQueryResult = response.getResults()[0];
countQueryResult.advanceRow();
importRowCount = (long) countQueryResult.get(0, VoltType.BIGINT);
importMin = (long) countQueryResult.get(1, VoltType.BIGINT);
importMax = (long) countQueryResult.get(2, VoltType.BIGINT);
if (importRowCount != expected_rows) {
log.error(expected_rows + " expected. " + importRowCount + " received.");
return false;
}
if (importMax == VoltType.NULL_BIGINT) {
importMax = 0;
}
if (importMin == VoltType.NULL_BIGINT) {
importMin = 0;
}
if ((importMax - importMin + 1) != expected_rows) {
log.error(expected_rows + " expected. " + (importMax - importMin + 1) + " rows received.");
return false;
}
return true;
}
use of org.voltdb.VoltTable in project voltdb by VoltDB.
the class MatchChecks method getImportRowCount.
protected static long getImportRowCount(Client client) {
// get the count of rows imported
ClientResponse response = doAdHoc(client, "select sum(TOTAL_ROWS_DELETED) from importcounts order by 1;");
VoltTable[] countQueryResult = response.getResults();
VoltTable data = countQueryResult[0];
if (data.asScalarLong() == VoltType.NULL_BIGINT)
return 0;
return data.asScalarLong();
}
use of org.voltdb.VoltTable in project voltdb by VoltDB.
the class MatchChecks method checkRowMismatch.
protected static long checkRowMismatch(Client client) {
// check if any rows failed column by colunn comparison so we can fail fast
ClientResponse response = doAdHoc(client, "select key from importcounts where value_mismatch = 1 limit 1;");
VoltTable[] result = response.getResults();
if (// || result[0].asScalarLong() == 0)
result[0].getRowCount() == 0)
return 0;
return result[0].asScalarLong();
}
use of org.voltdb.VoltTable in project voltdb by VoltDB.
the class InsertExport method run.
public long run(long key, long value) {
voltQueueSQL(exportInsert, key, value);
voltQueueSQL(mirrorInsert, key, value);
voltQueueSQL(selectCounts);
VoltTable[] result = voltExecuteSQL();
VoltTable data = result[2];
long nrows = data.getRowCount();
if (nrows > 0) {
long ck = data.fetchRow(0).getLong(0);
voltQueueSQL(updateCounts, 1l, ck);
voltExecuteSQL(true);
} else {
voltQueueSQL(insertCounts, key, 1l);
voltExecuteSQL(true);
}
// Execute queued statements
return 0;
}
Aggregations