vagetablechicken commented on issue #3507:
URL: 
https://github.com/apache/incubator-doris/issues/3507#issuecomment-626099485


   About the warning of udf:
   ```
   In member function 'const char* doris_udf::FunctionContext::user() const':
   cc1plus: warning: function may return address of local variable 
[-Wreturn-local-addr]
   /root/doris-env/doris/be/src/udf/udf.cpp:242:33: note: declared here
        return  _impl->_state->user().c_str();
   ```
   It is in the building of target DorisUdf.
   So the RuntimeState is here:
   
https://github.com/apache/incubator-doris/blob/b62b3108641cc5cd03dd439115dbc798cd7d6c60/be/src/udf/udf.cpp#L60-L74
   
   user() returns `const std::string`, so it is a local var.
   It's better to have the same implementation of runtime/runtime_state.h, like
   ```
       const std::string& user() const {
           return _user;
       }
   
   private:
       std::string _user = "";
   ```


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

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