RussellSpitzer commented on code in PR #14040:
URL: https://github.com/apache/iceberg/pull/14040#discussion_r2353766565
##########
parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java:
##########
@@ -1281,12 +1304,24 @@ public ReadBuilder withNameMapping(NameMapping
newNameMapping) {
@Override
public ReadBuilder setRootType(Class<? extends StructLike> rootClass) {
- throw new UnsupportedOperationException("Custom types are not yet
supported");
+ Preconditions.checkArgument(
+ this.internalReader != null, "Cannot set root type without using an
Internal Reader");
+ Preconditions.checkArgument(
+ this.readerFunc == null && this.readerFuncWithSchema == null,
+ "Setting root type is not compatible with setting a reader
function");
+ internalReader.setRootType(rootClass);
Review Comment:
Sorry, I followed what you were saying I was just wondering if we shouldn't
be making an interface but making a ReaderFunctionFactory class itself
```
class ParquetReaderFunction {
Function<Message, ParquetValueReaderBuilder> build()
ParquetReaderFunction withSchema(Schema schema) {
// Overload if we are a readerFuncWithSchema
return this
}
ParquetReaderFunction withCustomTypes<Map<Integer, Class<T extends
StructLike> {
// Overload if we are using CustomTypes
return this
}
}
```
This is a bigger overall refactor, but I'm wondering if we can replace the
currently 3 (will be 4 after this) setters we currently have with just 2
ParquetReaderFunction
And
VectorizedReaderFunction
And we rely on implementations to decide whether they do something with
withSchema or withCustomTypes\
We could be doing this with "InternalReader" as an example of this class and
avoid making createReader and ReaderWithSchema and ReaderWithSchemaAndType
--
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]