-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
AWS: Use provided glue catalog id in defaultWarehouseLocation #6223
AWS: Use provided glue catalog id in defaultWarehouseLocation #6223
Conversation
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.
LGTM ! Thanks @grbinho .
You can add a UT for now it by mocking GetDatabase request and making sure catalogId passed in it. can ref this existing test
cc @jackye1995
I added a unit test with |
@@ -144,6 +144,32 @@ public void testDefaultWarehouseLocationDbUri() { | |||
Assert.assertEquals("s3://bucket2/db/table", location); | |||
} | |||
|
|||
@Test | |||
public void testDefaultWarehouseLocationCustomCatalogId() { |
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.
The integration tests in TestGlueCatalogNamespace
also don't set the catalogId, do we need to set it in those files also?
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.
Are there multiple AWS accounts available for integration tests?
I could not find that setup either in AwsIntegTestUtil
or TestAssumeRoleAwsClientFactory
(as and obvious potential cross account example).
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.
I presume it is a single account.
The Integration testcase can be executed by exporting the mentioned environment variables (#4855)
Thanks for the clarification. may be no need of catalog id for these tests.
…ters are now used instead of a constructor map.
@ajantha-bhat Can you please do another quick check. I changed how |
LGTM |
@ajantha-bhat @singhpk234 |
cc: @Fokko, @rdblue, @RussellSpitzer, @jackye1995 |
aws/src/test/java/org/apache/iceberg/aws/glue/TestGlueCatalog.java
Outdated
Show resolved
Hide resolved
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.
LGTM!
Additional note: I checked other request builders in GlueCatalog
and GlueTableOperations
and found that these two requests also not include the catalogId
:
I wonder if we shall also add catalogId
to these two requests (may be in another PR)
CreateTableRequest
in:
iceberg/aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java
Lines 221 to 230 in 4caf1b4
private boolean createGlueTempTableIfNecessary(TableMetadata base, String metadataLocation) { | |
if (awsProperties.glueLakeFormationEnabled() && base == null) { | |
// LakeFormation credential require TableArn as input,so creating a dummy table | |
// beforehand for create table scenario | |
glue.createTable( | |
CreateTableRequest.builder() | |
.databaseName(databaseName) | |
.tableInput( | |
TableInput.builder() |
DeleteTableRequest
in
iceberg/aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java
Lines 243 to 249 in 4caf1b4
private void cleanupGlueTempTableIfNecessary( | |
boolean glueTempTableCreated, CommitStatus commitStatus) { | |
if (glueTempTableCreated && commitStatus != CommitStatus.SUCCESS) { | |
glue.deleteTable( | |
DeleteTableRequest.builder().databaseName(databaseName).name(tableName).build()); | |
} | |
} |
For That said, I'm not that familiar with the code base enough to be sure it's unnecessary. Maybe @amogh-jahagirdar knows? |
@JonasJ-ap @ajantha-bhat |
Running CI. |
Thanks, @grbinho! |
defaultWarehouseLocation
call toglue.getDatabase
did not set catalog id while building a request.This results in
software.amazon.awssdk.services.glue.model.EntityNotFoundException: Database my_database not found.
error when table is being created in another AWS account.More details are in #6215
@singhpk234
If you can take a look, it would be appreciated.
I did not add any tests for it since I saw that similar tests for other methods do not exist.