gortiz opened a new pull request, #17724:
URL: https://github.com/apache/pinot/pull/17724

   This pull request introduces utility methods to simplify and standardize 
exception suppression and aggregation across the codebase. The main addition is 
the new `ExceptionUtils.suppress` methods, which help collect and chain 
exceptions (especially when closing multiple resources or handling multiple 
failures) without losing any exception details. Existing code is refactored to 
use these utilities, improving readability and reducing boilerplate.
   
   **Key changes:**
   
   **1. New utility methods for exception suppression:**
   - Added two overloaded `suppress` methods in `ExceptionUtils`:
     - One for suppressing exceptions of the same type.
     - One for suppressing exceptions of different types, with conversion 
support.
     - Both methods ensure that suppressed exceptions are not lost and avoid 
infinite loops if the same exception instance is reused.
   
   **2. Refactoring to use the new utility methods:**
   - Updated exception suppression logic in `FileUtils.close`, 
`BlockExchange.send`, `BlockExchange.close`, 
`BaseTableDataManager.reloadSegment`, and 
`SegmentIndexCreationDriverImpl.buildColumnar` to use `ExceptionUtils.suppress` 
instead of manual suppression. This reduces code duplication and potential 
errors. 
[[1]](diffhunk://#diff-6f11fcc30444e1d02ec4120820ac3a2d0949e2b6247cacb15b11f3dd63ea7f79L95-R95)
 
[[2]](diffhunk://#diff-08e624917f683f47e32cf511e53a41a95570a1973e5e7c737a736c37f0826d23L146-R147)
 
[[3]](diffhunk://#diff-08e624917f683f47e32cf511e53a41a95570a1973e5e7c737a736c37f0826d23L186-R183)
 
[[4]](diffhunk://#diff-942fbcffeb29824589de999671b7649b8b83e3fc82bdbc3b1e8eaed9f8096520L926-R927)
 
[[5]](diffhunk://#diff-f763128c9fa6c9e326c49f192c66d68799df68e4b3212bebf8fd4891c894132bL644-R645)
   
   **3. Dependency and import updates:**
   - Added necessary imports for `ExceptionUtils` in files that now use the new 
suppression methods. 
[[1]](diffhunk://#diff-942fbcffeb29824589de999671b7649b8b83e3fc82bdbc3b1e8eaed9f8096520R62)
 
[[2]](diffhunk://#diff-08e624917f683f47e32cf511e53a41a95570a1973e5e7c737a736c37f0826d23R26)
 
[[3]](diffhunk://#diff-f763128c9fa6c9e326c49f192c66d68799df68e4b3212bebf8fd4891c894132bR35)
 
[[4]](diffhunk://#diff-9dd65aaa718a21ab61552930d26df1dc2ddfa5a9f91957d61fe238aac9756cadR21-R22)
   
   **4. Documentation and comments:**
   - Provided detailed Javadoc and usage examples for the new `suppress` 
methods to guide developers on correct usage and to clarify the intended 
scenarios.
   
   **5. Notes on module boundaries:**
   - Added a comment in `PagedPinotOutputStream.close` explaining why the new 
utility cannot be used there due to module dependencies.


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