SteNicholas commented on code in PR #209:
URL: https://github.com/apache/paimon-cpp/pull/209#discussion_r3809798646


##########
include/paimon/fs/file_system.h:
##########
@@ -155,7 +155,8 @@ class PAIMON_EXPORT BasicFileStatus {
     }
 
     /// Get the path of this file or directory.
-    std::string GetPath() const {
+    /// @note The returned reference is valid as long as this object is alive.
+    const std::string& GetPath() const {

Review Comment:
   Avoid changing the public `GetPath` return contract. Changing this public 
getter from `std::string` to `const std::string&` is unrelated to the cache 
work and changes source/ABI behavior. It can also turn previously safe code 
such as `const std::string& p = MakeStatus().GetPath()` into a dangling 
reference because the owning status temporary is destroyed. Please retain the 
value-returning API; the same applies to `FileStatus::GetPath` below.



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

Reply via email to