@Udf
  public <T> List<T> intersect(
      @UdfParameter(description = "First array of values") final List<T> left,
      @UdfParameter(description = "Second array of values") final List<T> right) {
    if (left == null || right == null) {
      return null;
    }
    final Set<T> intersection = Sets.newLinkedHashSet(left);
    intersection.retainAll(Sets.newHashSet(right));
    return Lists.newArrayList(intersection);
  }
@Test
  public void shouldIntersectArraysBothContainingNulls() {
    final List<String> input1 = Arrays.asList(null, "foo", "bar");
    final List<String> input2 = Arrays.asList("foo", null);
    final List<String> result = udf.intersect(input1, input2);
    assertThat(result, contains((String) null, "foo"));
  }