Copilot commented on code in PR #19144:
URL: https://github.com/apache/iceberg/pull/19144#discussion_r4696892508
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTScanPlanning.java:
##########
@@ -1569,6 +1571,74 @@ public <T extends RESTResponse> T execute(
.isNotEqualTo(planId);
}
+ @ParameterizedTest
+ @EnumSource(PlanningMode.class)
+ void ioBuilderBuildsFileIOForRemotePlanning(
+ Function<TestPlanningBehavior.Builder, TestPlanningBehavior.Builder>
planMode) {
+ RESTCatalogAdapter adapter =
+ Mockito.spy(
+ new RESTCatalogAdapter(backendCatalog) {
+ @Override
+ public <T extends RESTResponse> T execute(
+ HTTPRequest request,
+ Class<T> responseType,
+ Consumer<ErrorResponse> errorHandler,
+ Consumer<Map<String, String>> responseHeaders,
+ ParserContext parserContext) {
+ T response =
+ super.execute(
+ request, responseType, errorHandler, responseHeaders,
parserContext);
+ if (response instanceof LoadTableResponse loadTableResponse) {
+ return castResponse(
+ responseType,
+ LoadTableResponse.builder()
+ .withTableMetadata(loadTableResponse.tableMetadata())
+ .addAllConfig(loadTableResponse.config())
+ .addConfig("table-config-key", "table-config-value")
+ .build());
+ }
+
+ return maybeAddStorageCredential(response);
+ }
+ });
+
+
adapter.setPlanningBehavior(planMode.apply(TestPlanningBehavior.builder()).build());
+
+ List<Map<String, String>> ioBuilderProperties =
Lists.newCopyOnWriteArrayList();
+ RESTCatalog catalog =
+ new RESTCatalog(SessionCatalog.SessionContext.createEmpty(), (config)
-> adapter) {
+ @Override
+ protected RESTSessionCatalog newSessionCatalog(
+ Function<Map<String, String>, RESTClient> clientBuilder) {
+ return new RESTSessionCatalog(
+ clientBuilder,
+ (context, properties) -> {
+ ioBuilderProperties.add(properties);
+ return
CatalogUtil.loadFileIO(InMemoryFileIO.class.getName(), properties, null);
Review Comment:
The regression test uses an empty session and never checks the context
received by `ioBuilder`, so it would still pass if the scan factory discarded
the load's user context. That leaves user-specific credential selection by
engine-supplied builders untested. Use a non-empty user context and assert that
the plan-scoped builder invocation receives it.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]