Github user orhankislal commented on a diff in the pull request:
https://github.com/apache/madlib/pull/184#discussion_r139027620
--- Diff: src/ports/postgres/modules/knn/knn.py_in ---
@@ -75,38 +76,40 @@ def knn_validate_src(schema_madlib, point_source,
point_column_name,
plpy.error("kNN Error: k={0} is greater than number of rows in"
" training table.".format(k))
- col_type = get_expr_type(label_column_name, point_source).lower()
- if col_type not in ['integer', 'double precision', 'float', 'boolean']:
- plpy.error("kNN error: Data type '{0}' is not a valid type for"
+ if label_column_name is not None and label_column_name != '':
+ col_type = get_expr_type(label_column_name, point_source).lower()
+ if col_type not in ['integer', 'double precision', 'float',
'boolean']:
+ plpy.error("kNN error: Data type '{0}' is not a valid type for"
" column '{1}' in table '{2}'.".
format(col_type, label_column_name, point_source))
- col_type_test = get_expr_type(id_column_name, test_source).lower()
+ col_type_test = get_expr_type(test_id, test_source).lower()
if col_type_test not in ['integer']:
plpy.error("kNN Error: Data type '{0}' is not a valid type for"
" column '{1}' in table '{2}'.".
- format(col_type_test, id_column_name, test_source))
+ format(col_type_test, test_id, test_source))
return k
#
------------------------------------------------------------------------------
-def knn(schema_madlib, point_source, point_column_name, label_column_name,
- test_source, test_column_name, id_column_name, output_table,
- operation, k):
+def knn(schema_madlib, point_source, point_column_name,point_id,
label_column_name,
+ test_source, test_column_name, test_id, output_table,
k,output_neighbors):
--- End diff --
space after , is needed. `k, output_neighbors`
---