rdblue commented on code in PR #1084: URL: https://github.com/apache/parquet-mr/pull/1084#discussion_r1186279000
########## parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HadoopStreams.java: ########## @@ -55,23 +95,31 @@ public static SeekableInputStream wrap(FSDataInputStream stream) { /** * Is the inner stream byte buffer readable? - * The test is "the stream is not FSDataInputStream + * The test is 'the stream is not FSDataInputStream * and implements ByteBufferReadable' * * That is: all streams which implement ByteBufferReadable - * other than FSDataInputStream successfuly support read(ByteBuffer). - * This is true for all filesytem clients the hadoop codebase. + * other than FSDataInputStream successfully support read(ByteBuffer). + * This is true for all filesystem clients the hadoop codebase. * * In hadoop 3.3.0+, the StreamCapabilities probe can be used to * check this: only those streams which provide the read(ByteBuffer) * semantics MAY return true for the probe "in:readbytebuffer"; * FSDataInputStream will pass the probe down to the underlying stream. * * @param stream stream to probe - * @return true if it is safe to a H2SeekableInputStream to access the data + * @return true if it is safe to a H2SeekableInputStream to access + * the data, null when it cannot be determined because of missing hasCapabilities */ - private static boolean isWrappedStreamByteBufferReadable(FSDataInputStream stream) { - if (stream.hasCapability("in:readbytebuffer")) { + private static Boolean isWrappedStreamByteBufferReadable(FSDataInputStream stream) { + if (hasCapabilitiesMethod.isNoop()) { + // When the method is not available, just return a null + return null; + } + + Boolean hasCapabilities = hasCapabilitiesMethod.invoke(stream, "in:readbytebuffer"); Review Comment: Is this a boxed boolean? If so, should we update the check to handle null? -- 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