jishangarg opened a new pull request, #11165: URL: https://github.com/apache/iceberg/pull/11165
This PR addresses an issue in the AWS Glue renameTable method where an incorrect exception is thrown when a table with the new name already exists. According to the Iceberg Catalog interface, the method should throw org.apache.iceberg.exceptions.AlreadyExistsException. However, it currently throws software.amazon.awssdk.services.glue.model.AlreadyExistsException, leading to inconsistent behavior. Problem: The renameTable method throws an AWS Glue-specific AlreadyExistsException instead of the expected Iceberg-specific AlreadyExistsException. This violates the contract defined by the Iceberg Catalog interface and can cause confusion for applications relying on the Iceberg exception handling. Solution: Updated the glue.createTable() call: The AlreadyExistsException from AWS Glue is now caught and rethrown as Iceberg’s org.apache.iceberg.exceptions.AlreadyExistsException. Ensures that the Iceberg exception is consistently used in line with the catalog interface specification. Changes: Wrapped the glue.createTable() call in a try-catch block. Caught software.amazon.awssdk.services.glue.model.AlreadyExistsException and rethrew it as org.apache.iceberg.exceptions.AlreadyExistsException with an appropriate error message. Retained the existing rollback logic for handling failures when dropping the old table. Impact: Ensures consistent exception handling in the renameTable method. Aligns the behavior with the Iceberg API contract. No impact on backward compatibility, as this only corrects exception handling. This PR ensures that the renameTable operation behaves as expected according to the Iceberg documentation and resolves the mismatch in exception handling. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org