theosib-amazon commented on code in PR #960: URL: https://github.com/apache/parquet-mr/pull/960#discussion_r934673092
########## parquet-common/src/main/java/org/apache/parquet/bytes/SingleBufferInputStream.java: ########## @@ -88,6 +136,21 @@ public long skip(long n) { return bytesToSkip; } + @Override + public void skipFully(long n) throws IOException { + if (n < 0 || n > Integer.MAX_VALUE) { + throw new IllegalArgumentException(); + } + + try { + buffer.position(buffer.position() + (int)n); + } catch (IllegalArgumentException e) { Review Comment: I already don't like the fact that I have to check the argument to make sure it's not negative and not bigger than int max. buffer.positiion() already checks for the position going out of bounds and throws an exception, so it would be redundant to have another check for the exact same thing here. A catch for an exception that never happens is basically always free, while a test for a condition that never happens is not free until profiling gets enough info about it for the C2 compiler to eliminate it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@parquet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org