@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 shouldReturnFirstNonNullEntity() {
    assertThat(udf.coalesce(1, 2, 3), is(1));
    assertThat(udf.coalesce(null, "a", "b", "c", "d"), is("a"));
    assertThat(udf.coalesce(null, ImmutableList.of(), null), is(ImmutableList.of()));
    assertThat(udf.coalesce(null, null, 1.0), is(1.0));
  }