Search in sources :

Example 81 with VoltTable

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;
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) VoltTable(org.voltdb.VoltTable)

Example 82 with VoltTable

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;
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) VoltTable(org.voltdb.VoltTable)

Example 83 with VoltTable

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();
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) VoltTable(org.voltdb.VoltTable)

Example 84 with VoltTable

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();
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) VoltTable(org.voltdb.VoltTable)

Example 85 with VoltTable

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;
}
Also used : VoltTable(org.voltdb.VoltTable)

Aggregations

VoltTable (org.voltdb.VoltTable)887 Client (org.voltdb.client.Client)497 ClientResponse (org.voltdb.client.ClientResponse)193 ProcCallException (org.voltdb.client.ProcCallException)144 IOException (java.io.IOException)100 VoltTableRow (org.voltdb.VoltTableRow)57 NoConnectionsException (org.voltdb.client.NoConnectionsException)52 ColumnInfo (org.voltdb.VoltTable.ColumnInfo)42 TimestampType (org.voltdb.types.TimestampType)37 BigDecimal (java.math.BigDecimal)30 ArrayList (java.util.ArrayList)27 Test (org.junit.Test)26 File (java.io.File)25 HashMap (java.util.HashMap)21 ClientResponseImpl (org.voltdb.ClientResponseImpl)20 Timestamp (java.sql.Timestamp)15 Date (java.util.Date)15 VoltDB (org.voltdb.VoltDB)15 DependencyPair (org.voltdb.DependencyPair)14 Configuration (org.voltdb.VoltDB.Configuration)14