deniskuzZ commented on code in PR #6259:
URL: https://github.com/apache/hive/pull/6259#discussion_r2707196475
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -567,6 +567,17 @@ public static List<String> getPartitionNames(Table table,
Map<String, String> pa
}
}
+ public static boolean hasPartition(Table icebergTable,
+ Map<String, String> partitionSpec) throws
MetaException {
+ try {
+ List<String> partNames = getPartitionNames(icebergTable, partitionSpec,
false);
+ return !partNames.isEmpty() &&
+ Warehouse.makePartName(partitionSpec,
false).equals(partNames.getFirst());
Review Comment:
makes sense, but could we please do minor refactor and move the whole
getPartition into IcebergTableUtil?
````
public static Partition getPartition(Configuration conf,
org.apache.hadoop.hive.ql.metadata.Table table, Map<String, String>
partitionSpec)
throws SemanticException {
List<String> partNames =
getPartitionNames(conf, table, partitionSpec, false);
if (partNames.isEmpty()) {
return null;
}
try {
String expectedName = Warehouse.makePartName(partitionSpec, false);
if (!expectedName.equals(partNames.getFirst())) {
return null;
}
return new DummyPartition(table, expectedName, partitionSpec);
} catch (MetaException e) {
throw new SemanticException("Unable to construct dummy partition", e);
}
}
public static List<String> getPartitionNames(Configuration conf,
org.apache.hadoop.hive.ql.metadata.Table table, Map<String, String>
partSpecMap,
boolean latestSpecOnly) throws SemanticException {
Table icebergTable = getTable(conf, table.getTTable());
....
}
````
--
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]