Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/271#discussion_r191604335
  
    --- Diff: src/madpack/upgrade_util.py ---
    @@ -1299,18 +1303,19 @@ def _clean_function(self):
             pattern = re.compile(r"""CREATE(\s+)FUNCTION""", re.DOTALL | 
re.IGNORECASE)
             self._sql = re.sub(pattern, 'CREATE OR REPLACE FUNCTION', 
self._sql)
     
    -    def cleanup(self, sql):
    +    def cleanup(self, sql, algoname):
             """
             @brief Entry function for cleaning the sql script
             """
             self._sql = sql
    -        self._clean_comment()
    -        self._clean_type()
    -        self._clean_cast()
    -        self._clean_operator()
    -        self._clean_opclass()
    -        self._clean_aggregate()
    -        self._clean_function()
    +        if algoname not in self.get_change_handler().newmodule:
    --- End diff --
    
    can we switch the if logic to 
    ```
    if algoname in  self.get_change_handler().newmodule:
        return self._sql
    ```
    
    also it is not really clear why we need the if check in the first place. 
Can you explain it in a comment ?


---

Reply via email to