use of org.gridgain.internal.h2.value.Value in project ignite by apache.
the class GridH2KeyValueRowOnheap method getValue0.
/**
* Get real column value.
*
* @param col Adjusted column index (without default columns).
* @return Value.
*/
private Value getValue0(int col) {
Value v = getCached(col);
if (v != null)
return v;
Object res = desc.columnValue(key.getObject(), val.getObject(), col);
if (res == null)
v = ValueNull.INSTANCE;
else {
try {
v = desc.wrap(res, desc.fieldType(col));
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
setCached(col, v);
return v;
}
use of org.gridgain.internal.h2.value.Value in project ignite by apache.
the class InlineIndexHelperTest method getResBytes.
/**
*/
private boolean getResBytes(InlineIndexHelper ha, byte[] b1, byte[] b2) {
Value v1 = b1 == null ? ValueNull.INSTANCE : ValueBytes.get(b1);
Value v2 = b2 == null ? ValueNull.INSTANCE : ValueBytes.get(b2);
int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0));
return ha.canRelyOnCompare(c, v1, v2);
}
use of org.gridgain.internal.h2.value.Value in project ignite by apache.
the class InlineIndexHelperTest method getRes.
/**
*/
private boolean getRes(InlineIndexHelper ha, String s1, String s2) {
Value v1 = s1 == null ? ValueNull.INSTANCE : ValueString.get(s1);
Value v2 = s2 == null ? ValueNull.INSTANCE : ValueString.get(s2);
int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0));
return ha.canRelyOnCompare(c, v1, v2);
}
use of org.gridgain.internal.h2.value.Value in project ignite by apache.
the class H2Utils method convert.
/**
* Convert value to column's expected type by means of H2.
*
* @param val Source value.
* @param desc Row descriptor.
* @param type Expected column type to convert to.
* @return Converted object.
* @throws IgniteCheckedException if failed.
*/
public static Object convert(Object val, GridH2RowDescriptor desc, int type) throws IgniteCheckedException {
if (val == null)
return null;
int objType = DataType.getTypeFromClass(val.getClass());
if (objType == type)
return val;
Value h2Val = desc.wrap(val, objType);
return h2Val.convertTo(type).getObject();
}
use of org.gridgain.internal.h2.value.Value in project ignite by apache.
the class SqlSystemViewColumnCondition method forColumn.
/**
* Parse condition for column.
*
* @param colIdx Column index.
* @param start Start row values.
* @param end End row values.
*/
public static SqlSystemViewColumnCondition forColumn(int colIdx, SearchRow start, SearchRow end) {
boolean isEquality = false;
boolean isRange = false;
Value val = null;
Value val2 = null;
if (start != null && colIdx >= 0 && colIdx < start.getColumnCount())
val = start.getValue(colIdx);
if (end != null && colIdx >= 0 && colIdx < end.getColumnCount())
val2 = end.getValue(colIdx);
if (val != null && val2 != null) {
if (val.equals(val2))
isEquality = true;
else
isRange = true;
} else if (val != null || val2 != null)
isRange = true;
return new SqlSystemViewColumnCondition(isEquality, isRange, val);
}
Aggregations