The ret.set(i, BytesRefWritable.ZeroBytesRefWritable); in RCFile.java:1273 seems unnecessary here since when the BytesRefArrayWritable is constructed each member is initialized as the same value as BytesRefWritable.ZeroBytesRefWritable. So as long as the list of projected columns do not change during the table scan iterator RCFileRecord.next(), we don't need to set this values.
The reason I'm kind of picky about this small thing is that the CPU cost could be a huge difference by maintaining reasonable invariants (assertions) during the two nested loops (over rows and over columns) and removing unnecessary code or reducing number of loops. The code inside the loop/iterator should be really lean and only do the absolutely necessary things. In my test, these simple changes reduce the iterator fetch time from 5 sec to less than 1 sec, and about 15% - 20% overall query performance.
In this case the invariant is that the projected columns do not change during the table scan. Please let me know if you think there are cases that break the invariant. I'll revert the changes.