deniskuzZ commented on code in PR #4453:
URL: https://github.com/apache/hive/pull/4453#discussion_r1245111838
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -182,24 +183,41 @@ private static List<DataFile>
getDataFiles(RemoteIterator<LocatedFileStatus> fil
return dataFiles;
}
- public static void appendFiles(URI fromURI, String format, Table icebergTbl,
boolean isOverwrite, Configuration conf)
- throws SemanticException {
+ public static void appendFiles(URI fromURI, String format, Table icebergTbl,
boolean isOverwrite,
+ Map<String, String> partitionSpec, Configuration conf) throws
SemanticException {
try {
Transaction transaction = icebergTbl.newTransaction();
if (isOverwrite) {
DeleteFiles delete = transaction.newDelete();
- delete.deleteFromRowFilter(Expressions.alwaysTrue());
+ if (partitionSpec != null) {
+ for (Map.Entry<String, String> part : partitionSpec.entrySet()) {
+ delete.deleteFromRowFilter(Expressions.equal(part.getKey(),
+
Conversions.fromPartitionString(icebergTbl.schema().findType(part.getKey()),
part.getValue())));
Review Comment:
could we extract this to partKeyType var?
````
partKeyTypeStr = icebergTbl.schema().findType(part.getKey()
````
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -182,24 +183,41 @@ private static List<DataFile>
getDataFiles(RemoteIterator<LocatedFileStatus> fil
return dataFiles;
}
- public static void appendFiles(URI fromURI, String format, Table icebergTbl,
boolean isOverwrite, Configuration conf)
- throws SemanticException {
+ public static void appendFiles(URI fromURI, String format, Table icebergTbl,
boolean isOverwrite,
+ Map<String, String> partitionSpec, Configuration conf) throws
SemanticException {
try {
Transaction transaction = icebergTbl.newTransaction();
if (isOverwrite) {
DeleteFiles delete = transaction.newDelete();
- delete.deleteFromRowFilter(Expressions.alwaysTrue());
+ if (partitionSpec != null) {
+ for (Map.Entry<String, String> part : partitionSpec.entrySet()) {
+ delete.deleteFromRowFilter(Expressions.equal(part.getKey(),
+
Conversions.fromPartitionString(icebergTbl.schema().findType(part.getKey()),
part.getValue())));
Review Comment:
could we extract this to partKeyTypeStr var?
````
partKeyTypeStr = icebergTbl.schema().findType(part.getKey()
````
--
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]