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


##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java:
##########
@@ -209,18 +210,28 @@ 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 (GlueException e) {
+          awsProperties.setS3PrefetchClientEnabled(false);
+          LOG.warn("Suppressing failure when getting Glue table", e);

Review Comment:
   logging warning already means suppressing failure, no need to say that 
again. Maybe `"Fail to get Glue table information, cannot determine S3 prefetch 
strategy"`?
   
   Also this will hit error very often, especially for new table creation. We 
should do debug log level.



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