当前位置: 首页>>代码示例>>Java>>正文


Java VoltTableRow.get方法代码示例

本文整理汇总了Java中org.voltdb.VoltTableRow.get方法的典型用法代码示例。如果您正苦于以下问题:Java VoltTableRow.get方法的具体用法?Java VoltTableRow.get怎么用?Java VoltTableRow.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.VoltTableRow的用法示例。


在下文中一共展示了VoltTableRow.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compare

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
@Override
public int compare(Object arg0, Object arg1) {
    VoltTableRow r1 = (VoltTableRow)arg0;
    VoltTableRow r2 = (VoltTableRow)arg1;

    String r1d1 = (String) r1.get(0, VoltType.STRING);
    String r1d2 = (String) r1.get(1, VoltType.STRING);
    String r2d1 = (String) r2.get(0, VoltType.STRING);
    String r2d2 = (String) r2.get(1, VoltType.STRING);

    int r1d1_pos = Integer.valueOf(r1d1.substring(3));
    int r1d2_pos = Integer.valueOf(r1d2.substring(3));
    int r2d1_pos = Integer.valueOf(r2d1.substring(3));
    int r2d2_pos = Integer.valueOf(r2d2.substring(3));

    System.out.printf("comparing (%s, %s) to (%s, %s)\n",
            r1d1, r1d2, r2d1, r2d2);

    if (r1d1_pos != r2d1_pos)
        return r1d1_pos - r2d1_pos;

    if (r1d2_pos != r2d2_pos)
        return r1d2_pos - r2d2_pos;

    return 0;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:27,代码来源:TestPlansGroupBySuite.java

示例2: setOutput

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public void setOutput(VoltTable...output) {
    if (output == null || output.length == 0) return;
    this.output = new Object[output.length][][];
    
    this.output_types = new VoltType[output.length][];
    for (int i = 0; i < this.output.length; i++) {
        VoltTable vt = output[i];
        if (vt == null) continue;
        
        // TYPES
        this.output_types[i] = new VoltType[vt.getColumnCount()];
        for (int k = 0; k < this.output_types[i].length; k++) {
            this.output_types[i][k] = vt.getColumnType(k);
        } // FOR
        
        // DATA
        this.output[i] = new Object[vt.getRowCount()][vt.getColumnCount()];
        int j = 0;
        while (vt.advanceRow()) {
            VoltTableRow row = vt.getRow();
            for (int k = 0; k < this.output[i][j].length; k++) {
                this.output[i][j][k] = row.get(k); 
            } // FOR (columns)
            j++;
        } // WHILE (rows)
    } // FOR (tables)
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:AbstractTraceElement.java

示例3: pickRandomVal

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
private Object pickRandomVal(VoltTable table, Column col)
{
    int size = table.getRowCount();
    int i_row = RandUtil.randLong(0, size - 1).intValue();
    VoltTableRow row = table.fetchRow(i_row);
    return row.get(col.getIndex(), VoltType.get((byte) col.getType()));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:8,代码来源:AbstractLoader.java

示例4: debug

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
private void debug(ArrayList<VoltTableRow> sorted) {
    for (VoltTableRow row : sorted) {
        String d1 = (String) row.get(0, VoltType.STRING);
        String d2 = (String) row.get(1, VoltType.STRING);
        System.out.println("Row: " + d1 + ", " + d2);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:8,代码来源:TestPlansGroupBySuite.java

示例5: testInsertMaxValues_No_Nulls

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public void testInsertMaxValues_No_Nulls()
throws NoConnectionsException, ProcCallException, IOException
{
    final Client client = this.getClient();

    // Insert a MAX value for each column. For the first
    // row, insert MAX in the first column, for the 5th row
    // in the 5 column, etc.

    final Object params[] = new Object[COLS + 2];

    for (int k=0; k < COLS; ++k) {

        // build the parameter list as described above
        params[0] = "";
        params[1] = pkey.incrementAndGet();
        for (int i = 0; i < COLS; i++) {
            params[i+2] = (i == k) ? m_maxValues[i] : m_midValues[i];
            assert(params[i+2] != null);
        }

        // Perform the inserts and execute selects, verifying the
        // content of the select matches the parameters passed to
        // insert

        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]) );
        }
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:39,代码来源:TestSQLTypesSuite.java

示例6: testInsertMinValues_No_Nulls

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public void testInsertMinValues_No_Nulls()
    throws NoConnectionsException, ProcCallException, IOException
{
    final Client client = this.getClient();

    // Insert a MIN value for each column. For the first
    // row, insert null in the first column, for the 5th row
    // in the 5 column, etc.

    final Object params[] = new Object[COLS + 2];

    for (int k=0; k < COLS; ++k) {

        // build the parameter list as described above
        params[0] = "";
        params[1] = pkey.incrementAndGet();
        for (int i = 0; i < COLS; i++) {
            params[i+2] = (i == k) ? m_minValues[i] : m_midValues[i];
            assert(params[i+2] != null);
        }

        // Perform the inserts and execute selects, verifying the
        // content of the select matches the parameters passed to
        // insert

        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]) );
        }
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:TestSQLTypesSuite.java

示例7: execute

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
/**
     * Execute stmt with args, and put result, which is an array of columns,
     * into map
     * 
     * @param map
     *            the container of results of executing stmt
     * @param sp
     *            the store procedure that executes stmt
     * @param stmt
     *            the SQLStmt to be executed
     * @param args
     *            the argument needed by stmt
     * @param keys
     *            the names of columns in map
     * @param value_refs
     *            the references of values matching the keys. Each reference is
     *            one of {column_index, column_name, key_name}
     * @return the size of the first VoltTable among the array of VoltTable
     *         returned by executing stmt
     */
    public static int execute(Map<String, Object[]> map, VoltProcedure sp, SQLStmt stmt, Object[] args, String[] keys, Object[] value_refs) {
        LOG.info("Executing SQL: " + stmt);
System.out.println("ProcedureUtil line 97: " + args.length);
        String debug = "PARAMS:";
        for (Object arg : args) {
            debug += " " + arg;
        }
        LOG.info(debug);

        sp.voltQueueSQL(stmt, args);
        VoltTable table = sp.voltExecuteSQL()[0];
        System.out.println(table);

        if (keys == null) {
            assert (value_refs == null);
            return -1;
        }

        assert (keys.length == value_refs.length);

        int row_count = table.getRowCount();
System.out.println("ProcedureUtil line 116: " + row_count);
        // each key corresponds to a column of length row_count
        for (String key : keys)
            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 {
                                vals[i] = map.get(ref)[i];
                            }
                        }
                    }
                }
            }
        }

        return row_count;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:78,代码来源:ProcedureUtil.java


注:本文中的org.voltdb.VoltTableRow.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。