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

    https://github.com/apache/madlib/pull/339#discussion_r237327903
  
    --- Diff: src/ports/postgres/modules/kmeans/kmeans.sql_in ---
    @@ -766,15 +766,30 @@ BEGIN
     
         proc_fn_dist := fn_dist
             || '(DOUBLE PRECISION[], DOUBLE PRECISION[])';
    -    IF (SELECT prorettype != 'DOUBLE PRECISION'::regtype OR proisagg = TRUE
    -        FROM pg_proc WHERE oid = proc_fn_dist) THEN
    -        RAISE EXCEPTION 'Kmeans error: Distance function has wrong 
signature or is not a simple function.';
    -    END IF;
    -    proc_agg_centroid := agg_centroid || '(DOUBLE PRECISION[])';
    -    IF (SELECT prorettype != 'DOUBLE PRECISION[]'::regtype OR proisagg = 
FALSE
    -        FROM pg_proc WHERE oid = proc_agg_centroid) THEN
    -        RAISE EXCEPTION 'Kmeans error: Mean aggregate has wrong signature 
or is not an aggregate.';
    +
    +    -- Handle PG11 pg_proc table changes
    --- End diff --
    
    We can write a sql function called `is_valid_distance_function()` that can 
be called from either python or sql. This function will abstract out the pg11 
changes and we would just call this function from kmeans.sql_in and knn.py_in.


---

Reply via email to