@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 shouldHandleSomeNullColumns() {
    assertThat(leastUDF.least(null, 27, null, 39, -49, -11, 68, 32, null, 101), is(-49));
    assertThat(leastUDF.least(null, null, 39d, -49.01, -11.98, 68.1, .32, null, 101d), is(-49.01));
    assertThat(leastUDF.least(null, 272038202439L, null, 39L, -4923740932490L, -11L, 68L, 32L, null, 101L), is(-4923740932490L));
    assertThat(leastUDF.least(null, new BigDecimal("27"), null, new BigDecimal("-49")), is(new BigDecimal("-49")));
    assertThat(leastUDF.least(null, "apple", null, "banana", "kumquat", "aardvark", null), is("aardvark"));
    assertThat(leastUDF.least(null, toBytes("apple"), null, toBytes("banana"), toBytes("kumquat"), toBytes("aardvark"), null), is(toBytes("aardvark")));
    assertThat(leastUDF.least(null, new Date(10), null, new Date(0), new Date(-5), new Date(100), null, new Date(2)), is(new Date(-5)));
    assertThat(leastUDF.least(null, new Time(10), null, new Time(0), new Time(-5), new Time(100), null, new Time(2)), is(new Time(-5)));
    assertThat(leastUDF.least(null, new Timestamp(10), null, new Timestamp(0), new Timestamp(-5), new Timestamp(100), null, new Timestamp(2)), is(new Timestamp(-5)));
  }