You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by "rdblue (via GitHub)" <gi...@apache.org> on 2023/05/02 17:50:30 UTC

[GitHub] [parquet-mr] rdblue commented on a diff in pull request #1084: PARQUET-2276: Bring back support for Hadoop 2.7.3

rdblue commented on code in PR #1084:
URL: https://github.com/apache/parquet-mr/pull/1084#discussion_r1182862929


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HadoopStreams.java:
##########
@@ -37,6 +41,39 @@ public class HadoopStreams {
 
   private static final Logger LOG = LoggerFactory.getLogger(HadoopStreams.class);
 
+  private static final Class<?> byteBufferReadableClass = getReadableClass();
+  static final Constructor<SeekableInputStream> h2SeekableConstructor = getH2SeekableConstructor();

Review Comment:
   Rather than using two static methods, you can use `DynConstructors` instead to make this one expression and reduce error handling code:
   
   ```java
   private static final DynConstructors.Ctor<SeekableInputStream> h2streamCtor =
       DynConstructors.Builder(SeekableInputStream.class)
       .impl("org.apache.parquet.hadoop.util.H2SeekableInputStream", FSDataInputStream.class)
       .orNull()
       .build()
   
   ...
   if (h2streamCtor != null) {
     return h2streamCtor.newInstance(stream);
   }
   ```



-- 
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-unsubscribe@parquet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org