voonhous commented on code in PR #19295:
URL: https://github.com/apache/hudi/pull/19295#discussion_r3674413448


##########
hudi-trino/src/main/java/io/trino/plugin/hudi/HudiUtil.java:
##########
@@ -715,14 +726,19 @@ public static List<HiveColumnHandle> 
appendMissingMergeRequiredColumns(
     /**
      * Builds {@link HiveColumnHandle}s, preserving physical (data-column) 
index, for the data columns whose names
      * appear in {@code columnNames}. Names that are not data columns (e.g. 
Hudi meta fields) or whose types are not
-     * supported by the storage format are skipped.
+     * supported by the storage format are skipped. Matching is 
case-insensitive: predicted merge columns carry the
+     * table schema's field casing (e.g. the {@code Op} delete key of DMS 
tables) while metastore column names are
+     * lowercased.
      */
     private static List<HiveColumnHandle> buildColumnHandles(Table table, 
TypeManager typeManager, Set<String> columnNames, HiveTimestampPrecision 
timestampPrecision)
     {
+        Set<String> lowercaseColumnNames = columnNames.stream()
+                .map(name -> name.toLowerCase(Locale.ROOT))
+                .collect(Collectors.toSet());
         ImmutableList.Builder<HiveColumnHandle> columns = 
ImmutableList.builder();
         int hiveColumnIndex = 0;
         for (Column field : table.getDataColumns()) {
-            if (columnNames.contains(field.getName())) {
+            if 
(lowercaseColumnNames.contains(field.getName().toLowerCase(Locale.ROOT))) {

Review Comment:
   `appendMissingMergeRequiredColumns` recovers it on every merge path (and the 
full-schema branch is a superset), so the folding changed no outcome. Reverted; 
the javadoc now points at the recovery instead.



-- 
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]

Reply via email to