use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage 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);
}
use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage 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;
}
use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage 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;
}
use of org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessage 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);
}
Aggregations