Package org.voltdb.VoltTable

Examples of org.voltdb.VoltTable.ColumnInfo


        t = new VoltTable(new VoltTable.ColumnInfo("Test2", VoltType.BIGINT));
        t.addRow(5L);
        assertFalse(LONG_FIVE.equals(t));

        // Different number of columns
        t = new VoltTable(new ColumnInfo("Test", VoltType.BIGINT),
                new ColumnInfo("Test2", VoltType.BIGINT));
        assertFalse(LONG_FIVE.equals(t));
        t.addRow(5L, 10L);
        assertFalse(LONG_FIVE.equals(t));

        // These are the same table
        t = new VoltTable(new ColumnInfo("Test", VoltType.BIGINT));
        t.addRow(5L);
        assertEquals(LONG_FIVE, t);

        // Test two tables with strings
        t = new VoltTable(new VoltTable.ColumnInfo("Foo", VoltType.STRING));
View Full Code Here


        boolean equal = t.equals(t2);
        assertTrue(equal);
    }

    public void testStrings() {
        t = new VoltTable(new ColumnInfo("", VoltType.STRING));
        addAllPrimitives(t, new Class[] { String.class, byte[].class });
        t.addRow("");
        assertEquals("string", t.fetchRow(1).getString(0));

        t2 = roundTrip(t);
View Full Code Here

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

    public void testStringsAsBytes() {
        t = new VoltTable(new ColumnInfo("", VoltType.STRING));
        t.addRow(new byte[0]);
        final byte[] FOO = new byte[] { 'f', 'o', 'o' };
        t.addRow(FOO);

        t2 = roundTrip(t);
View Full Code Here

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

    public void testVarbinary() {
        t = new VoltTable(new ColumnInfo("", VoltType.VARBINARY));
        final byte[] empty = new byte[0];
        t.addRow(empty);
        final byte[] FOO = new byte[] { 'f', 'o', 'o' };
        t.addRow(FOO);
View Full Code Here

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

    public void testIntegers() {
        t = new VoltTable(new ColumnInfo("foo", VoltType.BIGINT));
        addAllPrimitives(t, new Class[] { Long.class, Integer.class, Short.class,
                Byte.class, Double.class, Float.class });

        t2 = roundTrip(t);
        assertEquals(8, t2.getRowCount());
View Full Code Here

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

    public void testExactTypes() {
        VoltTable basecase = new VoltTable(new ColumnInfo("foo",
                VoltType.DECIMAL));
        basecase.addRow(new BigDecimal(7654321)
                .setScale(VoltDecimalHelper.kDefaultScale));
        VoltTableRow basecaserow = basecase.fetchRow(0);
        BigDecimal bd = basecaserow.getDecimalAsBigDecimal(0);
        assertEquals(bd,
                new BigDecimal(7654321)
                        .setScale(VoltDecimalHelper.kDefaultScale));

        t = new VoltTable(new ColumnInfo("foo", VoltType.DECIMAL));
        addAllPrimitives(t, new Class[] { BigDecimal.class });

        t2 = roundTrip(t);
        assertEquals(2, t2.getRowCount());
View Full Code Here

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

    public void testFloats() {
        t = new VoltTable(new ColumnInfo("foo", VoltType.FLOAT));
        addAllPrimitives(t, new Class[] { Long.class, Integer.class, Short.class,
                Byte.class, Double.class, Float.class });

        t2 = roundTrip(t);
        assertEquals(8, t2.getRowCount());
View Full Code Here

                VoltType.INTEGER, VoltType.BIGINT, VoltType.FLOAT,
                VoltType.DECIMAL, VoltType.TIMESTAMP, VoltType.STRING };

        for (int i = 0; i < types.length; ++i) {
            for (int j = 0; j < types.length; ++j) {
                VoltTable table = new VoltTable(new ColumnInfo("test_table",
                        types[i]));
                table.addRow(types[j].getNullValue());
                VoltTableRow row = table.fetchRow(0);
                row.get(0, types[i]);
                assertTrue("Value wasn't null", row.wasNull());
View Full Code Here

                        ((long) Short.MIN_VALUE) - 1 },
                { (long) Integer.MAX_VALUE, ((long) Integer.MAX_VALUE) + 1,
                        ((long) Integer.MIN_VALUE) - 1 } };

        for (int i = 0; i < test_types.length; ++i) {
            t = new VoltTable(new ColumnInfo("test_table", test_types[i]));
            t.addRow(test_vals[i][0]);
            boolean caught = false;
            try {
                t.addRow(test_vals[i][1]);
            } catch (VoltTypeException e) {
View Full Code Here

            assertTrue("Failed on: " + test_types[i].toString(), caught);
        }
    }

    public void testTimestamps() {
        t = new VoltTable(new ColumnInfo("foo", VoltType.TIMESTAMP));
        addAllPrimitives(t, new Class[] { Byte.class, Short.class, Integer.class,
                Long.class, Float.class, Double.class, TimestampType.class });

        t2 = roundTrip(t);
        assertEquals(9, t2.getRowCount());
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.