difin commented on code in PR #6711:
URL: https://github.com/apache/hive/pull/6711#discussion_r3857379595
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -493,8 +493,10 @@ public static PartitionData toPartitionData(StructLike
sourceKey, Types.StructTy
* name an unpartitioned spec renders. Statistics and partition pruning join
on this name, so both must
* render it the same way.
*/
- static String toPartitionName(PartitionSpec spec, PartitionData data) {
- return StringUtils.defaultIfEmpty(spec.partitionToPath(data),
DummyPartition.VOID);
+ public static String toPartitionName(PartitionSpec spec, StructLike data) {
+ String path = spec.partitionToPath(data);
+ // an unpartitioned spec renders nothing: its rows belong to the
table-level partition
+ return path.isEmpty() ? DummyPartition.VOID : path;
Review Comment:
Previously it was using `StringUtils.defaultIfEmpty(..)`, which used to
handle null, but now `path.isEmpty()` may throw NPE.
--
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]