@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 shouldReturnFilteredArray() {
    assertThat(udf.filterArray(Collections.emptyList(), function1()), is(Collections.emptyList()));
    assertThat(udf.filterArray(Arrays.asList(1, 2, 3, 4), function1()), is(Arrays.asList(1, 3)));
    assertThat(udf.filterArray(Arrays.asList(15, 4, 7, -9), function1()), is(Arrays.asList(15, 7, -9)));

    assertThat(udf.filterArray(Collections.emptyList(), function1()), is(Collections.emptyList()));
    assertThat(udf.filterArray(Arrays.asList("bowow", "hello", "goodbye", "wowowo"), function2()), is(Arrays.asList("bowow", "wowowo")));
    assertThat(udf.filterArray(Arrays.asList("woow", "", "wwow"), function2()), is(Collections.singletonList("wwow")));
  }