Github user iyerr3 commented on a diff in the pull request: https://github.com/apache/madlib/pull/191#discussion_r146702725 --- Diff: src/ports/postgres/modules/knn/knn.py_in --- @@ -135,13 +135,17 @@ def knn(schema_madlib, point_source, point_column_name, point_id, label_column_n test_id_temp = unique_string(desp='test_id_temp') if output_neighbors is None or '': - output_neighbors = False + output_neighbors = True interim_table = unique_string(desp='interim_table') if label_column_name is None or label_column_name == '': - plpy.execute( - """ + + if output_neighbors is False: + plpy.error("kNN error: Either label_column_name or " + "output_neighbors has to be non-NULL.") + + sql1 = """ --- End diff -- if `sql1` and `sql2` (below) are not reused, then I would prefer to just directly call the `plpy.execute` with the string.
---