-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Iceberg to 1.8 #1126
base: main
Are you sure you want to change the base?
Upgrade Iceberg to 1.8 #1126
Conversation
@@ -215,6 +215,10 @@ public void initialize(String name, Map<String, String> properties) { | |||
name, | |||
this.catalogName); | |||
|
|||
// Ensure catalogProperties is assigned before calling metricsReporter() for proper | |||
// functionality. | |||
catalogProperties = properties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes testCatalogWithCustomMetricsReporter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why it wasn't failing before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case was not covered before and was discovered via a new test added in 1.8, original PR
6597414
to
49fa57b
Compare
cc @gh-yzou |
49fa57b
to
6bfa41c
Compare
@@ -215,6 +215,10 @@ public void initialize(String name, Map<String, String> properties) { | |||
name, | |||
this.catalogName); | |||
|
|||
// Ensure catalogProperties is assigned before calling metricsReporter() for proper | |||
// functionality. | |||
catalogProperties = properties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why it wasn't failing before?
integration-tests/src/main/java/org/apache/polaris/service/it/env/IcebergHelper.java
Outdated
Show resolved
Hide resolved
...ice/src/test/java/org/apache/polaris/service/quarkus/catalog/BasePolarisCatalogViewTest.java
Outdated
Show resolved
Hide resolved
...service/src/test/java/org/apache/polaris/service/quarkus/catalog/BasePolarisCatalogTest.java
Outdated
Show resolved
Hide resolved
0425f53
to
4314016
Compare
file -> | ||
tryDelete( | ||
tableId, fileIO, manifestFile.path(), file.path().toString(), null, 1)) | ||
.map(file -> tryDelete(tableId, fileIO, manifestFile.path(), file.location(), null, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file.path()
is deprecated in 1.8 and replaced by file.location()
. See link
integration-tests/src/main/java/org/apache/polaris/service/it/env/IcebergHelper.java
Outdated
Show resolved
Hide resolved
quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TaskTestUtils.java
Show resolved
Hide resolved
7d0073d
to
2c436f6
Compare
@@ -65,6 +66,10 @@ public abstract class PolarisRestCatalogViewIntegrationBase extends ViewCatalogT | |||
|
|||
@BeforeAll | |||
static void setup(PolarisApiEndpoints apiEndpoints, ClientCredentials credentials) { | |||
// Set preferredAssumptionException as Quarkus does not suppress JUnit4's | |||
// AssumptionViolatedException | |||
org.assertj.core.api.Assumptions.setPreferredAssumptionException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be done via a global ServiceLoader-based class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your advice! Done by using QuarkusTestBeforeClassCallback
public Path createTempDirectory( | ||
AnnotatedElementContext elementContext, ExtensionContext extensionContext) | ||
throws Exception { | ||
Path basePath = Paths.get(BASE_LOCATION.replaceFirst("file://", "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to customize tmp locations?
I'm -1 on this particular diff fragment. It look overly complicated and obscure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the test createViewWithCustomMetadataLocation.
One possible solution is to add the customMetadataLocation
to allowedLocations
when the user specifies it like #193. However, since this feels more like a bug fix, it might be out of scope for this PR.
How about we override and temporarily skip the test for now, and leave a TODO to fix it in a followup PR? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liamzwbao would you mind give some more details about why the test was failing? was it because the customMetadataLocation configured with .withProperty(ViewProperties.WRITE_METADATA_LOCATION, customLocation) is not in the allowed location, and Polaris fails during validation? and you are changing the temp dir here to be under the allowed location?
If it is designed that the provided custom metadata location must be one under allowed location, then adding customMetadataLocation to allowedLocations doesn't sounds the right fix me, and we probably should fix the test. I see we can overwrite the test, one way is to overwrite the test with correct configuration, and provide comments there about why are we overwriting the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was it because the customMetadataLocation configured with .withProperty(ViewProperties.WRITE_METADATA_LOCATION, customLocation) is not in the allowed location, and Polaris fails during validation? and you are changing the temp dir here to be under the allowed location?
Yes.
I've tried overriding the test and adding custom config, but since tempDir
is a private field in the superclass, I can't access it to include it in the storage config when recreating the catalog using managementApi.createCatalog
. The workaround is to hardcode a path like file:///var/folders/6k
as tempDir
is always generated under this path, but it isn't ideal. I have no control over the tempDir
generation unless I rewrite the factory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant completely overwrite the test to use a valid customLocation and location for it. The test seems using
String location = Paths.get(tempDir.toUri().toString()).toString();
String customLocation = Paths.get(tempDir.toUri().toString(), "custom-location").toString();
If BASE_LOCATION is a valid location, then we override the while test as following
TableIdentifier identifier = TableIdentifier.of("ns", "view");
if (requiresNamespaceCreate()) {
catalog().createNamespace(identifier.namespace());
}
assertThat(catalog().viewExists(identifier)).as("View should not exist").isFalse();
String location = BASE_LOCATION;
String customLocation = BASE_LOCATION/custom-location
View view =
catalog()
.buildView(identifier)
.withSchema(SCHEMA)
.withDefaultNamespace(identifier.namespace())
.withDefaultCatalog(catalog().name())
.withQuery("spark", "select * from ns.tbl")
.withProperty(ViewProperties.WRITE_METADATA_LOCATION, customLocation)
.withLocation(location)
.create();
assertThat(view).isNotNull();
assertThat(catalog().viewExists(identifier)).as("View should exist").isTrue();
assertThat(view.properties()).containsEntry("write.metadata.path", customLocation);
assertThat(((BaseView) view).operations().current().metadataFileLocation())
.isNotNull()
.startsWith(customLocation);
In that case, you shouldn't need tempDir anymore. one quick question, is that the only test that is failing?
...ests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationTest.java
Show resolved
Hide resolved
integration-tests/src/main/java/org/apache/polaris/service/it/env/IcebergHelper.java
Outdated
Show resolved
Hide resolved
...kus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java
Outdated
Show resolved
Hide resolved
...kus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java
Show resolved
Hide resolved
4224337
to
d5aaaf3
Compare
private static class CustomTempDirFactory implements TempDirFactory { | ||
@Override | ||
public Path createTempDirectory( | ||
AnnotatedElementContext elementContext, ExtensionContext extensionContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that temp dir creation for the same reason as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
d5aaaf3
to
0e2956c
Compare
Changes
TableMetadata.addSchema
methodENDPOINTS
inIcebergCatalogAdapter
initCatalog
method inCatalogTests
PreferredAssumptionException
to JUnit5 inPolarisRestCatalogIntegrationTest
andBasePolarisCatalogTest
due to:Assumptions.assertThat
of AssertJ, used inCatalogTests
in Iceberg, is incompatible with Quarkus, see Support Assumptions.assumeThat in Quarkus quarkusio/quarkus#46642.listNamespacesWithEmptyNamespace
. Consider whether to align this behavior.createViewWithCustomMetadataLocation
inQuarkusRestCatalogViewFileIT
andQuarkusRestCatalogViewFileIntegrationTest
by ensuring that thetempDir
remains withinBASE_LOCATION
.write.metadata.path
toAllowedLocations
inBasePolarisCatalogViewBuilder
when specified by the user, similar to Add support for customer write.data.path and write.metadata.path with test for object store location provider #193.