Package org.voltdb

Examples of org.voltdb.VoltTable$Row


        assertEquals((long) TPCCConstants.DISTRICTS_PER_WAREHOUSE, mockClient.calledParameters[1]);
        assertEquals(72L, mockClient.calledParameters[2])// c_id
    }

    public void testDelivery() throws IOException {
        VoltTable orders = new VoltTable(
                new VoltTable.ColumnInfo("", VoltType.BIGINT)
        );
        for (int i = 0; i < TPCCConstants.DISTRICTS_PER_WAREHOUSE; ++i) {
            orders.addRow((long) i);
        }
        mockClient.nextResult = new VoltTable[]{ orders };
        client.m_tpccSim.doDelivery();
        assertEquals("delivery", mockClient.calledName);
        assertEquals(3, mockClient.calledParameters.length);
View Full Code Here


            }
        } // FOR
       
        // We should always get back the same handle each time.
        try {
            VoltTable result0 = this.ee.trackingReadSet(txnId);
            VoltTable result1 = this.ee.trackingReadSet(txnId);
            assert(result0 == result1);
        } finally {
            this.finishTxn(voltProc);
        }
    }
View Full Code Here

                expectedTables.add(tbl.getName());
            }
        } // FOR
       
        // Let's take a peek at its ReadSet
        VoltTable result = this.ee.trackingReadSet(txnId);
        assertNotNull(result);
        this.verifySchema(result);
        Set<String> foundTables = new HashSet<String>();
        while (result.advanceRow()) {
            String tableName = result.getString(0);
            int tupleId = (int)result.getLong(1);
            foundTables.add(tableName);
            assert(tupleId >= 0);
        } // WHILE
        this.finishTxn(voltProc);
        System.err.println("READ SET:\n" + VoltTableUtil.format(result));
View Full Code Here

                expectedTables.add(tbl.getName());
            }
        } // FOR
       
        // Let's take a peek at its WriteSet
        VoltTable result = this.ee.trackingWriteSet(txnId);
        assertNotNull(result);
        this.verifySchema(result);
        Set<String> foundTables = new HashSet<String>();
        while (result.advanceRow()) {
            String tableName = result.getString(0);
            int tupleId = (int)result.getLong(1);
            foundTables.add(tableName);
            assert(tupleId >= 0);
        } // WHILE
        this.finishTxn(voltProc);
        System.err.println("WRITE SET:\n" + VoltTableUtil.format(result));
View Full Code Here

//        m.put("Status", cresponse.getStatus());
//        m.put("Length", String.format("%d [bytes=%d]", cresponse.getResults().length, cresponse.getResultsSize()));
//        m.put("Results", StringUtil.join("\n", ));
        Map<String, Object> m = new LinkedHashMap<String, Object>();
        for (int i = 0; i < cresponse.getResults().length; i++) {
            VoltTable vt = cresponse.getResults()[i];
            m.put(String.format("  [%02d]", i), vt);
        } // FOR
       
        LOG.info(StringUtil.repeat("-", 50));
        LOG.info(String.format("%s Txn #%d - Status %s\n%s",
View Full Code Here

    // UTILITY METHODS
    // --------------------------------------------------------------------------------------------
   
    private void loadData() throws Exception {
        // Load in a bunch of dummy data for this table
        VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
        assertNotNull(vt);
        for (int i = 0; i < NUM_TUPLES; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
            row[0] = i; // OL_O_ID
            row[1] = (byte)i; // OL_D_ID
            row[2] = (short)i; // OL_W_ID
            vt.addRow(row);
        } // FOR
        this.executor.loadTable(1000l, catalog_tbl, vt, false);
       
        VoltTable stats[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, stats.length);
        System.err.println(VoltTableUtil.format(stats));
    }
View Full Code Here

        assertEquals(1, stats.length);
        System.err.println(VoltTableUtil.format(stats));
    }
   
    private VoltTable evictData() throws Exception {
        VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, results.length);
        // System.err.println(VoltTableUtil.format(results));
        for (String col : statsFields) {
      results[0].advanceRow();
            int idx = results[0].getColumnIndex(col);
            assertEquals(0, results[0].getLong(idx));   
        } // FOR
       
        // Now force the EE to evict our boys out
        // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
        VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 1024, 1);

        System.err.println("-------------------------------");
        System.err.println(VoltTableUtil.format(evictResult));
        assertNotNull(evictResult);
        assertEquals(1, evictResult.getRowCount());
        assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
        evictResult.resetRowPosition();
        boolean adv = evictResult.advanceRow();
        assertTrue(adv);
        return (evictResult);
    }
View Full Code Here

    private void simpleScan(String  procName, int expected, boolean useLimit) throws Exception {
        assert(expected <= NUM_TUPLES);
        this.loadData();
       
        // We should have all of our tuples evicted
        VoltTable evictResult = this.evictData();
        long evicted = evictResult.getLong("ANTICACHE_TUPLES_EVICTED");
        assertTrue("No tuples were evicted!\n"+evictResult, evicted > 0);
        // System.err.println(VoltTableUtil.format(evictResult));
       
        // Now execute a query that needs to access data from this block
        Procedure proc = this.getProcedure(procName); // Special Single-Stmt Proc
        ClientResponse cresponse = null;
        if (useLimit) {
            cresponse = this.client.callProcedure(proc.getName(), expected);
        } else {
            cresponse = this.client.callProcedure(proc.getName());
        }
        assertEquals(Status.OK, cresponse.getStatus());

        // Make sure that we tracked that we tried to touch evicted data
        assertEquals(1, this.profiler.evictedaccess_history.size());

        // And then check to make sure that we get the correct number of rows back
        VoltTable results[] = cresponse.getResults();
        System.err.println(VoltTableUtil.format(results[0]));
        assertEquals(1, results.length);
        assertEquals(expected, results[0].getRowCount());
    }
View Full Code Here

    private void scanWithParams(String  procName, int expected) throws Exception {
        assert(expected < NUM_TUPLES);
        this.loadData();
       
        // We should have all of our tuples evicted
        VoltTable evictResult = this.evictData();
        long evicted = evictResult.getLong("ANTICACHE_TUPLES_EVICTED");
        assertTrue("No tuples were evicted!\n"+evictResult, evicted > 0);
        // System.err.println(VoltTableUtil.format(evictResult));
       
        // Now execute a query that needs to access data from this block
        Procedure proc = this.getProcedure(procName); // Special Single-Stmt Proc
        Object params[] = { 1, 1, 1, expected };
        ClientResponse cresponse = this.client.callProcedure(proc.getName(), params);
        assertEquals(Status.OK, cresponse.getStatus());

        // Make sure that we tracked that we tried to touch evicted data
        assertEquals(1, this.profiler.evictedaccess_history.size());

        // And then check to make sure that we get the correct number of rows back
        VoltTable results[] = cresponse.getResults();
        System.err.println(VoltTableUtil.format(results[0]));
        assertEquals(1, results.length);
        assertEquals(expected, results[0].getRowCount());
    }
View Full Code Here

     * testEvictTuples
     */
    @Test
    public void testEvictTuples() throws Exception {
        this.loadData();
        VoltTable evictResult = this.evictData();
    evictResult.advanceRow();

        // Our stats should now come back with at least one block evicted
        VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, results.length);
        System.err.println("-------------------------------");
        System.err.println(VoltTableUtil.format(results));

    results[0].advanceRow();
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTable$Row

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.