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

    https://github.com/apache/madlib/pull/225#discussion_r161917948
  
    --- Diff: src/ports/postgres/modules/knn/knn.sql_in ---
    @@ -412,7 +451,8 @@ CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.knn(
             output_table,
             k,
             output_neighbors,
    -        fn_dist
    +        fn_dist,
    +        weighted_avg
    --- End diff --
    
    Two overloaded functions are missing (one seems to be an old issue, and the 
other is due to this PR):
    1.
    ```
    madlib.knn(point_source,
        point_column_name,
        point_id,
        label_column_name,
        test_source,
        test_column_name,
        test_id,
        output_table,
        k,
        output_neighbors,
        fn_dist
    )
    ```
    2.
    ```
    madlib.knn(point_source,
        point_column_name,
        point_id,
        label_column_name,
        test_source,
        test_column_name,
        test_id,
        output_table,
        k,
        output_neighbors
    )
    ```
    
    The first one is a call which does not have the last param specified, and 
the second function misses both the last two optional params. This should take 
in default values and work, but it currently fails.
    
    I just ran through the examples in the user docs, and got the following 
error for one of the examples:
    ```
    greenplum=# SELECT * FROM madlib.knn(
    greenplum(#                 'knn_train_data',      -- Table of training data
    greenplum(#                 'data',                -- Col name of training 
data
    greenplum(#                 'id',                  -- Col name of id in 
train data
    greenplum(#                 'label',               -- Training labels
    greenplum(#                 'knn_test_data',       -- Table of test data
    greenplum(#                 'data',                -- Col name of test data
    greenplum(#                 'id',                  -- Col name of id in 
test data
    greenplum(#                 'knn_result_classification',  -- Output table
    greenplum(#                  3,                    -- Number of nearest 
neighbors
    greenplum(#                  True,                 -- True to list 
nearest-neighbors by id
    greenplum(#                  'madlib.squared_dist_norm2' -- Distance 
function
    greenplum(#                 );
    ERROR:  function madlib.knn(unknown, unknown, unknown, unknown, unknown, 
unknown, unknown, unknown, integer, boolean, unknown) does not exist
    LINE 1: SELECT * FROM madlib.knn(
                          ^
    HINT:  No function matches the given name and argument types. You might 
need to add explicit type casts.
    ```



---

Reply via email to