rahil-c commented on code in PR #8441:
URL: https://github.com/apache/hudi/pull/8441#discussion_r1171950343
##########
hudi-aws/src/main/java/org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java:
##########
@@ -246,22 +248,22 @@ public void updateTableSchema(String tableName,
MessageType newSchema) {
Table table = getTable(awsGlue, databaseName, tableName);
Map<String, String> newSchemaMap = parquetSchemaToMapSchema(newSchema,
config.getBoolean(HIVE_SUPPORT_TIMESTAMP_TYPE), false);
List<Column> newColumns = getColumnsFromSchema(newSchemaMap);
- StorageDescriptor sd = table.getStorageDescriptor();
- sd.setColumns(newColumns);
-
- final Date now = new Date();
- TableInput updatedTableInput = new TableInput()
- .withName(tableName)
- .withTableType(table.getTableType())
- .withParameters(table.getParameters())
- .withPartitionKeys(table.getPartitionKeys())
- .withStorageDescriptor(sd)
- .withLastAccessTime(now)
- .withLastAnalyzedTime(now);
-
- UpdateTableRequest request = new UpdateTableRequest()
- .withDatabaseName(databaseName)
- .withTableInput(updatedTableInput);
+ StorageDescriptor sd = table.storageDescriptor();
+ StorageDescriptor partitionSD = sd.copy(copySd ->
copySd.columns(newColumns));
Review Comment:
In SDK v2 the POJOS are immutable so I cant modify the original
`StorageDescriptor sd` object and the only option is to make a clone and pass
that.
From docs
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-whats-different.html
```
Immutable POJOs
Clients and operation request and response objects are now immutable and
cannot be changed after creation. To reuse a request or response variable, you
must build a new object to assign to it.
```
--
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]