Package org.voltdb.VoltTable

Examples of org.voltdb.VoltTable.ColumnInfo


        t2.clearRowData();
        assertTrue(t2.getRowCount() == 0);
    }

    public void testAddRowExceptionSafe() {
        t = new VoltTable(new ColumnInfo("foo", VoltType.BIGINT),
                new ColumnInfo("bar", VoltType.STRING), new ColumnInfo("baz",
                        VoltType.BIGINT));

        t.addRow(0L, "a", 1L);
        try {
            t.addRow(42L, "", "bad");
View Full Code Here


        assertEquals("b", t.fetchRow(1).getString(1));
        assertEquals(3L, t.fetchRow(1).getLong(2));
    }

    public void testClone() {
        VoltTable item_data_template = new VoltTable(new ColumnInfo("i_name",
                VoltType.STRING),
                new ColumnInfo("s_quantity", VoltType.BIGINT), new ColumnInfo(
                        "brand_generic", VoltType.STRING), new ColumnInfo(
                        "i_price", VoltType.FLOAT), new ColumnInfo("ol_amount",
                        VoltType.FLOAT));
        VoltTable item_data = item_data_template.clone(1024);
        assertEquals(5, item_data.getColumnCount());
        assertEquals("i_name", item_data.getColumnName(0));
        assertEquals("s_quantity", item_data.getColumnName(1));
View Full Code Here

        assertEquals(VoltType.FLOAT, item_data.getColumnType(4));
        item_data.addRow("asdfsdgfsdg", 123L, "a", 45.0d, 656.2d);
    }

    public void testGetSchema() {
        VoltTable item_data_template = new VoltTable(new ColumnInfo("i_name",
                VoltType.STRING),
                new ColumnInfo("s_quantity", VoltType.BIGINT), new ColumnInfo(
                        "brand_generic", VoltType.STRING), new ColumnInfo(
                        "i_price", VoltType.FLOAT), new ColumnInfo("ol_amount",
                        VoltType.FLOAT));
        ColumnInfo[] cols = item_data_template.getTableSchema();
        assertEquals(5, cols.length);
        assertEquals("i_name", cols[0].name);
        assertEquals("s_quantity", cols[1].name);
View Full Code Here

        assertEquals(-1, empty.getActiveRowIndex());
        assertFalse(empty.advanceRow());

        // Make a table with info to iterate

        t = new VoltTable(new ColumnInfo("foo", VoltType.BIGINT),
                new ColumnInfo("bar", VoltType.STRING));
        for (int i = 0; i < 10; i++) {
            t.addRow(i, String.valueOf(i));
        }

        int rowcount = 0;
View Full Code Here

    public VoltTable run(long id, String desc) {
        if (id != 1 || !desc.equals("haha")) {
            throw new VoltAbortException();
        }

        VoltTable result = new VoltTable(new ColumnInfo("txnId", VoltType.BIGINT),
                                         new ColumnInfo("timestamp", VoltType.BIGINT));
        result.addRow(getVoltPrivateRealTransactionIdDontUseMe(), getUniqueId());

        // replicated txns get their results replaced by a hash... so stash this here
        setAppStatusString(result.toJSONString());
        return result;
View Full Code Here

        for (int i = 0; i <= Byte.MAX_VALUE; i++) {
            sum += countForCid(i);
        }

        VoltTable t = new VoltTable(
                new ColumnInfo("ts", VoltType.BIGINT),
                new ColumnInfo("count", VoltType.BIGINT));

        t.addRow(latest, sum);
        return t;
    }
View Full Code Here

            "UPDATE rejected_votes_by_phone_number " +
            "SET rejected_votes = rejected_votes + 1 " +
            "WHERE phone_number = ?;");

    public VoltTable[] run(long phoneNumber, int contestantNumber, long maxVotesPerPhoneNumber) {
        VoltTable result = new VoltTable(new ColumnInfo("STATUS", VoltType.BIGINT),
                                         new ColumnInfo("REJECTED", VoltType.BIGINT));

        // Queue up validation statements
        voltQueueSQL(checkContestantStmt, EXPECT_ZERO_OR_ONE_ROW, contestantNumber);
        voltQueueSQL(checkVoterStmt, EXPECT_ZERO_OR_ONE_ROW, phoneNumber);
        voltQueueSQL(checkStateStmt, EXPECT_ZERO_OR_ONE_ROW, (short)(phoneNumber / 10000000l));
View Full Code Here

        assertEquals(drStatsInvoked, 1);
    }

    @Test
    public void testLoadSinglePartTable() throws Exception {
        VoltTable table = new VoltTable(new ColumnInfo("i", VoltType.INTEGER));
        table.addRow(1);

        byte[] partitionParam = {0, 0, 0, 0, 0, 0, 0, 4};
        ByteBuffer msg = createMsg("@LoadSinglepartitionTable", partitionParam, "a", table);
        readAndCheck(msg, "@LoadSinglepartitionTable", partitionParam, false, true);
View Full Code Here

        // Return the deterministic values.
        // Replication should check to make sure they're the same
        // from all replicas.
        VoltTable retval = new VoltTable(
                new ColumnInfo("date", VoltType.BIGINT),
                new ColumnInfo("rand", VoltType.BIGINT));
        retval.addRow(deterDate, randNo);
        return retval;
    }
View Full Code Here

public class TestVoltTableUtil extends Mockito {
    @Test
    public void testCSVNullConversion() throws IOException {
        CSVWriter writer = mock(CSVWriter.class);
        ColumnInfo[] columns = new ColumnInfo[] {new ColumnInfo("", VoltType.BIGINT),
                                                 new ColumnInfo("", VoltType.FLOAT),
                                                 new ColumnInfo("", VoltType.DECIMAL),
                                                 new ColumnInfo("", VoltType.STRING),
                                                 new ColumnInfo("", VoltType.TIMESTAMP),
                                                 new ColumnInfo("", VoltType.VARBINARY)};
        ArrayList<VoltType> columnTypes = new ArrayList<VoltType>();
        VoltTable vt = new VoltTable(columns);
        vt.addRow(VoltType.NULL_BIGINT,
                  VoltType.NULL_FLOAT,
                  VoltType.NULL_DECIMAL,
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTable.ColumnInfo

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.