gaborkaszab commented on code in PR #4339:
URL: https://github.com/apache/hive/pull/4339#discussion_r1205909658
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -146,8 +149,21 @@ private static List<DataFile>
getDataFiles(RemoteIterator<LocatedFileStatus> fil
if (fileName.startsWith(".") || fileName.startsWith("_") ||
fileName.endsWith("metadata.json")) {
continue;
}
- dataFiles.addAll(TableMigrationUtil.listPartition(partitionKeys,
fileStatus.getPath().toString(), format, spec,
- conf, metricsConfig, nameMapping));
+ partitionKeys.replaceAll((key, value) ->
FileUtils.escapePathName(value));
+
+ int[] stringFields = IntStream.range(0, spec.javaClasses().length)
+ .filter(i ->
spec.javaClasses()[i].isAssignableFrom(String.class)).toArray();
+
+ dataFiles.addAll(Lists.transform(
+ TableMigrationUtil.listPartition(partitionKeys,
fileStatus.getPath().toString(), format, spec,
+ conf, metricsConfig, nameMapping),
+ dataFile -> {
+ StructLike structLike = dataFile.partition();
+ for (int pos : stringFields) {
+ structLike.set(pos,
FileUtils.unescapePathName(structLike.get(pos, String.class)));
Review Comment:
If you unescape the partition values here, what if the original string was
"2023%2F05%2F18" int the original table. Is it going to change to "2023/05/18"
after the converting the table to Iceberg.
--
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]