Examples of VoltTableRow


Examples of org.voltdb.VoltTableRow

                fail();
            }

            // verify that the row was updated
            final VoltTable[] result = client.callProcedure("Select", "ALLOW_NULLS", pkey.get()).getResults();
            final VoltTableRow row = result[0].fetchRow(0);
            for (int i=0; i < COLS; ++i) {
                final Object obj = row.get(i+1, m_types[i]);
                if (i == k) {
                    assertTrue(row.wasNull());
                }
                else {
                    assertTrue( comparisonHelper(obj, params[i+2], m_types[i]) );
                }
            }
View Full Code Here

Examples of org.voltdb.VoltTableRow

                fail();
            }

            // verify that the row was updated
            final VoltTable[] result = client.callProcedure("Select", "ALLOW_NULLS", pkey.get()).getResults();
            final VoltTableRow row = result[0].fetchRow(0);
            for (int i=0; i < COLS; ++i) {
                final Object obj = row.get(i+1, m_types[i]);
                assertTrue( comparisonHelper(obj, params[i+2], m_types[i]) );
            }
        }
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

            e.printStackTrace();
            fail();
        }

        VoltTable[] result = client.callProcedure("Select", "WITH_DEFAULTS", pkey.get()).getResults();
        VoltTableRow row = result[0].fetchRow(0);
        for (int i=0; i < COLS; ++i) {
            Object obj = row.get(i+1, m_types[i]);
            assertTrue( comparisonHelper(obj, params[i+2], m_types[i]) );
        }
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

            e.printStackTrace();
            fail();
        }

        VoltTable[] result = client.callProcedure("Select", "WITH_NULL_DEFAULTS", pkey.get()).getResults();
        VoltTableRow row = result[0].fetchRow(0);
        for (int i=0; i < COLS; ++i) {
            Object obj = row.get(i+1, m_types[i]);
            assertTrue( comparisonHelper(obj, params[i+2], m_types[i]) );
        }
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

            System.out.println("testInsertMaxValues: " + k + " MAX type is " + m_types[k]);
            params[0] = "NO_NULLS";
            client.callProcedure("Insert", params);
            // verify that the row was updated
            final VoltTable[] result = client.callProcedure("Select", "NO_NULLS", pkey.get()).getResults();
            final VoltTableRow row = result[0].fetchRow(0);
            for (int i=0; i < COLS; ++i) {
                final Object obj = row.get(i+1, m_types[i]);
                assertTrue (!row.wasNull());
                assertTrue( comparisonHelper(obj, params[i+2], m_types[i]) );
            }
        }
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

            System.out.println("testInsertMinValues: " + k + " MIN type is " + m_types[k]);
            params[0] = "NO_NULLS";
            client.callProcedure("Insert", params);
            final VoltTable[] result = client.callProcedure("Select", "NO_NULLS", pkey.get()).getResults();
            final VoltTableRow row = result[0].fetchRow(0);
            for (int i=0; i < COLS; ++i) {
                final Object obj = row.get(i+1, m_types[i]);
                assertTrue (!row.wasNull());
                assertTrue( comparisonHelper(obj, params[i+2], m_types[i]) );
            }
        }
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

        // select that same row again by primary key
        result = client.callProcedure("Select", "ALLOW_NULLS", 0).getResults();

        // and verify the row
        final VoltTableRow row = result[0].fetchRow(0);
        final BigDecimal bd = (row.getDecimalAsBigDecimal(11));
        assertTrue(comparisonHelper(m_minValues[10], bd, m_types[10]));
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

                timestamp, items, warehouses, quantities).getResults();

        // Now to check returns are correct. We assume that inserts and such
        // within the actual transaction went through since it didn't rollback
        // and error out.
        VoltTableRow customerData = neworder[0].fetchRow(0);
        VoltTableRow miscData = neworder[1].fetchRow(0);
        assertEquals("Name", customerData.getString("C_LAST"));
        assertEquals("GC", customerData.getString("C_CREDIT"));
        assertEquals(.13, customerData.getDouble("C_DISCOUNT"));
        assertEquals(W_TAX, miscData.getDouble("w_tax"));
        assertEquals(D_TAX, miscData.getDouble("d_tax"));
        assertEquals(21L, miscData.getLong("o_id"));
        final double AMOUNT = PRICE * (3 + 5 + 1) * (1 - C_DISCOUNT) * (1 + D_TAX + W_TAX);
        assertEquals(AMOUNT, miscData.getDouble("total"), 0.001);

        // Check each item
        VoltTable itemResults = neworder[2];
        assertEquals(quantities.length, itemResults.getRowCount());
        for (int i = 0; i < itemResults.getRowCount(); ++i) {
            VoltTableRow itemRow = itemResults.fetchRow(i);
            assertEquals("ITEM" + (i + 1), itemRow.getString("i_name"));
            //~ assertEquals(quantities[i], itemRow.getLong("));
            long expected = s_quantities[i] - quantities[i];
            if (expected < 10) expected += 91;
            assertEquals(expected, itemRow.getLong("s_quantity"));
            if (i == 1) {
                assertEquals("B", itemRow.getString("brand_generic"));
            } else {
                assertEquals("G", itemRow.getString("brand_generic"));
            }
            assertEquals(PRICE, itemRow.getDouble("i_price"));
            assertEquals(PRICE * quantities[i], itemRow.getDouble("ol_amount"));
        }

        // verify that stock was updated correctly
        VoltTable[] allTables = client.callProcedure("SelectAll").getResults();
        VoltTable stock = allTables[TPCDataPrinter.nameMap.get("STOCK")];
        for (int i = 0; i < stock.getRowCount(); ++i) {
            VoltTableRow stockRow = stock.fetchRow(i);
            assertEquals(INITIAL_S_YTD + i*10 + quantities[i], stockRow.getLong("S_YTD"));
            assertEquals(INITIAL_S_ORDER_CNT + i*10 + 1, stockRow.getLong("S_ORDER_CNT"));
        }

        // New order with a missing item
        items = new int[] { TPCCConstants.NUM_ITEMS + 1 };
        warehouses = new short[] { W_ID };
