@Udf(description = "When filtering an array, "
      + "the function provided must have a boolean result. "
      + "The function is applied to each value in the array "
      + "and a filtered array is returned."
  )
  public <T> List<T> filterArray(
      @UdfParameter(description = "The array") final List<T> array,
      @UdfParameter(description = "The lambda function") final Function<T, Boolean> function
  ) {
    if (array == null || function == null) {
      return null;
    }
    return array.stream().filter(function::apply).collect(Collectors.toList());
  }
@Test
  public void shouldThrowErrorOnNullArrayInput() {
    assertThrows(NullPointerException.class, () -> udf.filterArray(Collections.singletonList(null), function1()));
    assertThrows(NullPointerException.class, () -> udf.filterArray(Collections.singletonList(null), function2()));
  }