jackye1995 commented on code in PR #4423:
URL: https://github.com/apache/iceberg/pull/4423#discussion_r897386069
##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java:
##########
@@ -158,7 +165,31 @@ protected void doCommit(TableMetadata base, TableMetadata
metadata) {
}
} finally {
cleanupMetadataAndUnlock(commitStatus, newMetadataLocation);
+ if (glueTempTableCreated && commitStatus != CommitStatus.SUCCESS) {
+
glue.deleteTable(DeleteTableRequest.builder().databaseName(databaseName).name(tableName).build());
+ }
+ }
+ }
+
+ private boolean createGlueTempTable(TableMetadata base, String
metadataLocation) {
+ try {
+ 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()
+ .parameters(ImmutableMap.of(TABLE_TYPE_PROP,
ICEBERG_TABLE_TYPE_VALUE))
+ .name(tableName)
+
.storageDescriptor(StorageDescriptor.builder().location(metadataLocation).build())
+ .build())
+ .build());
+ return true;
+ }
+ } catch (GlueException e) {
+ return false;
Review Comment:
I think it should not mute the exception, the operation should fail if temp
table creation fails
##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java:
##########
@@ -158,7 +165,31 @@ protected void doCommit(TableMetadata base, TableMetadata
metadata) {
}
} finally {
cleanupMetadataAndUnlock(commitStatus, newMetadataLocation);
+ if (glueTempTableCreated && commitStatus != CommitStatus.SUCCESS) {
+
glue.deleteTable(DeleteTableRequest.builder().databaseName(databaseName).name(tableName).build());
+ }
+ }
+ }
+
+ private boolean createGlueTempTable(TableMetadata base, String
metadataLocation) {
+ try {
+ 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()
+ .parameters(ImmutableMap.of(TABLE_TYPE_PROP,
ICEBERG_TABLE_TYPE_VALUE))
+ .name(tableName)
+
.storageDescriptor(StorageDescriptor.builder().location(metadataLocation).build())
+ .build())
+ .build());
+ return true;
+ }
+ } catch (GlueException e) {
+ return false;
}
+ return false;
Review Comment:
nit: newline after control statement
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]