Search in sources :

Example 1 with GridH2RowMessage

use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage in project ignite by apache.

the class GridH2IndexBase method toRow.

/**
     * @param msg Message.
     * @return Row.
     */
private Row toRow(GridH2RowMessage msg) {
    if (msg == null)
        return null;
    GridKernalContext ctx = kernalContext();
    List<GridH2ValueMessage> vals = msg.values();
    assert !F.isEmpty(vals) : vals;
    Value[] vals0 = new Value[vals.size()];
    for (int i = 0; i < vals0.length; i++) {
        try {
            vals0[i] = vals.get(i).value(ctx);
        } catch (IgniteCheckedException e) {
            throw new CacheException(e);
        }
    }
    return database.createRow(vals0, MEMORY_CALCULATE);
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CacheException(javax.cache.CacheException) GridKernalContext(org.apache.ignite.internal.GridKernalContext) GridH2ValueMessage(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage) Value(org.h2.value.Value)

Example 2 with GridH2RowMessage

use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage in project ignite by apache.

the class GridH2IndexBase method toRowMessage.

/**
     * @param row Row.
     * @return Row message.
     */
private GridH2RowMessage toRowMessage(Row row) {
    if (row == null)
        return null;
    int cols = row.getColumnCount();
    assert cols > 0 : cols;
    List<GridH2ValueMessage> vals = new ArrayList<>(cols);
    for (int i = 0; i < cols; i++) {
        try {
            vals.add(GridH2ValueMessageFactory.toMessage(row.getValue(i)));
        } catch (IgniteCheckedException e) {
            throw new CacheException(e);
        }
    }
    GridH2RowMessage res = new GridH2RowMessage();
    res.values(vals);
    return res;
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CacheException(javax.cache.CacheException) GridH2ValueMessage(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage) GridH2RowMessage(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage)

Example 3 with GridH2RowMessage

use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage in project ignite by apache.

the class GridH2IndexBase method toSearchRowMessage.

/**
     * @param row Search row.
     * @return Row message.
     */
private GridH2RowMessage toSearchRowMessage(SearchRow row) {
    if (row == null)
        return null;
    List<GridH2ValueMessage> vals = new ArrayList<>(indexColumns.length);
    for (IndexColumn idxCol : indexColumns) {
        Value val = row.getValue(idxCol.column.getColumnId());
        if (val == null)
            break;
        try {
            vals.add(GridH2ValueMessageFactory.toMessage(val));
        } catch (IgniteCheckedException e) {
            throw new CacheException(e);
        }
    }
    GridH2RowMessage res = new GridH2RowMessage();
    res.values(vals);
    return res;
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CacheException(javax.cache.CacheException) GridH2ValueMessage(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage) Value(org.h2.value.Value) GridH2RowMessage(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage) IndexColumn(org.h2.table.IndexColumn)

Example 4 with GridH2RowMessage

use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage in project ignite by apache.

the class GridH2IndexBase method toSearchRow.

/**
     * @param msg Row message.
     * @return Search row.
     */
private SearchRow toSearchRow(GridH2RowMessage msg) {
    if (msg == null)
        return null;
    GridKernalContext ctx = kernalContext();
    Value[] vals = new Value[getTable().getColumns().length];
    assert vals.length > 0;
    List<GridH2ValueMessage> msgVals = msg.values();
    for (int i = 0; i < indexColumns.length; i++) {
        if (i >= msgVals.size())
            continue;
        try {
            vals[indexColumns[i].column.getColumnId()] = msgVals.get(i).value(ctx);
        } catch (IgniteCheckedException e) {
            throw new CacheException(e);
        }
    }
    return database.createRow(vals, MEMORY_CALCULATE);
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CacheException(javax.cache.CacheException) GridKernalContext(org.apache.ignite.internal.GridKernalContext) Value(org.h2.value.Value) GridH2ValueMessage(org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage)

Aggregations

CacheException (javax.cache.CacheException)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 GridH2ValueMessage (org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage)4 Value (org.h2.value.Value)3 GridKernalContext (org.apache.ignite.internal.GridKernalContext)2 GridH2RowMessage (org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage)2 IndexColumn (org.h2.table.IndexColumn)1