@Udf
  public <T> List<T> slice(
      @UdfParameter(description = "the input array")  final List<T> in,
      @UdfParameter(description = "start index")      final Integer from,
      @UdfParameter(description = "end index")        final Integer to) {
    if (in == null) {
      return null;
    }

    try {
      // SQL systems are usually 1-indexed and are inclusive of end index
      final int start = from == null ? 0 : from - 1;
      final int end = to == null ? in.size() : to;
      return in.subList(start, end);
    } catch (final IndexOutOfBoundsException e) {
      return null;
    }
  }
@Test
  public void shouldHandleIntegers() {
    // Given:
    final List<Integer> list = Lists.newArrayList(1, 2, 3);

    // When:
    final List<Integer> slice = new Slice().slice(list, 2, 2);

    // Then:
    assertThat(slice, is(Lists.newArrayList(2)));
  }