Search in sources :

Example 6 with OperatorMethodHandle

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));
}
Also used : OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle) MethodHandle(java.lang.invoke.MethodHandle) OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle)

Example 7 with OperatorMethodHandle

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));
}
Also used : OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle) MethodHandle(java.lang.invoke.MethodHandle) OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle)

Example 8 with OperatorMethodHandle

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);
}
Also used : OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle) MethodHandle(java.lang.invoke.MethodHandle) OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle)

Example 9 with OperatorMethodHandle

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));
}
Also used : OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle) MethodHandle(java.lang.invoke.MethodHandle) OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle)

Example 10 with OperatorMethodHandle

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));
}
Also used : OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle) MethodHandle(java.lang.invoke.MethodHandle) OperatorMethodHandle(io.trino.spi.function.OperatorMethodHandle)

Aggregations

OperatorMethodHandle (io.trino.spi.function.OperatorMethodHandle)13 MethodHandle (java.lang.invoke.MethodHandle)13 StandardErrorCode (io.trino.spi.StandardErrorCode)5 TrinoException (io.trino.spi.TrinoException)5 Block (io.trino.spi.block.Block)5 BlockBuilder (io.trino.spi.block.BlockBuilder)5 BlockBuilderStatus (io.trino.spi.block.BlockBuilderStatus)5 RowBlockBuilder (io.trino.spi.block.RowBlockBuilder)5 ConnectorSession (io.trino.spi.connector.ConnectorSession)5 InvocationConvention (io.trino.spi.function.InvocationConvention)5 BLOCK_POSITION (io.trino.spi.function.InvocationConvention.InvocationArgumentConvention.BLOCK_POSITION)5 BOXED_NULLABLE (io.trino.spi.function.InvocationConvention.InvocationArgumentConvention.BOXED_NULLABLE)5 NEVER_NULL (io.trino.spi.function.InvocationConvention.InvocationArgumentConvention.NEVER_NULL)5 FAIL_ON_NULL (io.trino.spi.function.InvocationConvention.InvocationReturnConvention.FAIL_ON_NULL)5 NULLABLE_RETURN (io.trino.spi.function.InvocationConvention.InvocationReturnConvention.NULLABLE_RETURN)5 InvocationConvention.simpleConvention (io.trino.spi.function.InvocationConvention.simpleConvention)5 ROW (io.trino.spi.type.StandardTypes.ROW)5 NULL_HASH_CODE (io.trino.spi.type.TypeUtils.NULL_HASH_CODE)5 FALSE (java.lang.Boolean.FALSE)5 TRUE (java.lang.Boolean.TRUE)5