shaofengshi commented on code in PR #9839:
URL: https://github.com/apache/gravitino/pull/9839#discussion_r2763387415
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -238,6 +239,47 @@ private Credential getCredential(
return credential;
}
+ private boolean shouldGenerateCredential(
+ LoadTableResponse loadTableResponse, boolean requestCredential) {
+ if (!requestCredential) {
+ return false;
+ }
+ validateCredentialLocation(loadTableResponse.tableMetadata().location());
+ return !isLocalOrHdfsTable(loadTableResponse.tableMetadata());
+ }
+
+ private boolean isLocalOrHdfsTable(TableMetadata tableMetadata) {
+ return isLocalOrHdfsLocation(tableMetadata.location());
+ }
+
+ @VisibleForTesting
+ static void validateCredentialLocation(String location) {
+ if (StringUtils.isBlank(location)) {
+ throw new IllegalArgumentException(
+ "Table location cannot be null or blank when requesting
credentials");
+ }
+ }
+
+ @VisibleForTesting
+ static boolean isLocalOrHdfsLocation(String location) {
Review Comment:
this method name is some kind of confusing: why check it is local or hdfs?
can it be split to two: isLocal and isHdfs ? Because this method has the
assumption that local and hdfs doesn't need credential provider, but in the
future there might be a third case.
--
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]