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

    https://github.com/apache/madlib/pull/271#discussion_r191598228
  
    --- 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):
    --- End diff --
    
    line 269 in madpack.py calls `sql = sc.cleanup(sql)`. This will fail 
because cleanup needs another argument. I think we can remove the code from 
line 263 to 270 because _run_sql_file_install_check is ony called once and 
`upgrade` is always false 
    ```
        if upgrade:
            # get filename from complete path without the extension
            sub_module = os.path.splitext(os.path.basename(sqlfile))[0]
            info_(this, sub_module, verbose)
            if sub_module not in sc.get_change_handler().newmodule:
                sql = open(tmpfile).read()
                sql = sc.cleanup(sql)
                open(tmpfile, 'w').write(sql)
    ```



---

Reply via email to