pvary commented on code in PR #18692:
URL: https://github.com/apache/iceberg/pull/18692#discussion_r4585284036
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java:
##########
@@ -268,6 +249,42 @@ public void doCommit(ViewMetadata base, ViewMetadata
metadata) {
"Committed to view {} with the new metadata location {}", fullName,
newMetadataLocation);
}
+ private void updateHmsTable(
+ Table tbl,
+ ViewMetadata base,
+ ViewMetadata metadata,
+ String baseMetadataLocation,
+ String newMetadataLocation) {
+ tbl.setSd(
+ HiveOperationsBase.storageDescriptor(
+ metadata.schema(), metadata.location(), false)); // set to pick up
any schema changes
+
+ String metadataLocation =
+
tbl.getParameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP);
+ if (!Objects.equals(baseMetadataLocation, metadataLocation)) {
+ throw new CommitFailedException(
+ "Cannot commit: Base metadata location '%s' is not same as the
current view metadata location '%s' for %s.%s",
+ baseMetadataLocation, metadataLocation, database, viewName);
+ }
+
+ // get Iceberg props that have been removed
+ Set<String> removedProps = emptySet();
+ if (base != null) {
+ removedProps =
+ base.properties().keySet().stream()
+ .filter(key -> !metadata.properties().containsKey(key))
+ .collect(Collectors.toSet());
+ }
+ HMSTablePropertyHelper.updateHmsTableForIcebergView(
Review Comment:
nit: If we change this, please add a newline after the block
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]