If I understand your problem correctly you could write a custom iterator. I had a similiar issue some time ago in the beginnings of the new java API and solved it like this: https://github.com/stratosphere/stratosphere/blob/440e73fda7374fe064bcb23dfb343637f21b18b3/stratosphere-java/src/main/java/eu/stratosphere/api/java/operators/translation/PeekingTupleUnwrappingIterator.java