Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d153e49
Upgrade Iceberg to 1.8.1
liamzwbao Feb 17, 2025
9efde2a
Skip tests using Junit Assumptions
liamzwbao Feb 26, 2025
a472d6a
Fix `testCatalogWithCustomMetricsReporter` in `BasePolarisCatalogTest`
liamzwbao Feb 27, 2025
161c9b5
Skip `listNamespacesWithEmptyNamespace` and add comments
liamzwbao Feb 28, 2025
76b4e1e
Fix `defaultViewProperties` in `ViewCatalogTests`
liamzwbao Feb 28, 2025
f09a063
Fix `createViewWithCustomMetadataLocation` in `ViewCatalogTests`
liamzwbao Mar 5, 2025
2358462
Fix tests for Iceberg API token endpoint
liamzwbao Mar 5, 2025
6da77df
Fix regtests
liamzwbao Mar 6, 2025
828af4b
Set preferredAssumptionException to JUnit5
liamzwbao Mar 11, 2025
0251608
Fix warnings
liamzwbao Mar 12, 2025
71f8e13
Upgrade Iceberg version for regtests and docs
liamzwbao Mar 19, 2025
9e3f7f6
Add comment libs.versions.toml
liamzwbao Mar 20, 2025
1ceba74
Revert changes in IcebergHelper
liamzwbao Mar 20, 2025
71d79cc
Refactor tests to remove allow_overlap config
liamzwbao Mar 21, 2025
72e6f32
Config AssertJ using `QuarkusTestBeforeClassCallback`
liamzwbao Mar 23, 2025
8030aaa
Remove `CustomTempDirFactory` and override test
liamzwbao Mar 24, 2025
4c3ce1f
Disable tests that are not applicable to Polaris
liamzwbao Mar 26, 2025
a79dadd
Add TODOs and link the issues
liamzwbao Mar 27, 2025
6ad7411
Extract testInfo in `@BeforeEach`
liamzwbao Mar 28, 2025
b4556e8
Exclude JUnit4 dependency for module `polaris-quarkus-service`
liamzwbao Mar 30, 2025
e8392fb
Change `restCatalogConfig` to Map
liamzwbao Mar 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion getting-started/spark/notebooks/SparkPolaris.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
"\n",
"spark = (SparkSession.builder\n",
" .config(\"spark.sql.catalog.spark_catalog\", \"org.apache.iceberg.spark.SparkSessionCatalog\")\n",
" .config(\"spark.jars.packages\", \"org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.7.1,org.apache.hadoop:hadoop-aws:3.4.0,software.amazon.awssdk:bundle:2.23.19,software.amazon.awssdk:url-connection-client:2.23.19\")\n",
" .config(\"spark.jars.packages\", \"org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.8.1,org.apache.hadoop:hadoop-aws:3.4.0,software.amazon.awssdk:bundle:2.23.19,software.amazon.awssdk:url-connection-client:2.23.19\")\n",
" .config('spark.sql.iceberg.vectorization.enabled', 'false')\n",
" \n",
" # Configure the 'polaris' catalog as an Iceberg rest catalog\n",
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

[versions]
hadoop = "3.4.1"
iceberg = "1.7.1"
iceberg = "1.8.1" # Ensure to update the iceberg version in regtests to keep regtests up-to-date
quarkus = "3.19.4"
immutables = "2.10.1"
picocli = "4.7.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ public void testIcebergRegisterTableInExternalCatalog() throws IOException {
.assignUUID()
.addPartitionSpec(PartitionSpec.unpartitioned())
.addSortOrder(SortOrder.unsorted())
.addSchema(
new Schema(Types.NestedField.of(1, false, "col1", Types.StringType.get())), 1)
.addSchema(new Schema(Types.NestedField.of(1, false, "col1", Types.StringType.get())))
.build();
TableMetadataParser.write(tableMetadata, fileIo.newOutputFile(metadataLocation));

