aturoczy commented on code in PR #4392: URL: https://github.com/apache/hive/pull/4392#discussion_r1221576817
########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java: ########## @@ -168,6 +175,31 @@ 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 { + try { + Transaction transaction = icebergTbl.newTransaction(); + if (isOverwrite) { + DeleteFiles delete = transaction.newDelete(); + delete.deleteFromRowFilter(Expressions.alwaysTrue()); + delete.commit(); + } + AppendFiles append = transaction.newAppend(); + PartitionSpec spec = icebergTbl.spec(); + MetricsConfig metricsConfig = MetricsConfig.fromProperties(icebergTbl.properties()); + String nameMappingString = icebergTbl.properties().get(TableProperties.DEFAULT_NAME_MAPPING); + NameMapping nameMapping = nameMappingString != null ? NameMappingParser.fromJson(nameMappingString) : null; + RemoteIterator<LocatedFileStatus> filesIterator = HiveTableUtil.getFilesIterator(new Path(fromURI), conf); + List<DataFile> dataFiles = HiveTableUtil.getDataFiles(filesIterator, Collections.emptyMap(), + format == null ? IOConstants.PARQUET : format, spec, metricsConfig, nameMapping, conf); + dataFiles.forEach(append::appendFile); + append.commit(); + transaction.commitTransaction(); + } catch (Exception e) { + throw new SemanticException("Can not Append data files", e); Review Comment: append small a :) and needs a space ########## ql/src/java/org/apache/hadoop/hive/ql/plan/LoadTableDesc.java: ########## @@ -157,6 +159,19 @@ public LoadTableDesc(final Path sourcePath, } } + public LoadTableDesc(Path path, Table tableHandle, boolean isOverWrite, boolean isIcebergLoad) { Review Comment: The isIcebergLoad should not have a separate setter? Inside the LoadTableDesc it is even do not used -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org