Package org.voltdb

Examples of org.voltdb.VoltTable


                                             voteId++,
                                             phoneNumber,
                                             contestantNumber,
                                             maxVotesPerPhoneNumber);
            assertEquals(Status.OK, cresponse.getStatus());
            VoltTable results[] = cresponse.getResults();
            assertEquals(1, results.length);
            //assertEquals(expected, results[0].asScalarLong());
        } // FOR
    }
View Full Code Here


        System.out.println("Starting testTPCC - Logical Recovery");               

        deleteTestFiles();
        setUpSnapshotDir();

        VoltTable results[] = null;
        Client client = this.getClient();
        CatalogContext cc = this.getCatalogContext();      
       
        // Load database
        try {
View Full Code Here

        int ctr = 0;
        Iterator<LogEntry> log_itr = reader.iterator();
        ClientResponse cresponse = null;
        Client client = this.getClient();
        CatalogContext cc = this.getCatalogContext();
        VoltTable results[] = null;

        while (log_itr.hasNext()) {
            LogEntry entry = log_itr.next();

            assert(entry != null);
View Full Code Here

   
    public VoltTable[] run(long sendAcct, long destAcct, double amount) {
        // BATCH #1
        voltQueueSQL(GetAccount, sendAcct);
        voltQueueSQL(GetAccount, destAcct);
        final VoltTable acctResults[] = voltExecuteSQL();
        assert(acctResults != null);
       
        // BATCH #2
        voltQueueSQL(GetCheckingBalance, sendAcct);
        final VoltTable balResults[] = voltExecuteSQL();
        assert(balResults != null);
       
        // BATCH #3
        voltQueueSQL(UpdateCheckingBalance, amount*-1d, sendAcct);
        voltQueueSQL(UpdateCheckingBalance, amount, destAcct);
        final VoltTable updateResults[] = voltExecuteSQL();
       
        return (updateResults);
    }
View Full Code Here

        "SELECT AVG(S_ID) AS a " +
        "  FROM " + TM1Constants.TABLENAME_CALL_FORWARDING
    );
   
    public VoltTable[] run(int partition, long sleep) {
        VoltTable results[] = null;
       
        // First execute a remote query
        voltQueueSQL(getRemote);
        results = voltExecuteSQL();
        assert(results.length == 1);
View Full Code Here

    public final SQLStmt query = new SQLStmt(
        "SELECT COUNT(*) FROM " + TPCCConstants.TABLENAME_ITEM
    );
   
    public VoltTable[] run(int partition, long sleep_before, long sleep_after) {
        VoltTable results[] = null;

        // Sleep first!
        LOG.info(String.format("BEFORE: Sleeping for %.01f seconds", sleep_before / 1000d));
        ThreadUtil.sleep(sleep_before);
        LOG.info("BEFORE: Awake!");
View Full Code Here

                                                        acctIds[0], acctIds[1], balances[0]);
        assertEquals(Status.OK, cresponse.getStatus());
        assertFalse(cresponse.toString(), cresponse.isSinglePartition());
        assertTrue(cresponse.toString(), cresponse.getDebug().hadPrefetchedQueries());
       
        VoltTable results[] = cresponse.getResults();
        assertEquals(2, results.length);
        for (int i = 0; i < results.length; i++) {
            assertEquals(1l, results[i].asScalarLong());
        } // FOR
       
View Full Code Here

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Test
    public void testSimpleSort() throws Exception {
        for (int i = 0; i < SCHEMA.length; i++) {
            Pair<Integer, SortDirectionType> sortCol = Pair.of(i, SortDirectionType.ASC);
            VoltTable sorted = VoltTableUtil.sort(this.table, sortCol);
            assertNotNull(sorted);
            assertEquals(this.table.getRowCount(), sorted.getRowCount());

            System.err.println(sorted);

            Comparable last = null;
            while (sorted.advanceRow()) {
                Comparable cur = (Comparable<?>) sorted.get(sortCol.getFirst());
                if (last != null) {
                    assert (cur.compareTo(last) > 0) : String.format("%s > %s", cur, last);
                }
                last = cur;
            } // WHILE
View Full Code Here

        } // WHILE
        assertEquals(NUM_ROWS*2, this.table.getRowCount());
       
        for (int i = 0; i < SCHEMA.length; i++) {
            Pair<Integer, SortDirectionType> sortCol = Pair.of(i, SortDirectionType.ASC);
            VoltTable sorted = VoltTableUtil.sort(this.table, sortCol);
            assertNotNull(sorted);
            assertEquals(this.table.getRowCount(), sorted.getRowCount());

            System.err.println(sorted);

            Comparable last = null;
            while (sorted.advanceRow()) {
                Comparable cur = (Comparable<?>) sorted.get(sortCol.getFirst());
                if (last != null) {
                    assert (cur.compareTo(last) >= 0) : String.format("%s > %s", cur, last);
                }
                last = cur;
            } // WHILE
View Full Code Here

    private VoltTable createReplicatedTable(int numberOfItems, int indexBase, StringBuilder sb) {
        return createReplicatedTable(numberOfItems, indexBase, sb, false);
    }

    private VoltTable createReplicatedTable(int numberOfItems, int indexBase, StringBuilder sb, boolean generateCSV) {
        VoltTable repl_table = new VoltTable(new ColumnInfo("RT_ID", VoltType.INTEGER), new ColumnInfo("RT_NAME", VoltType.STRING), new ColumnInfo("RT_INTVAL", VoltType.INTEGER), new ColumnInfo(
                "RT_FLOATVAL", VoltType.FLOAT));
        char delimeter = generateCSV ? ',' : '\t';
        for (int i = indexBase; i < numberOfItems + indexBase; i++) {
            String stringVal = null;
            String escapedVal = null;

            if (sb != null) {
                if (generateCSV) {
                    int escapable = i % 5;
                    switch (escapable) {
                        case 0:
                            stringVal = "name_" + i;
                            escapedVal = "name_" + i;
                            break;
                        case 1:
                            stringVal = "na,me_" + i;
                            escapedVal = "\"na,me_" + i + "\"";
                            break;
                        case 2:
                            stringVal = "na\"me_" + i;
                            escapedVal = "\"na\"\"me_" + i + "\"";
                            break;
                        case 3:
                            stringVal = "na\rme_" + i;
                            escapedVal = "\"na\rme_" + i + "\"";
                            break;
                        case 4:
                            stringVal = "na\nme_" + i;
                            escapedVal = "\"na\nme_" + i + "\"";
                            break;
                    }
                } else {
                    int escapable = i % 5;
                    switch (escapable) {
                        case 0:
                            stringVal = "name_" + i;
                            escapedVal = "name_" + i;
                            break;
                        case 1:
                            stringVal = "na\tme_" + i;
                            escapedVal = "na\\tme_" + i;
                            break;
                        case 2:
                            stringVal = "na\nme_" + i;
                            escapedVal = "na\\nme_" + i;
                            break;
                        case 3:
                            stringVal = "na\rme_" + i;
                            escapedVal = "na\\rme_" + i;
                            break;
                        case 4:
                            stringVal = "na\\me_" + i;
                            escapedVal = "na\\\\me_" + i;
                            break;
                    }
                }
            } else {
                stringVal = "name_" + i;
            }

            Object[] row = new Object[] { i, stringVal, i, new Double(i) };
            if (sb != null) {
                sb.append(i).append(delimeter).append(escapedVal).append(delimeter);
                sb.append(i).append(delimeter).append(new Double(i).toString()).append('\n');
            }
            repl_table.addRow(row);
        }
        return repl_table;
    }
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.