dongkelun commented on a change in pull request #4533:
URL: https://github.com/apache/hudi/pull/4533#discussion_r780276868
##########
File path:
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -251,10 +251,8 @@ private boolean syncSchema(String tableName, boolean
tableExists, boolean useRea
LOG.info("Schema difference found for " + tableName);
hoodieHiveClient.updateTableDefinition(tableName, schema);
// Sync the table properties if the schema has changed
- if (cfg.tableProperties != null) {
- hoodieHiveClient.updateTableProperties(tableName, tableProperties);
- LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
- }
+ hoodieHiveClient.updateTableProperties(tableName, tableProperties);
+ LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
Review comment:
if add new columns,and cfg.tableProperties is null,then do not
executeupdateTableProperties,then spark sql will not get the new columns.
I'm not sure if delete columns and update columns are the same.
If not, I think it can be judged by
`schemaDiff.getAddColumnTypes().isEmpty()`.
##########
File path:
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -251,10 +251,8 @@ private boolean syncSchema(String tableName, boolean
tableExists, boolean useRea
LOG.info("Schema difference found for " + tableName);
hoodieHiveClient.updateTableDefinition(tableName, schema);
// Sync the table properties if the schema has changed
- if (cfg.tableProperties != null) {
- hoodieHiveClient.updateTableProperties(tableName, tableProperties);
- LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
- }
+ hoodieHiveClient.updateTableProperties(tableName, tableProperties);
+ LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
Review comment:
> how about change this code to: if (cfg.tableProperties != null ||
cfg.syncAsSparkDataSourceTable) {
hoodieHiveClient.updateTableProperties(tableName, tableProperties);
LOG.info("Sync table properties for " + tableName + ", table properties is: " +
(cfg.tableProperties == null ? "" : cfg.tableProperties)); }
Sorry to see this new news now. Let me think about it first
##########
File path:
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -251,10 +251,8 @@ private boolean syncSchema(String tableName, boolean
tableExists, boolean useRea
LOG.info("Schema difference found for " + tableName);
hoodieHiveClient.updateTableDefinition(tableName, schema);
// Sync the table properties if the schema has changed
- if (cfg.tableProperties != null) {
- hoodieHiveClient.updateTableProperties(tableName, tableProperties);
- LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
- }
+ hoodieHiveClient.updateTableProperties(tableName, tableProperties);
+ LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
Review comment:
OK, I see. Thank you for your reminder. Your idea is better
##########
File path:
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -251,10 +251,8 @@ private boolean syncSchema(String tableName, boolean
tableExists, boolean useRea
LOG.info("Schema difference found for " + tableName);
hoodieHiveClient.updateTableDefinition(tableName, schema);
// Sync the table properties if the schema has changed
- if (cfg.tableProperties != null) {
- hoodieHiveClient.updateTableProperties(tableName, tableProperties);
- LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
- }
+ hoodieHiveClient.updateTableProperties(tableName, tableProperties);
+ LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
Review comment:
How about changing the log like this?
```java
LOG.info("Sync table properties for " + tableName + ", table properties is:
" + tableProperties);
```
##########
File path:
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -251,10 +251,8 @@ private boolean syncSchema(String tableName, boolean
tableExists, boolean useRea
LOG.info("Schema difference found for " + tableName);
hoodieHiveClient.updateTableDefinition(tableName, schema);
// Sync the table properties if the schema has changed
- if (cfg.tableProperties != null) {
- hoodieHiveClient.updateTableProperties(tableName, tableProperties);
- LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
- }
+ hoodieHiveClient.updateTableProperties(tableName, tableProperties);
+ LOG.info("Sync table properties for " + tableName + ", table
properties is: " + cfg.tableProperties);
Review comment:
I have submitted the newly modified code
--
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]