4343import org .apache .parquet .crypto .FileDecryptionProperties ;
4444import org .apache .parquet .filter2 .compat .FilterCompat ;
4545import org .apache .parquet .format .converter .ParquetMetadataConverter ;
46+ import org .apache .parquet .hadoop .ParquetMetricsCallback ;
4647import org .apache .parquet .hadoop .util .HadoopCodecs ;
4748
4849// Internal use only
@@ -75,6 +76,7 @@ public class ParquetReadOptions {
7576 private final Map <String , String > properties ;
7677 private final FileDecryptionProperties fileDecryptionProperties ;
7778 private final ParquetConfiguration conf ;
79+ private final ParquetMetricsCallback metricsCallback ;
7880
7981 ParquetReadOptions (
8082 boolean useSignedStringMinMax ,
@@ -91,7 +93,8 @@ public class ParquetReadOptions {
9193 ByteBufferAllocator allocator ,
9294 int maxAllocationSize ,
9395 Map <String , String > properties ,
94- FileDecryptionProperties fileDecryptionProperties ) {
96+ FileDecryptionProperties fileDecryptionProperties ,
97+ ParquetMetricsCallback metricsCallback ) {
9598 this (
9699 useSignedStringMinMax ,
97100 useStatsFilter ,
@@ -108,6 +111,7 @@ public class ParquetReadOptions {
108111 maxAllocationSize ,
109112 properties ,
110113 fileDecryptionProperties ,
114+ metricsCallback ,
111115 new HadoopParquetConfiguration ());
112116 }
113117
@@ -127,6 +131,7 @@ public class ParquetReadOptions {
127131 int maxAllocationSize ,
128132 Map <String , String > properties ,
129133 FileDecryptionProperties fileDecryptionProperties ,
134+ ParquetMetricsCallback metricsCallback ,
130135 ParquetConfiguration conf ) {
131136 this .useSignedStringMinMax = useSignedStringMinMax ;
132137 this .useStatsFilter = useStatsFilter ;
@@ -143,6 +148,7 @@ public class ParquetReadOptions {
143148 this .maxAllocationSize = maxAllocationSize ;
144149 this .properties = Collections .unmodifiableMap (properties );
145150 this .fileDecryptionProperties = fileDecryptionProperties ;
151+ this .metricsCallback = metricsCallback ;
146152 this .conf = conf ;
147153 }
148154
@@ -210,6 +216,10 @@ public FileDecryptionProperties getDecryptionProperties() {
210216 return fileDecryptionProperties ;
211217 }
212218
219+ public ParquetMetricsCallback getMetricsCallback () {
220+ return metricsCallback ;
221+ }
222+
213223 public boolean isEnabled (String property , boolean defaultValue ) {
214224 Optional <String > propValue = Optional .ofNullable (properties .get (property ));
215225 return propValue .map (Boolean ::parseBoolean ).orElse (defaultValue );
@@ -245,6 +255,7 @@ public static class Builder {
245255 protected Map <String , String > properties = new HashMap <>();
246256 protected FileDecryptionProperties fileDecryptionProperties = null ;
247257 protected ParquetConfiguration conf ;
258+ protected ParquetMetricsCallback metricsCallback ;
248259
249260 public Builder () {
250261 this (new HadoopParquetConfiguration ());
@@ -391,6 +402,11 @@ public Builder withDecryption(FileDecryptionProperties fileDecryptionProperties)
391402 return this ;
392403 }
393404
405+ public Builder withMetricsCallback (ParquetMetricsCallback metricsCallback ) {
406+ this .metricsCallback = metricsCallback ;
407+ return this ;
408+ }
409+
394410 public Builder set (String key , String value ) {
395411 properties .put (key , value );
396412 return this ;
@@ -407,6 +423,7 @@ public Builder copy(ParquetReadOptions options) {
407423 withAllocator (options .allocator );
408424 withPageChecksumVerification (options .usePageChecksumVerification );
409425 withDecryption (options .fileDecryptionProperties );
426+ withMetricsCallback (options .metricsCallback );
410427 conf = options .conf ;
411428 for (Map .Entry <String , String > keyValue : options .properties .entrySet ()) {
412429 set (keyValue .getKey (), keyValue .getValue ());
@@ -439,6 +456,7 @@ public ParquetReadOptions build() {
439456 maxAllocationSize ,
440457 properties ,
441458 fileDecryptionProperties ,
459+ metricsCallback ,
442460 conf );
443461 }
444462 }
0 commit comments