Skip to content

Commit f3a5ef0

Browse files
committed
Delete the interface in FileIOFactory that is only used for testing
1 parent 519e0b6 commit f3a5ef0

File tree

7 files changed

+12
-71
lines changed

7 files changed

+12
-71
lines changed

quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/io/FileIOExceptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
import org.apache.polaris.core.admin.model.FileStorageConfigInfo;
3939
import org.apache.polaris.core.admin.model.PolarisCatalog;
4040
import org.apache.polaris.core.admin.model.StorageConfigInfo;
41-
import org.apache.polaris.service.catalog.io.TestFileIOFactory;
4241
import org.apache.polaris.service.TestServices;
42+
import org.apache.polaris.service.catalog.io.TestFileIOFactory;
4343
import org.junit.jupiter.api.BeforeAll;
4444
import org.junit.jupiter.api.BeforeEach;
4545
import org.junit.jupiter.params.ParameterizedTest;

service/common/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@
4040
import java.util.stream.Collectors;
4141
import java.util.stream.Stream;
4242
import org.apache.commons.lang3.exception.ExceptionUtils;
43+
import org.apache.hadoop.conf.Configuration;
4344
import org.apache.iceberg.BaseMetastoreTableOperations;
4445
import org.apache.iceberg.BaseTable;
4546
import org.apache.iceberg.CatalogProperties;
47+
import org.apache.iceberg.CatalogUtil;
4648
import org.apache.iceberg.Schema;
4749
import org.apache.iceberg.Table;
4850
import org.apache.iceberg.TableMetadata;
@@ -325,7 +327,7 @@ public Table registerTable(TableIdentifier identifier, String metadataFileLocati
325327
String.format("Failed to fetch resolved parent for TableIdentifier '%s'", identifier));
326328
}
327329
FileIO fileIO =
328-
refreshIOForTableLike(
330+
loadFileIOForTableLike(
329331
identifier,
330332
Set.of(locationDir),
331333
resolvedParent,
@@ -1194,7 +1196,7 @@ public void doRefresh() {
11941196
// then we should use the actual current table properties for IO refresh here
11951197
// instead of the general tableDefaultProperties.
11961198
FileIO fileIO =
1197-
refreshIOForTableLike(
1199+
loadFileIOForTableLike(
11981200
tableIdentifier,
11991201
Set.of(latestLocationDir),
12001202
resolvedEntities,
@@ -1230,7 +1232,7 @@ public void doCommit(TableMetadata base, TableMetadata metadata) {
12301232

12311233
// refresh credentials because we need to read the metadata file to validate its location
12321234
tableFileIO =
1233-
refreshIOForTableLike(
1235+
loadFileIOForTableLike(
12341236
tableIdentifier,
12351237
getLocationsAllowedToBeAccessed(metadata),
12361238
resolvedStorageEntity,
@@ -1414,7 +1416,7 @@ public void doRefresh() {
14141416
// then we should use the actual current table properties for IO refresh here
14151417
// instead of the general tableDefaultProperties.
14161418
FileIO fileIO =
1417-
refreshIOForTableLike(
1419+
loadFileIOForTableLike(
14181420
identifier,
14191421
Set.of(latestLocationDir),
14201422
resolvedEntities,
@@ -1468,7 +1470,7 @@ public void doCommit(ViewMetadata base, ViewMetadata metadata) {
14681470
Map<String, String> tableProperties = new HashMap<>(metadata.properties());
14691471

14701472
viewFileIO =
1471-
refreshIOForTableLike(
1473+
loadFileIOForTableLike(
14721474
identifier,
14731475
getLocationsAllowedToBeAccessed(metadata),
14741476
resolvedStorageEntity,
@@ -1525,7 +1527,7 @@ protected String viewName() {
15251527
}
15261528
}
15271529

1528-
private FileIO refreshIOForTableLike(
1530+
private FileIO loadFileIOForTableLike(
15291531
TableIdentifier identifier,
15301532
Set<String> readLocations,
15311533
PolarisResolvedPathWrapper resolvedStorageEntity,
@@ -1839,7 +1841,7 @@ private boolean sendNotificationForTableLike(
18391841

18401842
// Validate that we can construct a FileIO
18411843
String locationDir = metadataLocation.substring(0, metadataLocation.lastIndexOf("/"));
1842-
refreshIOForTableLike(
1844+
loadFileIOForTableLike(
18431845
tableIdentifier,
18441846
Set.of(locationDir),
18451847
resolvedStorageEntity,
@@ -1894,7 +1896,7 @@ private boolean sendNotificationForTableLike(
18941896
String locationDir = newLocation.substring(0, newLocation.lastIndexOf("/"));
18951897

18961898
FileIO fileIO =
1897-
refreshIOForTableLike(
1899+
loadFileIOForTableLike(
18981900
tableIdentifier,
18991901
Set.of(locationDir),
19001902
resolvedParent,
@@ -1973,8 +1975,7 @@ private List<TableIdentifier> listTableLike(PolarisEntitySubType subType, Namesp
19731975
* @return FileIO object
19741976
*/
19751977
private FileIO loadFileIO(String ioImpl, Map<String, String> properties) {
1976-
Map<String, String> propertiesWithS3CustomizedClientFactory = new HashMap<>(properties);
1977-
return fileIOFactory.loadFileIO(realmId, ioImpl, propertiesWithS3CustomizedClientFactory);
1978+
return CatalogUtil.loadFileIO(ioImpl, properties, new Configuration());
19781979
}
19791980

19801981
private void blockedUserSpecifiedWriteLocation(Map<String, String> properties) {

service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ public DefaultFileIOFactory(
6868
this.configurationStore = configurationStore;
6969
}
7070

71-
@Override
72-
public FileIO loadFileIO(
73-
@Nonnull RealmId realmId,
74-
@Nonnull String ioImplClassName,
75-
@Nonnull Map<String, String> properties) {
76-
return loadFileIOInternal(ioImplClassName, properties);
77-
}
78-
7971
@Override
8072
public FileIO loadFileIO(
8173
@Nonnull RealmId realmId,

service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOFactory.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
*/
3636
public interface FileIOFactory {
3737

38-
/** This method is intended for use in tests only. */
39-
FileIO loadFileIO(
40-
@Nonnull RealmId realmId,
41-
@Nonnull String ioImplClassName,
42-
@Nonnull Map<String, String> properties);
43-
4438
/**
4539
* Loads a FileIO implementation for a specific table in the given realm with detailed config.
4640
*

service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ public WasbTranslatingFileIOFactory(
5050
realmEntityManagerFactory, metaStoreManagerFactory, configurationStore);
5151
}
5252

53-
@Override
54-
public FileIO loadFileIO(
55-
@Nonnull RealmId realmId,
56-
@Nonnull String ioImplClassName,
57-
@Nonnull Map<String, String> properties) {
58-
return new WasbTranslatingFileIO(
59-
defaultFileIOFactory.loadFileIO(realmId, ioImplClassName, properties));
60-
}
61-
6253
@Override
6354
public FileIO loadFileIO(
6455
@Nonnull RealmId realmId,

service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,6 @@ public void after() {
120120
metaStoreManager.purge(metaStoreSession);
121121
}
122122

123-
@Test
124-
public void testLoadFileIOForCatalog() {
125-
String testProperty = "test.property";
126-
FileIOFactory fileIOFactory =
127-
new DefaultFileIOFactory(
128-
realmEntityManagerFactory, metaStoreManagerFactory, configurationStore) {
129-
@Override
130-
FileIO loadFileIOInternal(
131-
@Nonnull String ioImplClassName, @Nonnull Map<String, String> properties) {
132-
org.assertj.core.api.Assertions.assertThat(properties)
133-
.containsEntry(testProperty, "true");
134-
return super.loadFileIOInternal(ioImplClassName, properties);
135-
}
136-
};
137-
fileIOFactory.loadFileIO(realmId, InMemoryFileIO.class.getName(), Map.of(testProperty, "true"));
138-
}
139-
140123
@Test
141124
public void testLoadFileIOForTableLike() {
142125
String storageLocation = "s3://my-bucket/path/to/data";

service/common/src/testFixtures/java/org/apache/polaris/service/catalog/io/TestFileIOFactory.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,6 @@ public TestFileIOFactory(
6262
realmEntityManagerFactory, metaStoreManagerFactory, configurationStore);
6363
}
6464

65-
@Override
66-
public FileIO loadFileIO(
67-
@Nonnull RealmId realmId,
68-
@Nonnull String ioImplClassName,
69-
@Nonnull Map<String, String> properties) {
70-
loadFileIOExceptionSupplier.ifPresent(
71-
s -> {
72-
throw s.get();
73-
});
74-
75-
TestFileIO wrapped =
76-
new TestFileIO(
77-
defaultFileIOFactory.loadFileIO(realmId, ioImplClassName, properties),
78-
newInputFileExceptionSupplier,
79-
newOutputFileExceptionSupplier,
80-
getLengthExceptionSupplier);
81-
ios.add(wrapped);
82-
return wrapped;
83-
}
84-
8565
@Override
8666
public FileIO loadFileIO(
8767
@Nonnull RealmId realmId,

0 commit comments

Comments
 (0)