private RowToRowCast() { super(CAST, ImmutableList.of(withVariadicBound("F", "row"), withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature("T"), ImmutableList.of(parseTypeSignature("F"))); }
private RowToRowCast() { super(CAST, ImmutableList.of(withVariadicBound("F", "row"), withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature("T"), ImmutableList.of(parseTypeSignature("F"))); }
private JsonToRowCast() { super(OperatorType.CAST, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature("T"), ImmutableList.of(parseTypeSignature(StandardTypes.JSON))); }
private RowToJsonCast() { super(OperatorType.CAST, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.JSON), ImmutableList.of(parseTypeSignature("T"))); }
private RowToJsonCast() { super(OperatorType.CAST, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature(StandardTypes.JSON), ImmutableList.of(parseTypeSignature("T"))); }
private JsonToRowCast() { super(OperatorType.CAST, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature("T"), ImmutableList.of(parseTypeSignature(StandardTypes.JSON))); }
private RowIndeterminateOperator() { super(INDETERMINATE, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), BOOLEAN.getTypeSignature(), ImmutableList.of(parseTypeSignature("T"))); }
private RowIndeterminateOperator() { super(INDETERMINATE, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), BOOLEAN.getTypeSignature(), ImmutableList.of(parseTypeSignature("T"))); }
private JsonStringToRowCast() { super(new Signature( JSON_STRING_TO_ROW_NAME, SCALAR, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature("T"), ImmutableList.of(parseTypeSignature(StandardTypes.VARCHAR)), false)); }
private JsonStringToRowCast() { super(new Signature( JSON_STRING_TO_ROW_NAME, SCALAR, ImmutableList.of(withVariadicBound("T", "row")), ImmutableList.of(), parseTypeSignature("T"), ImmutableList.of(parseTypeSignature(StandardTypes.VARCHAR)), false)); }
@Test public void testResolveFunctionWithVariadicBound() { assertThatResolveFunction() .among( functionSignature("bigint", "bigint", "bigint"), functionSignature( ImmutableList.of("T1", "T2", "T3"), "boolean", ImmutableList.of(Signature.withVariadicBound("T1", "decimal"), Signature.withVariadicBound("T2", "decimal"), Signature.withVariadicBound("T3", "decimal")))) .forParameters("unknown", "bigint", "bigint") .returns(functionSignature("bigint", "bigint", "bigint")); }
@Test public void testResolveFunctionWithVariadicBound() { assertThatResolveFunction() .among( functionSignature("bigint", "bigint", "bigint"), functionSignature( ImmutableList.of("T1", "T2", "T3"), "boolean", ImmutableList.of(Signature.withVariadicBound("T1", "decimal"), Signature.withVariadicBound("T2", "decimal"), Signature.withVariadicBound("T3", "decimal")))) .forParameters("unknown", "bigint", "bigint") .returns(functionSignature("bigint", "bigint", "bigint")); }
@Test public void testBindUnknownToVariadic() { Signature rowFunction = functionSignature() .returnType(parseTypeSignature(StandardTypes.BOOLEAN)) .argumentTypes(parseTypeSignature("T"), parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "row"))) .build(); assertThat(rowFunction) .boundTo("unknown", "row(a bigint)") .withCoercion() .produces(new BoundVariables( ImmutableMap.of("T", type("row(a bigint)")), ImmutableMap.of())); Signature arrayFunction = functionSignature() .returnType(parseTypeSignature(StandardTypes.BOOLEAN)) .argumentTypes(parseTypeSignature("T"), parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "array"))) .build(); assertThat(arrayFunction) .boundTo("unknown", "array(bigint)") .withCoercion() .produces(new BoundVariables( ImmutableMap.of("T", type("array(bigint)")), ImmutableMap.of())); }
@Test public void testBindUnknownToVariadic() { Signature rowFunction = functionSignature() .returnType(parseTypeSignature(StandardTypes.BOOLEAN)) .argumentTypes(parseTypeSignature("T"), parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "row"))) .build(); assertThat(rowFunction) .boundTo("unknown", "row(a bigint)") .withCoercion() .produces(new BoundVariables( ImmutableMap.of("T", type("row(a bigint)")), ImmutableMap.of())); Signature arrayFunction = functionSignature() .returnType(parseTypeSignature(StandardTypes.BOOLEAN)) .argumentTypes(parseTypeSignature("T"), parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "array"))) .build(); assertThat(arrayFunction) .boundTo("unknown", "array(bigint)") .withCoercion() .produces(new BoundVariables( ImmutableMap.of("T", type("array(bigint)")), ImmutableMap.of())); }
.returnType(parseTypeSignature(StandardTypes.BIGINT)) .argumentTypes(parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "map"))) .build(); .returnType(parseTypeSignature("bigint")) .argumentTypes(parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "decimal"))) .build();
.returnType(parseTypeSignature(StandardTypes.BIGINT)) .argumentTypes(parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "map"))) .build(); .returnType(parseTypeSignature("bigint")) .argumentTypes(parseTypeSignature("T")) .typeVariableConstraints(ImmutableList.of(withVariadicBound("T", "decimal"))) .build();