pvary commented on code in PR #12298:
URL: https://github.com/apache/iceberg/pull/12298#discussion_r2382323297
##########
parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java:
##########
@@ -1210,47 +1402,64 @@ public ReadBuilder filter(Expression newFilter) {
*/
@Deprecated
public ReadBuilder readSupport(ReadSupport<?> newFilterSupport) {
- this.readSupport = newFilterSupport;
+ impl.readSupport = newFilterSupport;
return this;
}
public ReadBuilder createReaderFunc(
Function<MessageType, ParquetValueReader<?>> newReaderFunction) {
- Preconditions.checkArgument(
- this.batchedReaderFunc == null,
- "Cannot set reader function: batched reader function already set");
- Preconditions.checkArgument(
- this.readerFuncWithSchema == null,
- "Cannot set reader function: 2-argument reader function already
set");
- this.readerFunc = newReaderFunction;
+ Preconditions.checkState(
+ impl.readerFuncWithSchema == null
+ && impl.readerFunction == null
+ && impl.batchedReaderFunc == null
+ && impl.batchReaderFunction == null,
+ "Cannot set multiple read builder functions");
+ if (newReaderFunction != null) {
+ impl.readerFunc = m -> (ParquetValueReader<Object>)
newReaderFunction.apply(m);
+ } else {
+ impl.readerFunc = null;
+ }
+
return this;
}
public ReadBuilder createReaderFunc(
BiFunction<Schema, MessageType, ParquetValueReader<?>>
newReaderFunction) {
- Preconditions.checkArgument(
- this.readerFunc == null,
- "Cannot set 2-argument reader function: reader function already
set");
- Preconditions.checkArgument(
- this.batchedReaderFunc == null,
- "Cannot set 2-argument reader function: batched reader function
already set");
- this.readerFuncWithSchema = newReaderFunction;
+ Preconditions.checkState(
+ impl.readerFunc == null
+ && impl.readerFunction == null
+ && impl.batchedReaderFunc == null
Review Comment:
For backwards comp. Kept the old
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]