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


##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java:
##########
@@ -209,18 +209,27 @@ void initialize(
   @Override
   protected TableOperations newTableOps(TableIdentifier tableIdentifier) {
     if (catalogProperties != null) {
-      Map<String, String> tableSpecificCatalogProperties =
-          ImmutableMap.<String, String>builder()
-              .putAll(catalogProperties)
-              .put(
-                  AwsProperties.LAKE_FORMATION_DB_NAME,
-                  IcebergToGlueConverter.getDatabaseName(
-                      tableIdentifier, 
awsProperties.glueCatalogSkipNameValidation()))
-              .put(
-                  AwsProperties.LAKE_FORMATION_TABLE_NAME,
-                  IcebergToGlueConverter.getTableName(
-                      tableIdentifier, 
awsProperties.glueCatalogSkipNameValidation()))
-              .build();
+      Map<String, String> tableSpecificCatalogProperties = 
Maps.newHashMap(catalogProperties);
+      tableSpecificCatalogProperties.put(
+          AwsProperties.LAKE_FORMATION_DB_NAME,
+          IcebergToGlueConverter.getDatabaseName(
+              tableIdentifier, awsProperties.glueCatalogSkipNameValidation()));
+      tableSpecificCatalogProperties.put(
+          AwsProperties.LAKE_FORMATION_TABLE_NAME,
+          IcebergToGlueConverter.getTableName(
+              tableIdentifier, awsProperties.glueCatalogSkipNameValidation()));
+      if (awsProperties.glueLakeFormationEnabled()) {
+        try {
+          glue.getTable(
+              GetTableRequest.builder()
+                  .databaseName(tableIdentifier.namespace().toString())
+                  .name(tableIdentifier.name())
+                  .build());
+          awsProperties.setS3PrefetchClientEnabled(true);
+        } catch (EntityNotFoundException ignored) {

Review Comment:
   I think we want to catch all possible exceptions here to avoid this path 
failing, and also log warning



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