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

    https://github.com/apache/madlib/pull/315#discussion_r213791885
  
    --- Diff: src/ports/postgres/modules/knn/knn.py_in ---
    @@ -53,22 +55,10 @@ def knn_validate_src(schema_madlib, point_source, 
point_column_name, point_id,
     
         if label_column_name and label_column_name.strip():
             cols_in_tbl_valid(point_source, [label_column_name], 'kNN')
    -    cols_in_tbl_valid(point_source, (point_column_name, point_id), 'kNN')
    -    cols_in_tbl_valid(test_source, (test_column_name, test_id), 'kNN')
    -
    -    if not is_col_array(point_source, point_column_name):
    -        plpy.error("kNN Error: Feature column '{0}' in train table is not"
    -                   " an array.".format(point_column_name))
    -    if not is_col_array(test_source, test_column_name):
    -        plpy.error("kNN Error: Feature column '{0}' in test table is not"
    -                   " an array.".format(test_column_name))
    -
    -    if not array_col_has_no_null(point_source, point_column_name):
    -        plpy.error("kNN Error: Feature column '{0}' in train table has 
some"
    -                   " NULL values.".format(point_column_name))
    -    if not array_col_has_no_null(test_source, test_column_name):
    -        plpy.error("kNN Error: Feature column '{0}' in test table has some"
    -                   " NULL values.".format(test_column_name))
    +
    +    _assert(point_column_name, "KNN error: Invalid point_column_name 
expression")
    +
    +    _assert(test_column_name, "KNN error: Invalid test_column_name 
expression")
    --- End diff --
    
    Since the original asserts are removed, this results in the function call 
not exiting gracefully when we have incorrect param values. You may have to use 
function `is_var_valid()` in `validate_args.py_in` to validate 
`point_column_name` and `test_column_name`.


---

Reply via email to