jerryshao commented on code in PR #10879:
URL: https://github.com/apache/gravitino/pull/10879#discussion_r3158921642
##########
core/src/main/java/org/apache/gravitino/catalog/ViewOperationDispatcher.java:
##########
@@ -135,22 +170,45 @@ private EntityCombinedView importView(NameIdentifier
ident) throws NoSuchViewExc
LOG.info("Auto-importing view {} into Gravitino entity store", ident);
long uid = idGenerator.nextId();
- GenericEntity newViewEntity =
- GenericEntity.builder()
- .withId(uid)
- .withName(ident.name())
- .withNamespace(ident.namespace())
- .withEntityType(Entity.EntityType.VIEW)
- .build();
+ View catalogView = entityCombinedView.viewFromCatalog();
+ ViewEntity newViewEntity = buildViewEntityForImport(uid, ident,
catalogView);
try {
store.put(newViewEntity, false /* overwrite */);
LOG.info("Successfully imported view {} into entity store with id {}",
ident, uid);
- return EntityCombinedView.of(entityCombinedView.viewFromCatalog(),
newViewEntity)
- .withImported(true);
+ return EntityCombinedView.of(catalogView,
newViewEntity).withImported(true);
} catch (Exception e) {
// Log but don't fail - view import is best-effort
LOG.warn("Failed to import view {} into entity store: {}", ident,
e.getMessage());
- return
EntityCombinedView.of(entityCombinedView.viewFromCatalog()).withImported(false);
+ return EntityCombinedView.of(catalogView).withImported(false);
}
}
+
+ private ViewEntity buildViewEntityForImport(Long uid, NameIdentifier ident,
View view) {
Review Comment:
What's the meaning of `buildViewEntityForImport`?
--
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]