jsbali commented on a change in pull request #2879:
URL: https://github.com/apache/hudi/pull/2879#discussion_r662461892



##########
File path: 
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveSchemaUtil.java
##########
@@ -150,11 +172,26 @@ private static boolean isFieldExistsInSchema(Map<String, 
String> newTableSchema,
         result.append(convertField(parquetType, supportTimestamp));
       }
 
-      schema.put(hiveCompatibleFieldName(key, false), result.toString());
+      schema.put(key, result.toString());
     }
     return schema;
   }
 
+  public static Map<String, String> 
convertMapSchemaToHiveSchema(LinkedHashMap<String, String> schema) throws 
IOException {
+    Map<String, String> hiveSchema = new LinkedHashMap<>();
+    for (Map.Entry<String,String> entry: schema.entrySet()) {
+      hiveSchema.put(hiveCompatibleFieldName(entry.getKey(), false), 
entry.getValue());
+    }
+    return hiveSchema;
+  }
+
+  public static List<FieldSchema> 
convertMapSchemaToHiveFieldSchema(LinkedHashMap<String, String> schema, 
HiveSyncConfig syncConfig) throws IOException {
+    return schema.keySet().stream()
+        .map(key -> new FieldSchema(key, schema.get(key), ""))
+        .filter(field -> !syncConfig.partitionFields.contains(field.getName()))

Review comment:
       This is only for the HMS api as it expects cols and partCols to be 
provided separately.




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