public SqlType getExpressionSqlType(final Expression expression) {
    return getExpressionSqlType(expression, Collections.emptyMap());
  }
@Test
  public void shouldEvaluateAnyNumberOfArgumentLambda() {
    // Given:
    givenUdfWithNameAndReturnType("TRANSFORM", SqlTypes.STRING);
    when(function.parameters()).thenReturn(
        ImmutableList.of(
            ArrayType.of(DoubleType.INSTANCE),
            StringType.INSTANCE,
            MapType.of(LongType.INSTANCE, DoubleType.INSTANCE),
            LambdaType.of(
                ImmutableList.of(
                    DoubleType.INSTANCE,
                    StringType.INSTANCE,
                    LongType.INSTANCE,
                    DoubleType.INSTANCE
                ),
                StringType.INSTANCE)));

    final Expression expression =
        new FunctionCall(
            FunctionName.of("TRANSFORM"),
            ImmutableList.of(
                ARRAYCOL,
                new StringLiteral("Q"),
                MAPCOL,
                new LambdaFunctionCall(
                    ImmutableList.of("A", "B", "C", "D"),
                    new ArithmeticBinaryExpression(
                        Operator.ADD,
                        new LambdaVariable("C"),
                        new IntegerLiteral(5))
                )));

    // When:
    final SqlType exprType = expressionTypeManager.getExpressionSqlType(expression);

    // Then:
    assertThat(exprType, is(SqlTypes.STRING));
    verify(udfFactory).getFunction(
        ImmutableList.of(
            SqlArgument.of(SqlTypes.array(SqlTypes.DOUBLE)),
            SqlArgument.of(SqlTypes.STRING),
            SqlArgument.of(SqlTypes.map(SqlTypes.BIGINT, SqlTypes.DOUBLE)),
            SqlArgument.of(SqlLambda.of(4))));
    verify(function).getReturnType(
        ImmutableList.of(
            SqlArgument.of(SqlTypes.array(SqlTypes.DOUBLE)),
            SqlArgument.of(SqlTypes.STRING),
            SqlArgument.of(SqlTypes.map(SqlTypes.BIGINT, SqlTypes.DOUBLE)),
            SqlArgument.of(SqlLambdaResolved
                .of(ImmutableList.of(SqlTypes.DOUBLE, SqlTypes.STRING, SqlTypes.BIGINT, SqlTypes.DOUBLE), SqlTypes.BIGINT))));
  }