jackye1995 commented on code in PR #4423:
URL: https://github.com/apache/iceberg/pull/4423#discussion_r856526334


##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java:
##########
@@ -111,10 +114,24 @@ protected void doRefresh() {
 
   @Override
   protected void doCommit(TableMetadata base, TableMetadata metadata) {
-    String newMetadataLocation = writeNewMetadata(metadata, currentVersion() + 
1);
     CommitStatus commitStatus = CommitStatus.FAILURE;
-
+    String newMetadataLocation = null;
+    boolean glueTempTableCreated = false;
     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(metadata.location()).build())
+                .build()).build());

Review Comment:
   newline needed between 2 `build()`



##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueTableOperations.java:
##########
@@ -111,10 +114,24 @@ protected void doRefresh() {
 
   @Override
   protected void doCommit(TableMetadata base, TableMetadata metadata) {
-    String newMetadataLocation = writeNewMetadata(metadata, currentVersion() + 
1);
     CommitStatus commitStatus = CommitStatus.FAILURE;
-
+    String newMetadataLocation = null;
+    boolean glueTempTableCreated = false;
     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(metadata.location()).build())
+                .build()).build());

Review Comment:
   newline needed between 2 `build()`



-- 
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]

Reply via email to