@Udf
  public Integer least(@UdfParameter final Integer val, @UdfParameter final Integer... vals) {

    return (vals == null) ? null : Stream.concat(Stream.of(val), Arrays.stream(vals))
        .filter(Objects::nonNull)
        .min(Integer::compareTo)
        .orElse(null);
  }
@Test
  public void shouldWorkWithoutImplicitCasting() {
    assertThat(leastUDF.least(0, 1, -1, 2, -2), is(-2));
    assertThat(leastUDF.least(0L, 1L, -1L, 2L, -2L), is(-2L));
    assertThat(leastUDF.least(0D, .1, -.1, .2, -.2), is(-.2));
    assertThat(leastUDF.least(new BigDecimal("0"), new BigDecimal(".1"), new BigDecimal("-.1"), new BigDecimal(".2"), new BigDecimal("-.2")), is(new BigDecimal("-.2")));
    assertThat(leastUDF.least("apple", "banana", "aardvark"), is("aardvark"));
    assertThat(leastUDF.least(toBytes("apple"), toBytes("banana"), toBytes("aardvark")), is(toBytes("aardvark")));
    assertThat(leastUDF.least(new Date(10), new Date(0), new Date(-5), new Date(100), new Date(2)), is(new Date(-5)));
    assertThat(leastUDF.least(new Time(10), new Time(0), new Time(-5), new Time(100), new Time(2)), is(new Time(-5)));
    assertThat(leastUDF.least(new Timestamp(10), new Timestamp(0), new Timestamp(-5), new Timestamp(100), new Timestamp(2)), is(new Timestamp(-5)));
  }