dennismdejong opened a new pull request, #13667: URL: https://github.com/apache/gravitino/pull/13667
### What changes were proposed in this pull request? `PathType.get()` in `PathBasedMetadataObject` now returns the cached singleton constants (`SCHEMA_PATH`, `TABLE_PATH`, etc.) instead of allocating a new instance on every call. This makes reference comparison (`==`) between path types of the same metadata object type correct, eliminating the footgun that `RangerAuthorizationHDFSPlugin` tripped over (issue #7586). ### Why are the changes needed? Fix: #7586 The code referenced in the issue used `authzMetadataObject.type() == PathBasedMetadataObject.PathType.get(...)`, which always evaluated to `false` because `PathType.get()` returned a new instance each call. While the exact line has since been rewritten to use `.equals()`, the underlying fragility remained. Caching the instances makes both `==` and `.equals()` comparisons reliable. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added regression tests in `TestPathBasedMetadataObject` (cached-instance identity, equality, unsupported type, and the `== SCHEMA_PATH` scenario). All 9 tests pass; `spotlessCheck` and `authorization-ranger` compile succeed. -- 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]
