use of org.apache.ignite.internal.cache.query.index.sorted.keys.IndexKey in project ignite by apache.
the class H2RowComparator method compareKey.
/**
* {@inheritDoc}
*/
@Override
public int compareKey(long pageAddr, int off, int maxSize, IndexKey key, InlineIndexKeyType type) {
int cmp = super.compareKey(pageAddr, off, maxSize, key, type);
if (cmp != COMPARE_UNSUPPORTED)
return cmp;
int objType = key == NullIndexKey.INSTANCE ? type.type() : key.type();
int highOrder = Value.getHigherOrder(type.type(), objType);
// H2 supports comparison between different types after casting them to single type.
if (highOrder != objType && highOrder == type.type()) {
Value va = DataType.convertToValue(ses, key.key(), highOrder);
va = va.convertTo(highOrder);
IndexKey objHighOrder = IndexKeyFactory.wrap(va.getObject(), highOrder, coctx, keyTypeSettings);
InlineIndexKeyType highType = InlineIndexKeyTypeRegistry.get(objHighOrder, highOrder, keyTypeSettings);
// The only way to invoke inline comparison again.
if (highType != null)
return ((NullableInlineIndexKeyType) highType).compare0(pageAddr, off, objHighOrder);
}
return COMPARE_UNSUPPORTED;
}
use of org.apache.ignite.internal.cache.query.index.sorted.keys.IndexKey in project ignite by apache.
the class H2TreeIndex method preparePlainIndexKey.
/**
*/
private IndexRow preparePlainIndexKey(SearchRow row, InlineIndexRowHandler rowHnd) {
int idxColsLen = indexColumns.length;
IndexKey[] keys = row == null ? null : new IndexKey[idxColsLen];
for (int i = 0; i < idxColsLen; ++i) {
int colId = indexColumns[i].column.getColumnId();
Value v = row.getValue(colId);
keys[i] = v == null ? null : IndexKeyFactory.wrap(v.getObject(), v.getType(), cctx.cacheObjectContext(), queryIndex.keyTypeSettings());
}
return new IndexSearchRowImpl(keys, rowHnd);
}
Aggregations