@@ -50,6 +50,7 @@ public class ParquetReaderConfig {
5050 private boolean enableTimeReadCounter = false ;
5151 private boolean autoCorrectCorruptedDates = true ;
5252 private boolean enableStringsSignedMinMax = false ;
53+ private long timeoutPerRunnableInMsec = 15_000 ;
5354
5455 public static ParquetReaderConfig .Builder builder () {
5556 return new ParquetReaderConfig .Builder ();
@@ -64,12 +65,15 @@ public ParquetReaderConfig(@JsonProperty("enableBytesReadCounter") Boolean enabl
6465 @ JsonProperty ("enableBytesTotalCounter" ) Boolean enableBytesTotalCounter ,
6566 @ JsonProperty ("enableTimeReadCounter" ) Boolean enableTimeReadCounter ,
6667 @ JsonProperty ("autoCorrectCorruptedDates" ) Boolean autoCorrectCorruptedDates ,
67- @ JsonProperty ("enableStringsSignedMinMax" ) Boolean enableStringsSignedMinMax ) {
68+ @ JsonProperty ("enableStringsSignedMinMax" ) Boolean enableStringsSignedMinMax ,
69+ @ JsonProperty ("timeoutPerRunnableInMsec" ) Long timeoutPerRunnableInMsec ) {
6870 this .enableBytesReadCounter = enableBytesReadCounter == null ? this .enableBytesReadCounter : enableBytesReadCounter ;
6971 this .enableBytesTotalCounter = enableBytesTotalCounter == null ? this .enableBytesTotalCounter : enableBytesTotalCounter ;
7072 this .enableTimeReadCounter = enableTimeReadCounter == null ? this .enableTimeReadCounter : enableTimeReadCounter ;
7173 this .autoCorrectCorruptedDates = autoCorrectCorruptedDates == null ? this .autoCorrectCorruptedDates : autoCorrectCorruptedDates ;
7274 this .enableStringsSignedMinMax = enableStringsSignedMinMax == null ? this .enableStringsSignedMinMax : enableStringsSignedMinMax ;
75+ this .timeoutPerRunnableInMsec = timeoutPerRunnableInMsec == null || Long .valueOf (timeoutPerRunnableInMsec ) <= 0 ? // zero means: use default
76+ this .timeoutPerRunnableInMsec : timeoutPerRunnableInMsec ;
7377 }
7478
7579 private ParquetReaderConfig () { }
@@ -99,6 +103,9 @@ public boolean enableStringsSignedMinMax() {
99103 return enableStringsSignedMinMax ;
100104 }
101105
106+ @ JsonProperty ("timeoutPerRunnableInMsec" )
107+ public long timeoutPerRunnableInMsec () { return timeoutPerRunnableInMsec ; }
108+
102109 public ParquetReadOptions toReadOptions () {
103110 return ParquetReadOptions .builder ()
104111 .useSignedStringMinMax (enableStringsSignedMinMax )
@@ -119,7 +126,8 @@ public int hashCode() {
119126 enableBytesTotalCounter ,
120127 enableTimeReadCounter ,
121128 autoCorrectCorruptedDates ,
122- enableStringsSignedMinMax );
129+ enableStringsSignedMinMax ,
130+ timeoutPerRunnableInMsec );
123131 }
124132
125133 @ Override
@@ -135,7 +143,8 @@ public boolean equals(Object o) {
135143 && enableBytesTotalCounter == that .enableBytesTotalCounter
136144 && enableTimeReadCounter == that .enableTimeReadCounter
137145 && autoCorrectCorruptedDates == that .autoCorrectCorruptedDates
138- && enableStringsSignedMinMax == that .enableStringsSignedMinMax ;
146+ && enableStringsSignedMinMax == that .enableStringsSignedMinMax
147+ && timeoutPerRunnableInMsec == that .timeoutPerRunnableInMsec ;
139148 }
140149
141150 @ Override
@@ -146,6 +155,7 @@ public String toString() {
146155 + ", enableTimeReadCounter=" + enableTimeReadCounter
147156 + ", autoCorrectCorruptedDates=" + autoCorrectCorruptedDates
148157 + ", enableStringsSignedMinMax=" + enableStringsSignedMinMax
158+ + ", timeoutPerRunnableInMsec=" + timeoutPerRunnableInMsec
149159 + '}' ;
150160 }
151161
@@ -188,10 +198,12 @@ public ParquetReaderConfig build() {
188198
189199 // last assign values from session options, session options have higher priority than other configurations
190200 if (options != null ) {
191- String option = options .getOption (ExecConstants .PARQUET_READER_STRINGS_SIGNED_MIN_MAX_VALIDATOR );
192- if (!option .isEmpty ()) {
193- readerConfig .enableStringsSignedMinMax = Boolean .valueOf (option );
201+ String optionSignedMinMax = options .getOption (ExecConstants .PARQUET_READER_STRINGS_SIGNED_MIN_MAX_VALIDATOR );
202+ if (!optionSignedMinMax .isEmpty ()) {
203+ readerConfig .enableStringsSignedMinMax = Boolean .valueOf (optionSignedMinMax );
194204 }
205+ Long optionTimeout = options .getOption (ExecConstants .PARQUET_REFRESH_TIMEOUT_VALIDATOR );
206+ readerConfig .timeoutPerRunnableInMsec = Long .valueOf (optionTimeout );
195207 }
196208
197209 return readerConfig ;
0 commit comments