[ 
https://issues.apache.org/jira/browse/PARQUET-2374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17787360#comment-17787360
 ] 

ASF GitHub Bot commented on PARQUET-2374:
-----------------------------------------

parthchandra commented on code in PR #1187:
URL: https://github.com/apache/parquet-mr/pull/1187#discussion_r1397755380


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java:
##########
@@ -125,10 +125,20 @@ public class ParquetFileReader implements Closeable {
 
   public static String PARQUET_READ_PARALLELISM = 
"parquet.metadata.read.parallelism";
 
+  public ParquetMetricsCallback metricsCallback;

Review Comment:
   No we don't. Made it private



##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ColumnChunkPageReadStore.java:
##########
@@ -80,10 +80,12 @@ static final class ColumnChunkPageReader implements 
PageReader {
     private final byte[] dataPageAAD;
     private final byte[] dictionaryPageAAD;
 
+    ParquetMetricsCallback metricsCallback;

Review Comment:
   Changed



##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java:
##########
@@ -1841,8 +1851,12 @@ public void addChunk(ChunkDescriptor descriptor) {
      * @throws IOException if there is an error while reading from the stream
      */
     public void readAll(SeekableInputStream f, ChunkListBuilder builder) 
throws IOException {
+      long seekStart = System.nanoTime();

Review Comment:
   Right. Generally, seeks (especially backwards) cause the file system to stop 
their read-ahead and turn off sequential read optimizations. The seek call 
itself doesn't take much time. 



##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java:
##########
@@ -125,10 +125,20 @@ public class ParquetFileReader implements Closeable {
 
   public static String PARQUET_READ_PARALLELISM = 
"parquet.metadata.read.parallelism";
 
+  public ParquetMetricsCallback metricsCallback;
+
   private final ParquetMetadataConverter converter;
 
   private final CRC32 crc;
 
+
+  /**
+   * set a callback to send back metrics info
+   */
+  public synchronized void initMetrics(ParquetMetricsCallback callback) {

Review Comment:
   My mistake. I initially implemented the metrics callback as a singleton. The 
method no longer needs to be synchronized. 





> Add metrics support for parquet file reader
> -------------------------------------------
>
>                 Key: PARQUET-2374
>                 URL: https://issues.apache.org/jira/browse/PARQUET-2374
>             Project: Parquet
>          Issue Type: Improvement
>          Components: parquet-mr
>    Affects Versions: 1.13.1
>            Reporter: Parth Chandra
>            Priority: Major
>
> ParquetFileReader is used by many engines - Hadoop, Spark among them. These 
> engines report various metrics to measure performance in different 
> environments and it is usually useful to be able to get low level metrics out 
> of the file reader and writers.
> It would be very useful to allow a simple interface to report the metrics. 
> Callers can then implement the interface to record the metrics in any 
> subsystem they choose.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to