rdblue commented on code in PR #11904:
URL: https://github.com/apache/iceberg/pull/11904#discussion_r1924339986
##########
parquet/src/main/java/org/apache/iceberg/data/parquet/BaseParquetWriter.java:
##########
@@ -192,13 +222,17 @@ public Optional<ParquetValueWriters.PrimitiveWriter<?>>
visit(
@Override
public Optional<ParquetValueWriters.PrimitiveWriter<?>> visit(
LogicalTypeAnnotation.DateLogicalTypeAnnotation dateType) {
- return Optional.of(new DateWriter(desc));
+ return Optional.ofNullable(dateWriter(desc));
}
@Override
public Optional<ParquetValueWriters.PrimitiveWriter<?>> visit(
LogicalTypeAnnotation.TimeLogicalTypeAnnotation timeType) {
- return Optional.of(new TimeWriter(desc));
+ Preconditions.checkArgument(
+ LogicalTypeAnnotation.TimeUnit.MICROS.equals(timeType.getUnit()),
+ "Cannot write time in %s, only MICROS is supported",
+ timeType.getUnit());
+ return Optional.ofNullable(timeWriter(desc));
Review Comment:
Why does this use `ofNullable`? The intent is not to expose
`BaseParquetWriter` beyond its package, so there is no need to handle cases
where the factory method return `null`. Those are error cases.
--
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]