Expand Down Expand Up @@ -498,7 +497,7 @@ public void testIcebergUpdateTableInExternalCatalog() throws IOException {
.assignUUID()
.addPartitionSpec(PartitionSpec.unpartitioned())
.addSortOrder(SortOrder.unsorted())
.addSchema(new Schema(col1), 1)
.addSchema(new Schema(col1))
.build();
TableMetadataParser.write(tableMetadata, fileIo.newOutputFile(metadataLocation));

Expand Down Expand Up @@ -546,8 +545,7 @@ public void testIcebergDropTableInExternalCatalog() throws IOException {
.assignUUID()
.addPartitionSpec(PartitionSpec.unpartitioned())
.addSortOrder(SortOrder.unsorted())
.addSchema(
new Schema(Types.NestedField.of(1, false, "col1", Types.StringType.get())), 1)
.addSchema(new Schema(Types.NestedField.of(1, false, "col1", Types.StringType.get())))
.build();
TableMetadataParser.write(tableMetadata, fileIo.newOutputFile(metadataLocation));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
import org.apache.polaris.core.admin.model.ViewGrant;
import org.apache.polaris.core.admin.model.ViewPrivilege;
import org.apache.polaris.core.config.FeatureConfiguration;
import org.apache.polaris.core.config.PolarisConfiguration;
import org.apache.polaris.core.entity.CatalogEntity;
import org.apache.polaris.core.entity.PolarisEntityConstants;
import org.apache.polaris.service.it.env.CatalogApi;
Expand Down Expand Up @@ -105,7 +104,7 @@
* @implSpec @implSpec This test expects the server to be configured with the following features
* configured:
* <ul>
* <li>{@link PolarisConfiguration#ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING}: {@code false}
* <li>{@link FeatureConfiguration#ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING}: {@code false}
* </ul>
*/
@ExtendWith(PolarisIntegrationTestExtension.class)
Expand All @@ -118,16 +117,16 @@ public class PolarisRestCatalogIntegrationTest extends CatalogTests<RESTCatalog>
private static URI externalCatalogBase;

protected static final String VIEW_QUERY = "select * from ns1.layer1_table";
private static String principalRoleName;
private static ClientCredentials adminCredentials;
private static PrincipalWithCredentials principalCredentials;
private static PolarisApiEndpoints endpoints;
private static PolarisClient client;
private static ManagementApi managementApi;
private static CatalogApi catalogApi;

private PrincipalWithCredentials principalCredentials;
private CatalogApi catalogApi;
private RESTCatalog restCatalog;
private String currentCatalogName;
private Map<String, String> restCatalogConfig;

private final String catalogBaseLocation =
s3BucketBase + "/" + System.getenv("USER") + "/path/to/data";
Expand Down Expand Up @@ -159,10 +158,6 @@ static void setup(
endpoints = apiEndpoints;
client = polarisClient(endpoints);
managementApi = client.managementApi(credentials);
String principalName = client.newEntityName("snowman-rest");
principalRoleName = client.newEntityName("rest-admin");
principalCredentials = managementApi.createPrincipalWithRole(principalName, principalRoleName);
catalogApi = client.catalogApi(principalCredentials);
URI testRootUri = IntegrationTestsHelper.getTemporaryDirectory(tempDir);
s3BucketBase = testRootUri.resolve("my-bucket");
externalCatalogBase = testRootUri.resolve("external-catalog");
Expand All @@ -175,10 +170,9 @@ static void close() throws Exception {

@BeforeEach
public void before(TestInfo testInfo) {
String principalName = "snowman-rest-" + UUID.randomUUID();
principalRoleName = "rest-admin-" + UUID.randomUUID();
PrincipalWithCredentials principalCredentials =
managementApi.createPrincipalWithRole(principalName, principalRoleName);
String principalName = client.newEntityName("snowman-rest");
String principalRoleName = client.newEntityName("rest-admin");
principalCredentials = managementApi.createPrincipalWithRole(principalName, principalRoleName);

catalogApi = client.catalogApi(principalCredentials);

Expand Down Expand Up @@ -219,29 +213,26 @@ public void before(TestInfo testInfo) {

managementApi.createCatalog(principalRoleName, catalog);

Optional<PolarisRestCatalogIntegrationTest.RestCatalogConfig> restCatalogConfig =
restCatalogConfig =
testInfo
.getTestMethod()
.flatMap(
m ->
Optional.ofNullable(
m.getAnnotation(
PolarisRestCatalogIntegrationTest.RestCatalogConfig.class)));
ImmutableMap.Builder<String, String> extraPropertiesBuilder = ImmutableMap.builder();
restCatalogConfig.ifPresent(
config -> {
for (int i = 0; i < config.value().length; i += 2) {
extraPropertiesBuilder.put(config.value()[i], config.value()[i + 1]);
}
});

restCatalog =
IcebergHelper.restCatalog(
client,
endpoints,
principalCredentials,
currentCatalogName,
extraPropertiesBuilder.build());
.map(m -> m.getAnnotation(RestCatalogConfig.class))
.map(RestCatalogConfig::value)
.map(
values -> {
if (values.length % 2 != 0) {
throw new IllegalArgumentException(
String.format("Missing value for config '%s'", values[values.length - 1]));
}
Map<String, String> config = new HashMap<>();
for (int i = 0; i < values.length; i += 2) {
config.put(values[i], values[i + 1]);
}
return config;
})
.orElse(ImmutableMap.of());

restCatalog = initCatalog(currentCatalogName, ImmutableMap.of());
}

@AfterEach
Expand All @@ -254,6 +245,26 @@ protected RESTCatalog catalog() {
return restCatalog;
}

/**
* Initialize a RESTCatalog for testing.
*
* @param catalogName this parameter is currently unused.
* @param additionalProperties additional properties to apply on top of the default test settings
* @return a configured instance of RESTCatalog
*/
@Override
protected RESTCatalog initCatalog(String catalogName, Map<String, String> additionalProperties) {
ImmutableMap.Builder<String, String> extraPropertiesBuilder = ImmutableMap.builder();
extraPropertiesBuilder.putAll(restCatalogConfig);
extraPropertiesBuilder.putAll(additionalProperties);
return IcebergHelper.restCatalog(
client,
endpoints,
principalCredentials,
currentCatalogName,
extraPropertiesBuilder.buildKeepingLast());
}

@Override
protected boolean requiresNamespaceCreate() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.ExtendWith;

Expand Down Expand Up @@ -113,7 +115,16 @@ public void before(TestInfo testInfo) {
managementApi.createCatalog(principalRoleName, catalog);

restCatalog =
IcebergHelper.restCatalog(client, endpoints, principalCredentials, catalogName, Map.of());
IcebergHelper.restCatalog(
client,
endpoints,
principalCredentials,
catalogName,
Map.of(
org.apache.iceberg.CatalogProperties.VIEW_DEFAULT_PREFIX + "key1",
"catalog-default-key1",
org.apache.iceberg.CatalogProperties.VIEW_DEFAULT_PREFIX + "key2",
"catalog-default-key2"));
}

@AfterEach
Expand Down Expand Up @@ -156,4 +167,16 @@ protected boolean supportsServerSideRetry() {
protected boolean overridesRequestedLocation() {
return true;
}

/** TODO: Unblock this test, see: https://github.com/apache/polaris/issues/1273 */
@Override
@Test
@Disabled(
"""
Disabled because the behavior is not applicable to Polaris.
To unblock, update this to expect an exception and add a Polaris-specific test.
""")
public void createViewWithCustomMetadataLocation() {
super.createViewWithCustomMetadataLocation();
}
}
5 changes: 5 additions & 0 deletions quarkus/service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ plugins {
id("polaris-quarkus")
}

configurations.all {
// exclude junit4 dependency for this module
exclude(group = "junit", module = "junit")
}

dependencies {
implementation(project(":polaris-core"))
implementation(project(":polaris-api-management-service"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ public Catalog createCallContextCatalog(
FileIO fileIO = CatalogUtil.loadFileIO(fileIoImpl, Map.of(), new Configuration());
TableMetadata tableMetadata =
TableMetadata.buildFromEmpty()
.addSchema(SCHEMA, SCHEMA.highestFieldId())
.addSchema(SCHEMA)
.setLocation(
String.format("%s/bucket/table/metadata/v1.metadata.json", storageLocation))
.addPartitionSpec(PartitionSpec.unpartitioned())
Expand Down
Loading