private RowHashCodeOperator() { super(HASH_CODE, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BIGINT), ImmutableList.of(parseTypeSignature("T"))); }
private RowHashCodeOperator() { super(HASH_CODE, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BIGINT), ImmutableList.of(parseTypeSignature("T"))); }
private RowDistinctFromOperator() { super(IS_DISTINCT_FROM, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BOOLEAN), ImmutableList.of(parseTypeSignature("T"), parseTypeSignature("T"))); }
private RowNotEqualOperator() { super(NOT_EQUAL, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BOOLEAN), ImmutableList.of(parseTypeSignature("T"), parseTypeSignature("T"))); }
private RowEqualOperator() { super(EQUAL, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BOOLEAN), ImmutableList.of(parseTypeSignature("T"), parseTypeSignature("T"))); }
private RowEqualOperator() { super(EQUAL, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BOOLEAN), ImmutableList.of(parseTypeSignature("T"), parseTypeSignature("T"))); }
private RowNotEqualOperator() { super(NOT_EQUAL, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BOOLEAN), ImmutableList.of(parseTypeSignature("T"), parseTypeSignature("T"))); }
private RowDistinctFromOperator() { super(IS_DISTINCT_FROM, ImmutableList.of(comparableWithVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.BOOLEAN), ImmutableList.of(parseTypeSignature("T"), parseTypeSignature("T"))); }
@Test public void testTypeParameters() throws Throwable { Signature signature = Signature.builder() .name("foo") .kind(SCALAR) .typeVariableConstraints(comparableWithVariadicBound("V", VARCHAR)) .returnType(parseTypeSignature("V")) .argumentTypes(parseTypeSignature("V")) .build(); SqlScalarFunction function = SqlScalarFunction.builder(TestMethods.class) .signature(signature) .deterministic(true) .choice(choice -> choice .implementation(methodsGroup -> methodsGroup.methods("varcharToVarchar"))) .build(); ScalarFunctionImplementation functionImplementation = function.specialize(BOUND_VARIABLES, 1, TYPE_REGISTRY, REGISTRY); Slice slice = (Slice) functionImplementation.getMethodHandle().invoke(INPUT_SLICE); assertEquals(slice, VARCHAR_TO_VARCHAR_RETURN_VALUE); }
@Test public void testTypeParameters() throws Throwable { Signature signature = Signature.builder() .name("foo") .kind(SCALAR) .typeVariableConstraints(comparableWithVariadicBound("V", VARCHAR)) .returnType(parseTypeSignature("V")) .argumentTypes(parseTypeSignature("V")) .build(); SqlScalarFunction function = SqlScalarFunction.builder(TestMethods.class) .signature(signature) .deterministic(true) .choice(choice -> choice .implementation(methodsGroup -> methodsGroup.methods("varcharToVarchar"))) .build(); ScalarFunctionImplementation functionImplementation = function.specialize(BOUND_VARIABLES, 1, TYPE_REGISTRY, REGISTRY); Slice slice = (Slice) functionImplementation.getMethodHandle().invoke(INPUT_SLICE); assertEquals(slice, VARCHAR_TO_VARCHAR_RETURN_VALUE); }