Package org.voltdb

Examples of org.voltdb.VoltTableRow


                                             aggs[i], table, table);
                VoltTable[] results = client.callProcedure("@AdHoc", query).getResults();
                if (aggs[i].equals("count")) {
                    assertEquals(0, results[0].asScalarLong());
                } else {
                    final VoltTableRow row = results[0].fetchRow(0);
                    row.get(0, results[0].getColumnType(0));
                    if (!isHSQL()) {
                        assertTrue(row.wasNull());
                    }
                }
            }
            // Do avg separately since the column is a float and makes
            // asScalarLong() unhappy
View Full Code Here


    }

    public VoltTable[] run(short w_id, byte d_id, double h_amount, short c_w_id, byte c_d_id, int c_id, TimestampType timestamp) {
        // assert (w_id == c_w_id); cross partition should be supported (at least in future)
        voltQueueSQL(getCustomersByCustomerId, c_id, c_d_id, c_w_id);
        final VoltTableRow customer = voltExecuteSQL()[0].fetchRow(0);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
View Full Code Here

            throw new VoltAbortException("no customers with last name: " + c_last_str + " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = customers.fetchRow(index);
        final int c_id = (int)customer.getLong(C_ID_IDX);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
View Full Code Here

                    " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = customers.fetchRow(index);
        final int c_id = (int)customer.getLong(C_ID_IDX);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
View Full Code Here

        VoltTable customer = itemresults[item_id.length + 2];

        final double w_tax = itemresults[item_id.length].fetchRow(0).getDouble(0);
        final int D_TAX_COL = 0, D_NEXT_O_ID = 1;
        final int C_DISCOUNT = 0;
        final VoltTableRow tempRow = itemresults[item_id.length + 1].fetchRow(0);
        final double d_tax = tempRow.getDouble(D_TAX_COL);
        final double c_discount = itemresults[item_id.length + 2].fetchRow(0).getDouble(C_DISCOUNT);
        final long d_next_o_id = tempRow.getLong(D_NEXT_O_ID);
        final long ol_cnt = item_id.length;
        final long all_local = isAllLocal ? 1 : 0;

        voltQueueSQL(incrementNextOrderId, d_next_o_id + 1, d_id, w_id);
        voltQueueSQL(createOrder, d_next_o_id, d_id, w_id, c_id, timestamp,
                Constants.NULL_CARRIER_ID, ol_cnt, all_local);
        voltQueueSQL(createNewOrder, d_next_o_id, d_id, w_id);
        voltExecuteSQL();

        // values the client is missing: i_name, s_quantity, brand_generic, i_price, ol_amount
        final VoltTable item_data = item_data_template.clone(2048);

        double total = 0;
        for (int i = 0; i < item_id.length; ++i) {
            final long ol_supply_w_id = supware[i];
            final long ol_i_id = item_id[i];

            // One getStockInfo SQL statement for each district
            voltQueueSQL(getStockInfo[d_id-1], ol_i_id, ol_supply_w_id);
        }
        final VoltTable[] stockresults = voltExecuteSQL();
        assert stockresults.length == item_id.length;

        for (int i = 0; i < item_id.length; ++i) {
            final long ol_number = i + 1;
            final long ol_supply_w_id = supware[i];
            final long ol_i_id = item_id[i];
            final long ol_quantity = quantity[i];

            assert stockresults[i].getRowCount() == 1 : "Cannot find stock info for item; should not happen with valid database";
            final VoltTableRow itemInfo = items[i];
            final VoltTableRow stockInfo = stockresults[i].fetchRow(0);

            final int I_PRICE = 0, I_NAME = 1, I_DATA = 2;
            final byte[] i_name = itemInfo.getStringAsBytes(I_NAME);
            final byte[] i_data = itemInfo.getStringAsBytes(I_DATA);
            final double i_price = itemInfo.getDouble(I_PRICE);

            final int S_QUANTITY = 0, S_DATA = 1, S_YTD = 2, S_ORDER_CNT = 3, S_REMOTE_CNT = 4, S_DIST_XX = 5;
            long s_quantity = stockInfo.getLong(S_QUANTITY);
            long s_ytd = stockInfo.getLong(S_YTD);
            long s_order_cnt = stockInfo.getLong(S_ORDER_CNT);
            long s_remote_cnt = stockInfo.getLong(S_REMOTE_CNT);
            final byte[] s_data = stockInfo.getStringAsBytes(S_DATA);
            // Fetches data from the s_dist_[d_id] column
            final byte[] s_dist_xx = stockInfo.getStringAsBytes(S_DIST_XX);

            // Update stock
            s_ytd += ol_quantity;
            if (s_quantity >= ol_quantity + 10) {
                s_quantity = s_quantity - ol_quantity;
View Full Code Here

                continue;
            }
            assert otherresults[resultoffset + 0].getRowCount() == 1;
            assert otherresults[resultoffset + 1].getRowCount() == 1;
            final long c_id = (otherresults[resultoffset + 0].asScalarLong());
            final VoltTableRow row = otherresults[resultoffset + 1].fetchRow(0);
            final double ol_total = row.getDouble(0);
            final boolean ol_total_wasnull = row.wasNull();

            // If there are no order lines, SUM returns null. There should always be order lines.
            if (ol_total_wasnull) {
                throw new VoltAbortException(
                        "ol_total is NULL: there are no order lines. This should not happen");
View Full Code Here

    }

    public VoltTable[] run(short w_id, byte d_id, double h_amount, short c_w_id, byte c_d_id, int c_id, TimestampType timestamp) {
        // assert (w_id == c_w_id); cross partition should be supported (at least in future)
        voltQueueSQL(getCustomersByCustomerId, c_id, c_d_id, c_w_id);
        final VoltTableRow customer = voltExecuteSQL()[0].fetchRow(0);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
View Full Code Here

                    + " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = result.fetchRow(index);

        final long c_id = customer.getLong(0);
        return processPayment(w_id, d_id, h_amount, c_w_id, c_d_id, c_id, timestamp);
    }
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTableRow

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.