Skip to content

Commit 1e53999

Browse files
cosmetic changes
1 parent a6c8688 commit 1e53999

File tree

6 files changed

+47
-106
lines changed

6 files changed

+47
-106
lines changed

core/src/main/java/org/apache/iceberg/RESTTableScan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private CloseableIterable<FileScanTask> fetchPlanningResult(String planId) {
217217

218218
private CloseableIterable<FileScanTask> scanTasksIterable(
219219
List<String> planTasks, List<FileScanTask> fileScanTasks) {
220-
if (!planTasks.isEmpty()) {
220+
if (planTasks != null && !planTasks.isEmpty()) {
221221
Endpoint.check(supportedEndpoints, Endpoint.V1_FETCH_TABLE_SCAN_PLAN_TASKS);
222222
}
223223

core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import org.apache.iceberg.FilesTable;
4646
import org.apache.iceberg.HasTableOperations;
4747
import org.apache.iceberg.HistoryEntry;
48-
import org.apache.iceberg.PartitionData;
4948
import org.apache.iceberg.PartitionSpec;
5049
import org.apache.iceberg.ReachableFileUtil;
5150
import org.apache.iceberg.ReplaceSortOrder;
@@ -3374,24 +3373,4 @@ private List<Namespace> concat(List<Namespace> starting, Namespace... additional
33743373
namespaces.addAll(Arrays.asList(additional));
33753374
return namespaces;
33763375
}
3377-
3378-
protected void assertBoundFileScanTasks(Table table, PartitionSpec partitionSpec) {
3379-
PartitionData partitionData = new PartitionData(partitionSpec.partitionType());
3380-
try (CloseableIterable<FileScanTask> tasks = table.newScan().planFiles()) {
3381-
Streams.stream(tasks)
3382-
.forEach(
3383-
task -> {
3384-
// assert file scan task spec being bound
3385-
assertThat(task.spec().equals(partitionSpec));
3386-
// assert data file spec being bound
3387-
assertThat(task.file().partition().equals(partitionData));
3388-
// assert all delete files in task are bound
3389-
task.deletes()
3390-
.forEach(
3391-
deleteFile -> assertThat(deleteFile.partition().equals(partitionData)));
3392-
});
3393-
} catch (IOException e) {
3394-
throw new UncheckedIOException(e);
3395-
}
3396-
}
33973376
}

core/src/test/java/org/apache/iceberg/rest/RESTCatalogAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ public <T extends RESTResponse> T handleRequest(
313313
catalog,
314314
ident,
315315
request,
316-
planningBehavior::shouldPlanTableScanAsync,
317-
scan -> planningBehavior.numberFileScanTasksPerPlanTask()));
316+
planningBehavior()::shouldPlanTableScanAsync,
317+
scan -> planningBehavior().numberFileScanTasksPerPlanTask()));
318318
}
319319

320320
case FETCH_PLANNING_RESULT:

core/src/test/java/org/apache/iceberg/rest/RESTCatalogTestInfrastructure.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public <T extends RESTResponse> T execute(
8383
Class<T> responseType,
8484
Consumer<ErrorResponse> errorHandler,
8585
Consumer<Map<String, String>> responseHeaders) {
86+
// this doesn't use a Mockito spy because this is used for catalog tests, which have
87+
// different method calls
8688
if (!ResourcePaths.tokens().equals(request.path())) {
8789
if (ResourcePaths.config().equals(request.path())) {
8890
assertThat(request.headers().entries()).containsAll(catalogHeaders.entries());
@@ -203,7 +205,8 @@ public <T> T roundTripSerialize(T payload, String description) {
203205
}
204206
return (T) reader.readValue(MAPPER.writeValueAsString(message));
205207
} else {
206-
return payload;
208+
// use Map so that Jackson doesn't try to instantiate ImmutableMap from payload.getClass()
209+
return (T) MAPPER.readValue(MAPPER.writeValueAsString(payload), Map.class);
207210
}
208211
} catch (JsonProcessingException e) {
209212
throw new RuntimeException(

core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import static org.mockito.Mockito.times;
3131
import static org.mockito.Mockito.verify;
3232

33-
import com.fasterxml.jackson.databind.ObjectMapper;
3433
import java.io.IOException;
3534
import java.nio.file.Path;
3635
import java.util.List;
@@ -100,15 +99,11 @@
10099
import org.mockito.stubbing.Answer;
101100

102101
public class TestRESTCatalog extends CatalogTests<RESTCatalog> {
103-
104-
private static final ObjectMapper MAPPER = RESTObjectMapper.mapper();
105102
private static final ResourcePaths RESOURCE_PATHS =
106103
ResourcePaths.forCatalogProperties(Maps.newHashMap());
107104

108105
@TempDir protected Path temp;
109-
110106
protected RESTCatalogTestInfrastructure infrastructure = new RESTCatalogTestInfrastructure();
111-
112107
// Expose infrastructure components as protected fields for backward compatibility with tests
113108
protected RESTCatalog restCatalog;
114109
protected InMemoryCatalog backendCatalog;

0 commit comments

Comments
 (0)