Package org.voltdb.VoltTable

Examples of org.voltdb.VoltTable.ColumnInfo


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

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

        t2 = FastSerializableTestUtil.roundTrip(t);
        assertEquals(9, t2.getRowCount());
        assertEquals(0L, t2.fetchRow(1).getTimestampAsTimestamp(0).getTime());
View Full Code Here


        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(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(-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

        }
        assertEquals(10, rowcount);
    }

    public void testStupidAdvanceRowUse() {
        VoltTable table = new VoltTable(new ColumnInfo("foo", VoltType.BIGINT));
        table.addRow(5);
        // try to access value without calling advanceRow
        try {
            table.getLong(0);
            fail();
View Full Code Here

        VoltType types[] = { VoltType.TINYINT, VoltType.STRING, VoltType.INTEGER,
                           VoltType.BIGINT, VoltType.FLOAT, VoltType.SMALLINT, VoltType.TIMESTAMP,
                           VoltType.DECIMAL, VoltType.TINYINT };

        VoltTable tt = new VoltTable(
            new ColumnInfo("tinyint",   types[0]),
            new ColumnInfo("string",    types[1]),
            new ColumnInfo("integer",   types[2]),
            new ColumnInfo("bigint",    types[3]),
            new ColumnInfo("float",     types[4]),
            new ColumnInfo("smallint",  types[5]),
            new ColumnInfo("timestamp", types[6]),
            new ColumnInfo("decimal",   types[7]),
            new ColumnInfo("tinyint",   types[0]));

        for (int i=0; i < content.length; ++i) {
            Object[] vals = new Object[content.length];;
            for (int k=0; k < content.length; k++) {
                if (i == k)
View Full Code Here

     * @param vts
     * @return
     */
    public static VoltTable combineTables(final VoltTable... vts) {
        assert (vts.length > 0);
        ColumnInfo cols[] = new ColumnInfo[vts[0].getColumnCount()];
        for (int i = 0; i < cols.length; i++) {
            cols[i] = new ColumnInfo(vts[0].getColumnName(i), vts[0].getColumnType(i));
        } // FOR

        VoltTable ret = new VoltTable(cols);
        for (VoltTable vt : vts) {
            assert (vt.getColumnCount() == ret.getColumnCount());
View Full Code Here

        int stmt_partition = CollectionUtil.first(p.get(table_key));
        assert(stmt_partition >= 0) : "Invalid Partition: " + p.get(table_key);
       
        // Now create VoltTable and test that
        VoltTable vt = new VoltTable(new ColumnInfo[] {
            new ColumnInfo(catalog_col0.getName(), VoltType.get(catalog_col0.getType())),   // D_ID
            new ColumnInfo(catalog_col1.getName(), VoltType.get(catalog_col1.getType())),   // D_W_ID
        });
        vt.addRow(params[0], params[1]);
        VoltTableRow vt_row = vt.fetchRow(0);
        int vt_partition = p_estimator.getTableRowPartition(catalog_tbl, vt_row);
        assert(vt_partition >= 0) : "Invalid Partition: " + vt_partition;
View Full Code Here

    public MemoryStatsPrinter(Client client, File outputPath) {
        this.client = client;
        this.outputPath = outputPath;
       
        List<VoltTable.ColumnInfo> temp = new ArrayList<VoltTable.ColumnInfo>();
        temp.add(new ColumnInfo("INTERVAL", VoltType.INTEGER));
        temp.add(new ColumnInfo("ELAPSED", VoltType.BIGINT));
        temp.add(new ColumnInfo("TIMESTAMP", VoltType.BIGINT));
        CollectionUtil.addAll(temp, MemoryStats.COLUMNS);
        this.columns = temp.toArray(new ColumnInfo[0]);
    }
View Full Code Here

               
                while (vt.advanceRow()) {
                    if (colOffsets == null) {
                        colOffsets = new int[MemoryStats.COLUMNS.length];
                        for (int i = 0; i < MemoryStats.COLUMNS.length; i++) {
                            ColumnInfo col = MemoryStats.COLUMNS[i];
                            colOffsets[i] = vt.getColumnIndex(col.getName());
                        } // FOR
                    }
                    for (int offset : colOffsets) {
                        totals[offset] += vt.getLong(offset);
                    } // FOR
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.