use of com.facebook.presto.common.NotSupportedException in project presto by prestodb.
the class SimplePagesHashStrategy method positionEqualsPositionIgnoreNulls.
@Override
public boolean positionEqualsPositionIgnoreNulls(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition) {
for (int hashChannel : hashChannels) {
Type type = types.get(hashChannel);
List<Block> channel = channels.get(hashChannel);
Block leftBlock = channel.get(leftBlockIndex);
Block rightBlock = channel.get(rightBlockIndex);
try {
if (!type.equalTo(leftBlock, leftPosition, rightBlock, rightPosition)) {
return false;
}
} catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
}
return true;
}
use of com.facebook.presto.common.NotSupportedException in project presto by prestodb.
the class RowComparator method compare.
@Override
public int compare(Page leftRow, Page rightRow) {
for (int index = 0; index < sortChannels.size(); index++) {
Type type = sortTypes.get(index);
int channel = sortChannels.get(index);
SortOrder sortOrder = sortOrders.get(index);
Block left = leftRow.getBlock(channel);
Block right = rightRow.getBlock(channel);
int comparison;
try {
comparison = sortOrder.compareBlockValue(type, left, 0, right, 0);
} catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
if (comparison != 0) {
return comparison;
}
}
return 0;
}
use of com.facebook.presto.common.NotSupportedException in project presto by prestodb.
the class SimplePagesIndexComparator method compareTo.
@Override
public int compareTo(PagesIndex pagesIndex, int leftPosition, int rightPosition) {
AdaptiveLongBigArray valueAddresses = pagesIndex.getValueAddresses();
long leftPageAddress = valueAddresses.get(leftPosition);
long rightPageAddress = valueAddresses.get(rightPosition);
int leftBlockIndex = decodeSliceIndex(leftPageAddress);
int leftBlockPosition = decodePosition(leftPageAddress);
int rightBlockIndex = decodeSliceIndex(rightPageAddress);
int rightBlockPosition = decodePosition(rightPageAddress);
for (int i = 0; i < sortChannels.length; i++) {
int sortChannel = sortChannels[i];
SortOrder sortOrder = sortOrders[i];
Type sortType = sortTypes[i];
List<Block> indexChannel = pagesIndex.getChannel(sortChannel);
Block leftBlock = indexChannel.get(leftBlockIndex);
Block rightBlock = indexChannel.get(rightBlockIndex);
try {
int compare = sortOrder.compareBlockValue(sortType, leftBlock, leftBlockPosition, rightBlock, rightBlockPosition);
if (compare != 0) {
return compare;
}
} catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
}
return 0;
}
use of com.facebook.presto.common.NotSupportedException in project presto by prestodb.
the class MapElementAtFunction method elementAt.
@UsedByGeneratedCode
public static Object elementAt(MethodHandle keyNativeHashCode, MethodHandle keyBlockNativeEquals, MethodHandle keyBlockHashCode, Type valueType, Block map, long key) {
SingleMapBlock mapBlock = (SingleMapBlock) map;
int valuePosition;
try {
valuePosition = mapBlock.seekKeyExact(key, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode);
} catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
if (valuePosition == -1) {
return null;
}
return readNativeValue(valueType, mapBlock, valuePosition);
}
use of com.facebook.presto.common.NotSupportedException in project presto by prestodb.
the class MapElementAtFunction method elementAt.
@UsedByGeneratedCode
public static Object elementAt(MethodHandle keyNativeHashCode, MethodHandle keyBlockNativeEquals, MethodHandle keyBlockHashCode, Type valueType, Block map, boolean key) {
SingleMapBlock mapBlock = (SingleMapBlock) map;
int valuePosition;
try {
valuePosition = mapBlock.seekKeyExact(key, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode);
} catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
if (valuePosition == -1) {
return null;
}
return readNativeValue(valueType, mapBlock, valuePosition);
}
Aggregations