use of io.trino.spi.function.OperatorMethodHandle in project trino by trinodb.
the class MapType method getHashCodeOperatorMethodHandle.
private static OperatorMethodHandle getHashCodeOperatorMethodHandle(TypeOperators typeOperators, Type keyType, Type valueType) {
MethodHandle keyHashCodeOperator = typeOperators.getHashCodeOperator(keyType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION));
MethodHandle valueHashCodeOperator = typeOperators.getHashCodeOperator(valueType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION));
return new OperatorMethodHandle(HASH_CODE_CONVENTION, HASH_CODE.bindTo(keyHashCodeOperator).bindTo(valueHashCodeOperator));
}
use of io.trino.spi.function.OperatorMethodHandle in project trino by trinodb.
the class MapType method getDistinctFromOperatorInvoker.
private static OperatorMethodHandle getDistinctFromOperatorInvoker(TypeOperators typeOperators, Type keyType, Type valueType) {
MethodHandle seekKey = MethodHandles.insertArguments(SEEK_KEY, 1, typeOperators.getEqualOperator(keyType, simpleConvention(NULLABLE_RETURN, BLOCK_POSITION, BLOCK_POSITION)), typeOperators.getHashCodeOperator(keyType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION)));
MethodHandle valueDistinctFromOperator = typeOperators.getDistinctFromOperator(valueType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION, BLOCK_POSITION));
return new OperatorMethodHandle(DISTINCT_FROM_CONVENTION, DISTINCT_FROM.bindTo(seekKey).bindTo(valueDistinctFromOperator));
}
use of io.trino.spi.function.OperatorMethodHandle in project trino by trinodb.
the class TypeOperators method defaultIndeterminateOperator.
//
// Generate default indeterminate
//
private static OperatorMethodHandle defaultIndeterminateOperator(Class<?> javaType) {
// boolean distinctFrom(T value, boolean valueIsNull)
// {
// return valueIsNull;
// }
MethodHandle methodHandle = MethodHandles.identity(boolean.class);
methodHandle = dropArguments(methodHandle, 0, javaType);
return new OperatorMethodHandle(simpleConvention(FAIL_ON_NULL, NULL_FLAG), methodHandle);
}
use of io.trino.spi.function.OperatorMethodHandle in project trino by trinodb.
the class MapType method getXxHash64OperatorMethodHandle.
private static OperatorMethodHandle getXxHash64OperatorMethodHandle(TypeOperators typeOperators, Type keyType, Type valueType) {
MethodHandle keyHashCodeOperator = typeOperators.getXxHash64Operator(keyType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION));
MethodHandle valueHashCodeOperator = typeOperators.getXxHash64Operator(valueType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION));
return new OperatorMethodHandle(HASH_CODE_CONVENTION, HASH_CODE.bindTo(keyHashCodeOperator).bindTo(valueHashCodeOperator));
}
use of io.trino.spi.function.OperatorMethodHandle in project trino by trinodb.
the class MapType method getEqualOperatorMethodHandle.
private static OperatorMethodHandle getEqualOperatorMethodHandle(TypeOperators typeOperators, Type keyType, Type valueType) {
MethodHandle seekKey = MethodHandles.insertArguments(SEEK_KEY, 1, typeOperators.getEqualOperator(keyType, simpleConvention(NULLABLE_RETURN, BLOCK_POSITION, BLOCK_POSITION)), typeOperators.getHashCodeOperator(keyType, simpleConvention(FAIL_ON_NULL, BLOCK_POSITION)));
MethodHandle valueEqualOperator = typeOperators.getEqualOperator(valueType, simpleConvention(NULLABLE_RETURN, BLOCK_POSITION, BLOCK_POSITION));
return new OperatorMethodHandle(EQUAL_CONVENTION, EQUAL.bindTo(seekKey).bindTo(valueEqualOperator));
}
Aggregations