Package org.voltdb.VoltTable

Examples of org.voltdb.VoltTable.ColumnInfo


            fail("expected exception");
        } catch (IllegalArgumentException e) {}
    }

    public void testColumnByName() {
        t = new VoltTable(new ColumnInfo("foo", VoltType.STRING), new ColumnInfo("twofoo", VoltType.INTEGER));
        t.addRow("bar", 5);

        assertEquals(0, t.getColumnIndex("foo"));
        assertEquals(1, t.getColumnIndex("twofoo"));
        assertEquals(t.getColumnName(0).equals("foo"), true);
View Full Code Here


            fail("expected exception");
        } catch (IllegalArgumentException e) {}
    }

    public void testAddRow() {
        t = new VoltTable(new ColumnInfo("foo", VoltType.BIGINT));
        try {
            t.addRow(42L, 47L);
            fail("expected exception (1)");
        } catch (IllegalArgumentException e) {}
        try {
View Full Code Here

        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
View Full Code Here

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

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

        t2 = FastSerializableTestUtil.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 = FastSerializableTestUtil.roundTrip(t);
View Full Code Here

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

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

        t2 = FastSerializableTestUtil.roundTrip(t);
        assertEquals(8, t2.getRowCount());
        assertEquals(0, t2.fetchRow(1).getLong(0));
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(new Class[] { BigDecimal.class });

        t2 = FastSerializableTestUtil.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(new Class[]{ Long.class, Integer.class, Short.class,
                                      Byte.class, Double.class, Float.class });

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

        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) 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]);
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.