You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "laserninja (via GitHub)" <gi...@apache.org> on 2026/06/13 04:30:17 UTC
[PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
laserninja opened a new pull request, #11634:
URL: https://github.com/apache/gravitino/pull/11634
### What changes were proposed in this pull request?
Derive the advertised endpoint set in `/v1/config` from the backing catalog's capabilities rather than a hardcoded static list. Specifically, gate the `V1_SUBMIT_TABLE_SCAN_PLAN` endpoint behind `CatalogWrapperForREST.supportsScanPlanOperations()`, which returns `true` for non-REST backends (Hive, JDBC, Memory, Custom) where Gravitino performs scan planning locally, and `false` for REST backends where the upstream catalog owns scan planning.
### Why are the changes needed?
`IcebergConfigOperations` advertises a hardcoded `DEFAULT_ENDPOINTS` list (including `V1_SUBMIT_TABLE_SCAN_PLAN`) for every catalog, regardless of whether the configured backend actually supports those operations. A client that trusts the advertised `endpoints` may call an operation the backend cannot serve, producing confusing runtime errors.
Fix: #11584
### Does this PR introduce _any_ user-facing change?
REST backend catalogs will no longer advertise the scan plan endpoint in the `/v1/config` response. Clients that rely on the advertised endpoints will now correctly see only the operations their catalog backend supports.
### How was this patch tested?
- Added `TestIcebergConfigEndpointGating` with tests verifying scan plan endpoint is omitted when not supported, and core endpoints are always present.
- Added `testConfigEndpointsContainScanPlanForNonRESTBackend` to `TestIcebergConfig` verifying scan plan IS advertised for non-REST backends.
- All existing tests pass (11 tests, 0 failures).
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3792391333
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -181,6 +181,20 @@ public LoadCredentialsResponse getTableCredentials(
}
}
+ /**
+ * Whether this catalog wrapper supports server-side scan planning.
+ *
+ * <p>Gravitino implements scan planning locally on top of loaded table metadata. For non-REST
+ * backends (Hive, JDBC, Memory, Custom) this always works. For REST backends the upstream catalog
+ * owns scan planning; advertising the endpoint here could be misleading when the upstream does
+ * not support it, so we do not advertise it.
+ *
+ * @return {@code true} if the scan-plan endpoint should be advertised
+ */
+ public boolean supportsScanPlanOperations() {
Review Comment:
Done, pushed in `92edf5b`.
`CatalogWrapperForREST.supportsScanPlanOperations()` now returns `true` (Gravitino plans locally for every backend it handles directly), and `FederatedCatalogWrapper` overrides it to report whether the remote advertises `V1_SUBMIT_TABLE_SCAN_PLAN` in its own `/v1/config`. Cached for the wrapper's lifetime so the remote is queried at most once, not per local `/v1/config` call.
Two behaviours worth calling out:
- A remote that omits `endpoints` is treated as not supporting scan planning. That matches the Iceberg client, which falls back to a default endpoint set predating scan planning when the field is absent.
- A failed lookup is not cached and does not advertise the endpoint, so it can resolve once the remote recovers.
One thing outside the strict scope, so say the word if you'd rather I split it: `getRESTTableCredentials` and `getRESTTablePlanScan` each carried their own copy of the auth manager / client / session lifecycle, and the config fetch would have been a third. I pulled it into `callRemoteCatalog` instead. It's a separate commit-sized change if you prefer it out of this PR.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3781490371
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -181,6 +181,20 @@ public LoadCredentialsResponse getTableCredentials(
}
}
+ /**
+ * Whether this catalog wrapper supports server-side scan planning.
+ *
+ * <p>Gravitino implements scan planning locally on top of loaded table metadata. For non-REST
+ * backends (Hive, JDBC, Memory, Custom) this always works. For REST backends the upstream catalog
+ * owns scan planning; advertising the endpoint here could be misleading when the upstream does
+ * not support it, so we do not advertise it.
+ *
+ * @return {@code true} if the scan-plan endpoint should be advertised
+ */
+ public boolean supportsScanPlanOperations() {
Review Comment:
Have we supported remote catalog scan planning now?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3766452000
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -179,6 +179,20 @@ public LoadCredentialsResponse getTableCredentials(
}
}
+ /**
+ * Whether this catalog wrapper supports server-side scan planning.
+ *
+ * <p>Gravitino implements scan planning locally on top of loaded table metadata. For non-REST
+ * backends (Hive, JDBC, Memory, Custom) this always works. For REST backends the upstream catalog
+ * owns scan planning; advertising the endpoint here could be misleading when the upstream does
+ * not support it, so we do not advertise it.
+ *
+ * @return {@code true} if the scan-plan endpoint should be advertised
+ */
+ public boolean supportsScanPlanOperations() {
Review Comment:
We don't support REST catalog for the remote catalog. Why?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3797920319
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergConfigEndpointGating.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.iceberg.service.rest;
+
+import java.util.Map;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Response;
+import org.apache.gravitino.iceberg.common.IcebergConfig;
+import org.apache.gravitino.iceberg.service.CatalogWrapperForREST;
+import org.apache.gravitino.iceberg.service.IcebergCatalogWrapperManager;
+import org.apache.gravitino.iceberg.service.provider.IcebergConfigProvider;
+import org.apache.iceberg.rest.responses.ConfigResponse;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests that the /v1/config endpoint gates optional endpoints (like scan planning) based on the
+ * catalog backend's capabilities.
+ */
+public class TestIcebergConfigEndpointGating extends IcebergTestBase {
+
+ @Override
+ protected Application configure() {
+ return IcebergRestTestUtil.getIcebergResourceConfig(
Review Comment:
Fixed in `97c84fe` - now a normal `import java.util.Collections;`.
I also scanned the rest of the diff for the same pattern and this was the only FQN the PR introduced.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#issuecomment-5261361570
@roryqi when you have time, can you check this please
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "bharos (via GitHub)" <gi...@apache.org>.
bharos commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3908812768
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/FederatedCatalogWrapper.java:
##########
@@ -188,12 +198,109 @@ public PlanTableScanResponse planTableScan(
catalogCredentialManager.catalogName(), tableIdentifier, response);
}
+ /**
+ * Reports whether the remote catalog advertises the scan-plan endpoint, since {@link
+ * #planTableScan} delegates planning to it rather than planning locally.
+ *
+ * <p>The answer comes from the remote catalog's own {@code /v1/config} response and is cached for
+ * the lifetime of this wrapper, so the remote is queried at most once rather than on every local
+ * {@code /v1/config} call.
+ *
+ * <p>A remote that omits {@code endpoints} is treated as not supporting scan planning. That
+ * matches the Iceberg client, which falls back to a default endpoint set that predates scan
+ * planning when the field is absent.
+ *
+ * <p>If the remote cannot be reached the result is not cached and the endpoint is not advertised,
+ * so a later call can still resolve it once the remote recovers. Not advertising is the safe
+ * direction here: the endpoint would fail anyway while the remote is unreachable.
+ *
+ * @return {@code true} if the remote catalog advertises {@code V1_SUBMIT_TABLE_SCAN_PLAN}.
+ */
+ @Override
+ public boolean supportsScanPlanOperations() {
+ Boolean cached = remoteSupportsScanPlan;
+ if (cached != null) {
+ return cached;
+ }
+
+ try {
+ boolean supported =
+ fetchRemoteConfig().endpoints().contains(Endpoint.V1_SUBMIT_TABLE_SCAN_PLAN);
+ remoteSupportsScanPlan = supported;
+ return supported;
+ } catch (Exception e) {
+ LOG.warn(
+ "Failed to read the endpoints advertised by the remote catalog of {}; not advertising the"
+ + " scan plan endpoint",
+ catalogCredentialManager.catalogName(),
+ e);
+ return false;
+ }
+ }
+
+ /**
+ * Fetches the remote catalog's {@code /v1/config} response.
+ *
+ * <p>The {@code warehouse} query parameter is forwarded when configured, so a remote serving
+ * several warehouses returns the endpoint set for the one this catalog federates.
+ *
+ * @return the remote catalog's config response.
+ */
+ @VisibleForTesting
+ ConfigResponse fetchRemoteConfig() {
Review Comment:
Two small things on this method, neither blocking:
1. Can this be `private`? `fetchRemoteConfig` is only called from `supportsScanPlanOperations` — the new tests inject through the `getCatalog()` override rather than calling this directly, so `@VisibleForTesting` isn't quite accurate. (The import can go too if nothing else in the file uses it.)
2. Worth one line of javadoc on *why* it refetches. `RESTCatalog.initialize()` already does a `GET /v1/config` against this same remote, but `RESTSessionCatalog` keeps `endpoints` in a private field with no accessor, so it can't be read back — the refetch is the only option. Without that noted, this reads as a redundant round trip and someone will eventually try to remove it. Something like:
```java
* <p>{@code RESTCatalog} already fetched this at init but keeps the endpoint set private, so it
* has to be re-fetched here.
```
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3409233129
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/IcebergRestTestUtil.java:
##########
@@ -139,9 +148,15 @@ public static ResourceConfig getIcebergResourceConfig(
IcebergConfigProvider configProvider = IcebergConfigProviderFactory.create(catalogConf);
configProvider.initialize(catalogConf);
// used to override register table interface
- IcebergCatalogWrapperManager icebergCatalogWrapperManager =
- new IcebergCatalogWrapperManagerForTest(
- catalogConf, configProvider, false, configProvider.getMetalakeName());
+ IcebergCatalogWrapperManager icebergCatalogWrapperManager;
Review Comment:
Why do we use reflection here?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3797925614
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergConfigEndpointGating.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.iceberg.service.rest;
+
+import java.util.Map;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Response;
+import org.apache.gravitino.iceberg.common.IcebergConfig;
+import org.apache.gravitino.iceberg.service.CatalogWrapperForREST;
+import org.apache.gravitino.iceberg.service.IcebergCatalogWrapperManager;
+import org.apache.gravitino.iceberg.service.provider.IcebergConfigProvider;
+import org.apache.iceberg.rest.responses.ConfigResponse;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests that the /v1/config endpoint gates optional endpoints (like scan planning) based on the
+ * catalog backend's capabilities.
+ */
+public class TestIcebergConfigEndpointGating extends IcebergTestBase {
+
+ @Override
+ protected Application configure() {
+ return IcebergRestTestUtil.getIcebergResourceConfig(
Review Comment:
done
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3423042014
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/IcebergRestTestUtil.java:
##########
@@ -139,9 +148,15 @@ public static ResourceConfig getIcebergResourceConfig(
IcebergConfigProvider configProvider = IcebergConfigProviderFactory.create(catalogConf);
configProvider.initialize(catalogConf);
// used to override register table interface
- IcebergCatalogWrapperManager icebergCatalogWrapperManager =
- new IcebergCatalogWrapperManagerForTest(
- catalogConf, configProvider, false, configProvider.getMetalakeName());
+ IcebergCatalogWrapperManager icebergCatalogWrapperManager;
Review Comment:
Reflection was used here to keep the overload generic, it accepts any Class<? extends IcebergCatalogWrapperManager> so tests can plug in different wrapper manager subclasses (e.g., NoScanPlanWrapperManager) without adding a new overload for each one.
That said, I can replace the reflection with a Supplier<IcebergCatalogWrapperManager> or a simple factory lambda instead, that's cleaner and avoids the unchecked reflection. Would you prefer that approach, or would you rather I just pass in an already-constructed instance?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3766452000
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -179,6 +179,20 @@ public LoadCredentialsResponse getTableCredentials(
}
}
+ /**
+ * Whether this catalog wrapper supports server-side scan planning.
+ *
+ * <p>Gravitino implements scan planning locally on top of loaded table metadata. For non-REST
+ * backends (Hive, JDBC, Memory, Custom) this always works. For REST backends the upstream catalog
+ * owns scan planning; advertising the endpoint here could be misleading when the upstream does
+ * not support it, so we do not advertise it.
+ *
+ * @return {@code true} if the scan-plan endpoint should be advertised
+ */
+ public boolean supportsScanPlanOperations() {
Review Comment:
We don't support REST catalog for the remote catalog. Why?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3430716618
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/IcebergRestTestUtil.java:
##########
@@ -139,9 +148,15 @@ public static ResourceConfig getIcebergResourceConfig(
IcebergConfigProvider configProvider = IcebergConfigProviderFactory.create(catalogConf);
configProvider.initialize(catalogConf);
// used to override register table interface
- IcebergCatalogWrapperManager icebergCatalogWrapperManager =
- new IcebergCatalogWrapperManagerForTest(
- catalogConf, configProvider, false, configProvider.getMetalakeName());
+ IcebergCatalogWrapperManager icebergCatalogWrapperManager;
Review Comment:
Makes sense, agreed. I'll replace the reflection with a factory lambda (Function<..., IcebergCatalogWrapperManager>) so the constructor call is checked at compile time. Will push the update shortly.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3920607402
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/FederatedCatalogWrapper.java:
##########
@@ -188,12 +198,109 @@ public PlanTableScanResponse planTableScan(
catalogCredentialManager.catalogName(), tableIdentifier, response);
}
+ /**
+ * Reports whether the remote catalog advertises the scan-plan endpoint, since {@link
+ * #planTableScan} delegates planning to it rather than planning locally.
+ *
+ * <p>The answer comes from the remote catalog's own {@code /v1/config} response and is cached for
+ * the lifetime of this wrapper, so the remote is queried at most once rather than on every local
+ * {@code /v1/config} call.
+ *
+ * <p>A remote that omits {@code endpoints} is treated as not supporting scan planning. That
+ * matches the Iceberg client, which falls back to a default endpoint set that predates scan
+ * planning when the field is absent.
+ *
+ * <p>If the remote cannot be reached the result is not cached and the endpoint is not advertised,
+ * so a later call can still resolve it once the remote recovers. Not advertising is the safe
+ * direction here: the endpoint would fail anyway while the remote is unreachable.
+ *
+ * @return {@code true} if the remote catalog advertises {@code V1_SUBMIT_TABLE_SCAN_PLAN}.
+ */
+ @Override
+ public boolean supportsScanPlanOperations() {
+ Boolean cached = remoteSupportsScanPlan;
+ if (cached != null) {
+ return cached;
+ }
+
+ try {
+ boolean supported =
+ fetchRemoteConfig().endpoints().contains(Endpoint.V1_SUBMIT_TABLE_SCAN_PLAN);
+ remoteSupportsScanPlan = supported;
+ return supported;
+ } catch (Exception e) {
+ LOG.warn(
+ "Failed to read the endpoints advertised by the remote catalog of {}; not advertising the"
+ + " scan plan endpoint",
+ catalogCredentialManager.catalogName(),
+ e);
+ return false;
+ }
+ }
+
+ /**
+ * Fetches the remote catalog's {@code /v1/config} response.
+ *
+ * <p>The {@code warehouse} query parameter is forwarded when configured, so a remote serving
+ * several warehouses returns the endpoint set for the one this catalog federates.
+ *
+ * @return the remote catalog's config response.
+ */
+ @VisibleForTesting
+ ConfigResponse fetchRemoteConfig() {
Review Comment:
Both done in 57ccb8ab6.
1. `fetchRemoteConfig` is now `private`. The `@VisibleForTesting` import stays since it is still used elsewhere in the file.
2. Added the javadoc paragraph you suggested, near-verbatim.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3788454321
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -181,6 +181,20 @@ public LoadCredentialsResponse getTableCredentials(
}
}
+ /**
+ * Whether this catalog wrapper supports server-side scan planning.
+ *
+ * <p>Gravitino implements scan planning locally on top of loaded table metadata. For non-REST
+ * backends (Hive, JDBC, Memory, Custom) this always works. For REST backends the upstream catalog
+ * owns scan planning; advertising the endpoint here could be misleading when the upstream does
+ * not support it, so we do not advertise it.
+ *
+ * @return {@code true} if the scan-plan endpoint should be advertised
+ */
+ public boolean supportsScanPlanOperations() {
Review Comment:
yes we do now, and this gating is stale as a result.
FederatedCatalogWrapper.planTableScan delegates to the remote catalog (POST {table}/plan, forwarding X-Iceberg-Access-Delegation for vended credentials and rewriting the credential refresh endpoints back to this IRC). That landed in [#10800](https://github.com/apache/gravitino/pull/10800) on Jul 13, a month after this PR was opened, and only reached this branch when I merged main yesterday.
Since FederatedCatalogWrapper extends CatalogWrapperForREST and doesn't override supportsScanPlanOperations(), the inherited !isRESTCatalog() returns false for exactly the catalogs that now support scan planning. So this would hide V1_SUBMIT_TABLE_SCAN_PLAN from /v1/config for REST backends that can actually serve it. The javadoc rationale is wrong too: we don't leave scan planning to the upstream, we proxy to it.
Two ways forward, and I'd like your preference:
Drop the scan-plan gating. Correct today, since every backend supports scan planning. But it leaves [#11584](https://github.com/apache/gravitino/issues/11584) with nothing to gate (view gating already existed before this PR), so this would effectively be closed as obsolete.
Have FederatedCatalogWrapper override supportsScanPlanOperations() to report whether the remote catalog advertises V1_SUBMIT_TABLE_SCAN_PLAN in its own /v1/config. That keeps the capability-derived intent of [#11584](https://github.com/apache/gravitino/issues/11584) and genuinely fixes misleading advertisement for the federation case. Iceberg 1.11's RESTCatalog exposes no accessor for the remote endpoint set, so the wrapper would need its own cached /v1/config fetch; it already builds an HTTP client for the credentials and plan paths.
I lean toward 2, but happy to go with 1 and close this out if you don't think the capability gating justifies the extra remote fetch.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#issuecomment-4697664840
<!-- coverage-report -->
### Code Coverage Report
|Overall Project|67.01% **`+0.04%`**|:green_circle:|
|:-|:-|:-:|
|Files changed|78.26%|:green_circle:|
<br>
|Module|Coverage||
|:-|:-|:-:|
|aliyun|1.72%|:red_circle:|
|api|46.82%|:green_circle:|
|authorization-common|85.96%|:green_circle:|
|aws|3.66%|:red_circle:|
|azure|2.47%|:red_circle:|
|catalog-common|10.4%|:red_circle:|
|catalog-fileset|80.23%|:green_circle:|
|catalog-glue|66.91%|:green_circle:|
|catalog-hive|79.44%|:green_circle:|
|catalog-jdbc-clickhouse|80.02%|:green_circle:|
|catalog-jdbc-common|44.22%|:green_circle:|
|catalog-jdbc-doris|80.28%|:green_circle:|
|catalog-jdbc-hologres|54.03%|:green_circle:|
|catalog-jdbc-mysql|79.23%|:green_circle:|
|catalog-jdbc-oceanbase|78.38%|:green_circle:|
|catalog-jdbc-postgresql|82.29%|:green_circle:|
|catalog-jdbc-starrocks|78.51%|:green_circle:|
|catalog-kafka|77.01%|:green_circle:|
|catalog-lakehouse-generic|58.53%|:green_circle:|
|catalog-lakehouse-hudi|79.1%|:green_circle:|
|catalog-lakehouse-iceberg|85.94%|:green_circle:|
|catalog-lakehouse-paimon|80.02%|:green_circle:|
|catalog-model|77.72%|:green_circle:|
|cli|44.51%|:green_circle:|
|client-java|78.01%|:green_circle:|
|common|50.17%|:green_circle:|
|core|82.38%|:green_circle:|
|filesystem-hadoop3|77.27%|:green_circle:|
|flink|0.0%|:red_circle:|
|flink-common|45.72%|:green_circle:|
|flink-runtime|0.0%|:red_circle:|
|gcp|14.12%|:red_circle:|
|hadoop-common|10.88%|:red_circle:|
|hive-metastore-common|53.77%|:green_circle:|
|iceberg-common|58.15%|:green_circle:|
|iceberg-rest-server|73.98% **`+0.35%`**|:green_circle:|
|idp-basic|86.18%|:green_circle:|
|integration-test-common|0.0%|:red_circle:|
|jobs|66.17%|:green_circle:|
|lance-common|20.83%|:red_circle:|
|lance-rest-server|60.54%|:green_circle:|
|lineage|53.02%|:green_circle:|
|optimizer|82.95%|:green_circle:|
|optimizer-api|21.95%|:red_circle:|
|server|85.73%|:green_circle:|
|server-common|73.79%|:green_circle:|
|spark|28.57%|:red_circle:|
|spark-common|41.66%|:green_circle:|
|trino-connector|40.13%|:green_circle:|
<details>
<summary>Files</summary>
|Module|File|Coverage||
|:-|:-|:-|:-:|
|iceberg-rest-server|[IcebergConfigOperations.java](https://github.com/laserninja/gravitino/blob/de16fa4ea5bf4b24eb21816b2a09fee493b9a64e/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergConfigOperations.java)|98.33%|:green_circle:|
||[CatalogWrapperForREST.java](https://github.com/laserninja/gravitino/blob/de16fa4ea5bf4b24eb21816b2a09fee493b9a64e/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java)|73.22%|:green_circle:|
</details>
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3795755859
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergConfigEndpointGating.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.iceberg.service.rest;
+
+import java.util.Map;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Response;
+import org.apache.gravitino.iceberg.common.IcebergConfig;
+import org.apache.gravitino.iceberg.service.CatalogWrapperForREST;
+import org.apache.gravitino.iceberg.service.IcebergCatalogWrapperManager;
+import org.apache.gravitino.iceberg.service.provider.IcebergConfigProvider;
+import org.apache.iceberg.rest.responses.ConfigResponse;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests that the /v1/config endpoint gates optional endpoints (like scan planning) based on the
+ * catalog backend's capabilities.
+ */
+public class TestIcebergConfigEndpointGating extends IcebergTestBase {
+
+ @Override
+ protected Application configure() {
+ return IcebergRestTestUtil.getIcebergResourceConfig(
Review Comment:
Nit: please avoid the FQN here and add a normal `import java.util.Collections;` instead, consistent with the project style.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "bharos (via GitHub)" <gi...@apache.org>.
bharos commented on PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#issuecomment-5530301566
Thanks for the review @roryqi
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3429824148
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/IcebergRestTestUtil.java:
##########
@@ -139,9 +148,15 @@ public static ResourceConfig getIcebergResourceConfig(
IcebergConfigProvider configProvider = IcebergConfigProviderFactory.create(catalogConf);
configProvider.initialize(catalogConf);
// used to override register table interface
- IcebergCatalogWrapperManager icebergCatalogWrapperManager =
- new IcebergCatalogWrapperManagerForTest(
- catalogConf, configProvider, false, configProvider.getMetalakeName());
+ IcebergCatalogWrapperManager icebergCatalogWrapperManager;
Review Comment:
We should avoid reflection asap. Because reflection lacks necessary check in the compile stage. We can only find the issues in the runtime stage.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3791243717
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -181,6 +181,20 @@ public LoadCredentialsResponse getTableCredentials(
}
}
+ /**
+ * Whether this catalog wrapper supports server-side scan planning.
+ *
+ * <p>Gravitino implements scan planning locally on top of loaded table metadata. For non-REST
+ * backends (Hive, JDBC, Memory, Custom) this always works. For REST backends the upstream catalog
+ * owns scan planning; advertising the endpoint here could be misleading when the upstream does
+ * not support it, so we do not advertise it.
+ *
+ * @return {@code true} if the scan-plan endpoint should be advertised
+ */
+ public boolean supportsScanPlanOperations() {
Review Comment:
Agree with you. Option 2 seems better. You can continue.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#issuecomment-5500053647
@bharos can you review this please
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "bharos (via GitHub)" <gi...@apache.org>.
bharos merged PR #11634:
URL: https://github.com/apache/gravitino/pull/11634
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11584] feat(iceberg-rest): Gate config endpoints by backend capabilities [gravitino]
Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11634:
URL: https://github.com/apache/gravitino/pull/11634#discussion_r3781241256
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/IcebergRestTestUtil.java:
##########
@@ -139,9 +148,15 @@ public static ResourceConfig getIcebergResourceConfig(
IcebergConfigProvider configProvider = IcebergConfigProviderFactory.create(catalogConf);
configProvider.initialize(catalogConf);
// used to override register table interface
- IcebergCatalogWrapperManager icebergCatalogWrapperManager =
- new IcebergCatalogWrapperManagerForTest(
- catalogConf, configProvider, false, configProvider.getMetalakeName());
+ IcebergCatalogWrapperManager icebergCatalogWrapperManager;
Review Comment:
Done - the reflection is gone. `IcebergRestTestUtil` now takes a `WrapperManagerFactory` functional interface, so the wrapper manager construction is resolved at compile time:
```java
@FunctionalInterface
public interface WrapperManagerFactory {
IcebergCatalogWrapperManager create(
Map<String, String> properties,
IcebergConfigProvider configProvider,
boolean auxMode,
String metalakeName);
}
```
Callers pass a constructor reference (`IcebergCatalogWrapperManagerForTest::new`, `NoScanPlanWrapperManager::new`), so a signature mismatch is a compile error instead of a runtime one.
I've also merged the latest main into the branch. `:iceberg:iceberg-rest-server:test` is green (397 tests, 0 failures). The earlier red `build (17)` check was an unrelated OceanBase testcontainer startup failure.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org