@SuppressWarnings("varargs")
  @SafeVarargs
  @Udf
  public final <T> T coalesce(final T first, final T... others) {
    if (first != null) {
      return first;
    }

    if (others == null) {
      return null;
    }

    return Arrays.stream(others)
        .filter(Objects::nonNull)
        .findFirst()
        .orElse(null);
  }
@Test
  public void shouldReturnNullForEmptyOthers() {
    assertThat(udf.coalesce(null, new Double[]{}), is(nullValue()));
  }