mchades commented on code in PR #13571:
URL: https://github.com/apache/gravitino/pull/13571#discussion_r4141061589
##########
core/src/main/java/org/apache/gravitino/catalog/SemanticModelOperationDispatcher.java:
##########
@@ -138,4 +154,20 @@ private void checkRelationalCatalog(Namespace namespace) {
private static NameIdentifier schemaIdentifier(NameIdentifier ident) {
return NameIdentifier.of(ident.namespace().levels());
}
+
+ private static void validatePropertyChanges(SemanticModelChange[] changes) {
+ Map<String, String> upserts = new HashMap<>();
+ Map<String, String> deletes = new HashMap<>();
+ for (SemanticModelChange change : changes) {
+ if (change instanceof SemanticModelChange.SetProperty) {
+ SemanticModelChange.SetProperty setProperty =
(SemanticModelChange.SetProperty) change;
+ upserts.put(setProperty.getProperty(), setProperty.getValue());
+ } else if (change instanceof SemanticModelChange.RemoveProperty) {
+ SemanticModelChange.RemoveProperty removeProperty =
+ (SemanticModelChange.RemoveProperty) change;
+ deletes.put(removeProperty.getProperty(),
removeProperty.getProperty());
Review Comment:
This follows the existing alter-property convention. `OperationDispatcher`,
`MetalakeNormalizeDispatcher`, and `CatalogManager` also build delete maps as
`key -> key` because `validatePropertyForAlter` only reads the keys. Property
changes are applied in input order; the catalog and metalake tests already
cover setting and then removing the same property and expect it to be absent.
Semantic Model follows the same behavior.
--
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]