bharos commented on code in PR #7444:
URL: https://github.com/apache/gravitino/pull/7444#discussion_r2165942942


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergConfigOperations.java:
##########
@@ -40,13 +45,30 @@ public class IcebergConfigOperations {
   @SuppressWarnings("UnusedVariable")
   @Context
   private HttpServletRequest httpRequest;
+  private final IcebergCatalogWrapperManager catalogWrapperManager;
+
+  @Inject
+  public IcebergConfigOperations(IcebergCatalogWrapperManager 
catalogWrapperManager) {
+    this.catalogWrapperManager = catalogWrapperManager;
+  }
 
   @GET
   @Produces(MediaType.APPLICATION_JSON)
   @Timed(name = "config." + MetricNames.HTTP_PROCESS_DURATION, absolute = true)
   @ResponseMetered(name = "config", absolute = true)
-  public Response getConfig() {
-    ConfigResponse response = ConfigResponse.builder().build();
+  public Response getConfig(@DefaultValue("") @QueryParam("warehouse") String 
warehouse) {
+    if (warehouse == null || warehouse.isEmpty()) {
+      ConfigResponse response = ConfigResponse.builder().build();
+      return IcebergRestUtils.ok(response);
+    }
+
+    // Get the catalog wrapper which contains the configuration
+    CatalogWrapperForREST catalogWrapper = 
catalogWrapperManager.getCatalogWrapper(warehouse);

Review Comment:
   When `warehouse` and `prefix` are not set, this is the error seen in 
spark-sql client
   
   ```
   spark-sql (default)> select * from sbschema.bmurali_iceberg_table2;
   [TABLE_OR_VIEW_NOT_FOUND] The table or view 
`sbschema`.`bmurali_iceberg_table2` cannot be found. Verify the spelling and 
correctness of the schema and catalog.
   If you did not qualify the name with a schema, verify the current_schema() 
output, or qualify the name with the correct schema and catalog.
   To tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF 
EXISTS.; line 1 pos 14;
   'Project [*]
   +- 'UnresolvedRelation [sbschema, bmurali_iceberg_table2], [], false
   ```
   
   On Gravitino server logs I see
   ```
   2025-06-25 06:53:31.209 INFO [iceberg-rest-30] 
[org.apache.gravitino.iceberg.common.utils.IcebergCatalogUtil.loadCatalogBackend(IcebergCatalogUtil.java:179)]
 - Load catalog backend of MEMORY
   2025-06-25 06:53:31.231 INFO [iceberg-rest-30] 
[org.apache.gravitino.iceberg.service.IcebergExceptionMapper.toResponse(IcebergExceptionMapper.java:80)]
 - Iceberg REST server error maybe caused by user request, response http 
status: 404, exception: class 
org.apache.iceberg.exceptions.NoSuchTableException, exception message: Table 
does not exist: sbschema.bmurali_iceberg_table2
   ```
   Seems like it tried to use `memory` catalog and eventually failed to find 
the table.
   
   I guess this can be treated as working as expected ?



-- 
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]

Reply via email to