@Udf(description = "When filtering a map, "
      + "the function provided must have a boolean result. "
      + "For each map entry, the function will be applied to the "
      + "key and value arguments in that order. The filtered map is returned."
  )
  public <K, V> Map<K, V> filterMap(
      @UdfParameter(description = "The map") final Map<K, V> map,
      @UdfParameter(description = "The lambda function") final BiFunction<K, V, Boolean> biFunction
  ) {
    if (map == null || biFunction == null) {
      return null;
    }

    return map.entrySet()
        .stream()
        .filter(e -> biFunction.apply(e.getKey(), e.getValue()))
        .collect(Collectors.toMap(Entry::getKey, Entry::getValue));
  }
@Test
  public void shouldThrowErrorOnNullMapInput() {
    final Map<Integer, Integer> m1 = new HashMap<>();
    m1.put(null, 4);
    final Map<String, String> m2 = new HashMap<>();
    m2.put("nope", null);
    assertThrows(NullPointerException.class, () -> udf.filterMap(m1, biFunction1()));
    assertThrows(NullPointerException.class, () -> udf.filterMap(m2, biFunction2()));
  }