nsivabalan commented on code in PR #5920:
URL: https://github.com/apache/hudi/pull/5920#discussion_r905339077
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HoodieHiveClient.java:
##########
@@ -134,6 +136,41 @@ public void updateTableProperties(String tableName,
Map<String, String> tablePro
}
}
+ /**
+ * Update the table serde properties to the table.
+ */
+ @Override
+ public void updateTableSerDeInfo(String tableName, String serdeClass,
Map<String, String> serdeProperties) {
+ if (serdeProperties == null || serdeProperties.isEmpty()) {
+ return;
+ }
+ try {
+ Table table = client.getTable(syncConfig.databaseName, tableName);
+ serdeProperties.put("serialization.format", "1");
+ StorageDescriptor storageDescriptor = table.getSd();
+ SerDeInfo serdeInfo = storageDescriptor.getSerdeInfo();
+ if (serdeInfo != null && serdeInfo.getParametersSize() ==
serdeProperties.size()) {
+ Map<String, String> parameters = serdeInfo.getParameters();
+ boolean same = true;
+ for (String key : serdeProperties.keySet()) {
+ if (!parameters.containsKey(key) |
!parameters.get(key).equals(serdeProperties.get(key))) {
+ same = false;
+ break;
+ }
+ }
+ if (same) {
+ LOG.debug("Table " + tableName + " serdeProperties already up to
date, skip update");
+ return;
+ }
+ }
+ storageDescriptor.setSerdeInfo(new SerDeInfo(null, serdeClass,
serdeProperties));
+ client.alter_table(syncConfig.databaseName, tableName, table);
Review Comment:
should we be calling table.setSd(storageDescriptor); before calling
client.alterTable ?
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HoodieHiveClient.java:
##########
@@ -244,7 +281,7 @@ public Option<String> getLastReplicatedTime(String
tableName) {
public void updateLastReplicatedTimeStamp(String tableName, String
timeStamp) {
if (!activeTimeline.filterCompletedInstants().getInstants()
- .anyMatch(i -> i.getTimestamp().equals(timeStamp))) {
Review Comment:
can you please revert unintented changes. would be easy to review just the
required change
--
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]