View Full Code Here

Examples of org.voltdb.VoltTableRow

        System.out.println("DATA after DELIVERY transaction");
        TPCDataPrinter.printAllData(client);

        assertEquals(1, results.length);
        assertEquals(1, results[0].getRowCount());
        VoltTableRow r = results[0].fetchRow(0);
        assertEquals(D_ID, r.getLong(0));
        assertEquals(O_ID, r.getLong(1));
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

        } catch (Exception e) {
            e.printStackTrace();
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = customers.fetchRow(index);
        final long c_id = customer.getLong(C_ID_IDX);

        voltQueueSQL(getWarehouse, W_ID);
        voltQueueSQL(getDistrict, W_ID, D_ID);
        final VoltTable[] results = voltExecuteSQL();
        final VoltTable warehouse = results[0];
        final VoltTable district = results[1];

        try {
            System.out.println("WAREHOUSE PRE: " + warehouse.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        voltQueueSQL(getWarehouses);
        VoltTable warehouses = voltExecuteSQL()[0];
        try {
            System.out.println("WAREHOUSE PRE: " + warehouses.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        voltQueueSQL(updateWarehouseBalance, paymentAmount, W_ID);
        voltQueueSQL(updateDistrictBalance, paymentAmount, W_ID, D_ID);
        voltExecuteSQL();

        voltQueueSQL(getWarehouses);
        warehouses = voltExecuteSQL()[0];
        try {
            System.out.println("WAREHOUSE PRE: " + warehouses.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        //do stuff to extract district and warehouse info.

        //customer info
        final byte[] c_first = customer.getStringAsBytes(C_FIRST_IDX);
        final byte[] c_middle = customer.getStringAsBytes(C_MIDDLE_IDX);
        final byte[] c_last = customer.getStringAsBytes(C_LAST_IDX);
        final byte[] c_street_1 = customer.getStringAsBytes(C_STREET_1_IDX);
        final byte[] c_street_2 = customer.getStringAsBytes(C_STREET_2_IDX);
        final byte[] c_city = customer.getStringAsBytes(C_CITY_IDX);
        final byte[] c_state = customer.getStringAsBytes(C_STATE_IDX);
        final byte[] c_zip = customer.getStringAsBytes(C_ZIP_IDX);
        final byte[] c_phone = customer.getStringAsBytes(C_PHONE_IDX);
        final TimestampType c_since = customer.getTimestampAsTimestamp(C_SINCE_IDX);
        final byte[] c_credit = customer.getStringAsBytes(C_CREDIT_IDX);
        final double c_credit_lim = customer.getDouble(C_CREDIT_LIM_IDX);
        final double c_discount = customer.getDouble(C_DISCOUNT_IDX);
        final double c_balance = customer.getDouble(C_BALANCE_IDX) - paymentAmount;
        final double c_ytd_payment = customer.getDouble(C_YTD_PAYMENT_IDX) + paymentAmount;
        final long c_payment_cnt = customer.getLong(C_PAYMENT_CNT_IDX) + 1;
        byte[] c_data;
        if (Arrays.equals(c_credit, TPCCConstants.BAD_CREDIT_BYTES)) {
            c_data = customer.getStringAsBytes(C_DATA_IDX);
            byte[] newData = (c_id + " " + D_ID + " " + W_ID + " " + D_ID + " " + W_ID  + " " + paymentAmount + "|").getBytes();

            int newLength = newData.length + c_data.length;
            if (newLength > TPCCConstants.MAX_C_DATA) {
                newLength = TPCCConstants.MAX_C_DATA;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.