Examples of VoltTableRow


Examples of org.voltdb.VoltTableRow

                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");
            }
            assert ol_total > 0.0;

            voltQueueSQL(updateCustomer, ol_total, c_id, d_id, W_ID);

            final Long no_o_id = no_o_ids[(int) d_id - 1];
            result.addRow(d_id, no_o_id);
        }
        voltExecuteSQL();

        VoltTableRow r = result.fetchRow(0);
        assert(D_ID == r.getLong(0));
        assert(O_ID == r.getLong(1));

        return null;
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

            map.put(key, new Object[row_count]);

        // for update, delete, insert, keys is empty
        if (keys.length > 0) {
            for (int i = 0; i < row_count; i++) {
                VoltTableRow row = table.fetchRow(i);
                for (int j = 0; j < keys.length; j++) {
                    Object[] vals = map.get(keys[j]);
                    Object ref = value_refs[j];
                    if (ref instanceof Integer) {
                        // ref is column_index
                        vals[i] = row.get(j, table.getColumnType(j));
                    } else {
                        assert (ref instanceof String);
                        int idx = table.getColumnIndex((String) ref);
                        if (idx >= 0) {
                            // ref is column_name
                            vals[i] = row.get(idx, table.getColumnType(idx));
                        } else {
                            // ref is key_name
                            if (map.get(ref).length == 1) {
                                vals[i] = map.get(ref)[0];
                            } else {
View Full Code Here

Examples of org.voltdb.VoltTableRow

        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;
        assertEquals(stmt_partition, vt_partition);
    }
View Full Code Here

Examples of org.voltdb.VoltTableRow

        } // FOR
        assertEquals(num_rows, vt.getRowCount());
       
        vt.resetRowPosition();
        while (vt.advanceRow()) {
            VoltTableRow row = vt.getRow();
            long w_id = row.getLong(catalog_col.getIndex());
            int p = p_estimator.getTableRowPartition(catalog_tbl, row);
            assert(p >= 0 && p <= NUM_PARTITIONS);
           
            Integer last = expected.get(w_id);
            assertNotNull(last);
View Full Code Here

Examples of org.voltdb.VoltTableRow

        } // FOR
        assertEquals(num_rows, vt.getRowCount());
       
        vt.resetRowPosition();
        while (vt.advanceRow()) {
            VoltTableRow row = vt.getRow();
           
            String w_name = row.getString(catalog_col.getIndex());
            int name_p = p_estimator.getHasher().hash(w_name);
            assert(name_p >= 0 && name_p <= NUM_PARTITIONS);
           
            int row_p = p_estimator.getTableRowPartition(catalog_tbl, row);
            assert(row_p >= 0 && row_p <= NUM_PARTITIONS);
View Full Code Here

Examples of org.voltdb.VoltTableRow

                                foundFullRowset = true;
                            }

                            // write out the rows
                            for (intCounter = 0; intCounter < rowCount; intCounter++) {
                                VoltTableRow row = vtArchiveVisits[0].fetchRow(intCounter);
                                playerId = row.getLong(0);
                                gameId = row.getLong(1);
                                socialId = row.getLong(2);
                                clientId = row.getLong(3);
                                visitTime = row.getLong(4);

                                Date visitDate = new Date(visitTime);

                                new PrintStream(fout).print(playerId + "\t" + gameId + "\t" + socialId + "\t" + clientId + "\t" + visitDate + "\n");
                            }
View Full Code Here

Examples of org.voltdb.VoltTableRow

        int sqlStatements = 0;

        if (rowCount > 0) {
            // move row from unarchived to archived
            for (int ii = 0; ii < rowCount; ii++) {
                VoltTableRow row = results1[0].fetchRow(ii);
                long column1 = row.getLong(0);
                long column2 = row.getLong(1);
                long column3 = row.getLong(2);
                long column4 = row.getLong(3);
                long checktime = row.getLong(4);

                voltQueueSQL(insertArchived, column1, column2, column3, column4, checktime);
                voltQueueSQL(deleteUnArchived, column1, column2, column3, column4, checktime);

                sqlStatements += 2;
View Full Code Here

Examples of org.voltdb.VoltTableRow

        int sqlStatements = 0;

        if (rowCount > 0) {
            // delete rows
            for (int ii = 0; ii < rowCount; ii++) {
                VoltTableRow row = results1[0].fetchRow(ii);
                long column1 = row.getLong(0);
                long column2 = row.getLong(1);
                long column3 = row.getLong(2);
                long column4 = row.getLong(3);
                long checkTimeLong = row.getLong(4);

                voltQueueSQL(deleteArchived, column1, column2, column3, column4, checkTimeLong);

                sqlStatements++;
View Full Code Here

Examples of org.voltdb.VoltTableRow

                VoltTable[] res = voltExecuteSQL();
               
                // we do not need to retrieve settlement here
                VoltTable trade = res[0];
                assert trade.getRowCount() == 1;
                VoltTableRow trade_row = trade.fetchRow(0);
               
                is_cash[i] = (int)trade_row.getLong("T_IS_CASH");
                is_market[i] = (int)trade_row.getLong("TT_IS_MRKT");
               
                if (is_cash[i] == 1) {
                    voltQueueSQL(getCashTransaction, trade_ids[i]);
                }
               
                voltQueueSQL(getTradeHistory, trade_ids[i]);
                voltExecuteSQL();
            }
           
            // results
            result = trade_update_ret_template_frame1.clone(256);
            for (int i = 0; i < max_trades; i++) {
                result.addRow(is_cash[i], is_market[i]);
            }
        }
        else if (frame_to_execute == 2) {
            voltQueueSQL(getTrade2, acct_id, "CMPT", start_trade_dts, end_trade_dts);
            VoltTable trades = voltExecuteSQL()[0];
           
            result = trade_update_ret_template_frame2.clone(256);
            int num_updated = 0;
           
            for (int i = 0; i < trades.getRowCount(); i++) {
                VoltTableRow trade_row = trades.fetchRow(i);
               
                long trade_id = trade_row.getLong("T_ID");
                int is_cash = (int)trade_row.getLong("T_IS_CASH");
               
                if (num_updated < max_updates) {
                    voltQueueSQL(getCashType, trade_id);
                    VoltTable cash = voltExecuteSQL()[0];
                   
                    assert cash.getRowCount() == 1;
                    String cash_type = cash.fetchRow(0).getString("SE_CASH_TYPE");
                   
                    if (is_cash == 1) {
                        if (cash_type.equals("Cash Account")) {
                            cash_type = "Cash";
                        }
                        else {
                            cash_type = "Cash Account";
                        }
                    }
                    else {
                        if (cash_type.equals("Margin Account")) {
                            cash_type = "Margin";
                        }
                        else {
                            cash_type = "Margin Account";
                        }
                       
                    }
                   
                    voltQueueSQL(updateSettlement, cash_type, trade_id);
                    voltExecuteSQL();
                    num_updated++;
                }
               
                voltQueueSQL(getSettlement, trade_id);
                if (is_cash == 1) {
                    voltQueueSQL(getCashTransaction, trade_id);
                }
                voltQueueSQL(getTradeHistory, trade_id);
                voltExecuteSQL();               
               
                result.addRow(is_cash, trade_id);              
            }
        }
        else if (frame_to_execute == 3) {
            voltQueueSQL(getTradeTradeTypeSecurity, symbol, "CMPT", start_trade_dts, end_trade_dts);
            VoltTable trades = voltExecuteSQL()[0];
           
            result = trade_update_ret_template_frame3.clone(128);
            int num_updated = 0;
            Pattern p = Pattern.compile(".* shares of .*");
           
            for (int i = 0; i < trades.getRowCount(); i++) {
                VoltTableRow trade_row = trades.fetchRow(i);
               
                long trade_id = trade_row.getLong("T_ID");
                int is_cash = (int)trade_row.getLong("T_IS_CASH");
                String type_name = trade_row.getString("TT_NAME");
                String s_name = trade_row.getString("S_NAME");
                int quantity = (int)trade_row.getLong("T_QTY");
               
                voltQueueSQL(getSettlement, trade_id);
                voltExecuteSQL(); // don't need the result
               
                if (is_cash == 1) {
View Full Code Here

Examples of org.voltdb.VoltTableRow

        // we need only the first table
        VoltTable ts = voltExecuteSQL()[0];
        VoltTable result = trade_status_ret_template.clone(256);
       
        for (int i = 0; i < ts.getRowCount(); i++) {
            VoltTableRow ts_row = ts.fetchRow(i);
           
            String status_name = ts_row.getString("ST_NAME");
            long trade_id = ts_row.getLong("T_ID");
           
            result.addRow(status_name, trade_id);
        }
       
        return new VoltTable[] {result};
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.