Github user iyerr3 commented on a diff in the pull request: https://github.com/apache/madlib/pull/191#discussion_r146703574 --- Diff: src/ports/postgres/modules/knn/knn.py_in --- @@ -215,7 +222,8 @@ def knn(schema_madlib, point_source, point_column_name, point_id, label_column_n knn_pred_class = schema_madlib + \ '.mode(' + label_col_temp + ') AS prediction' knn_pred_reg = 'avg(' + label_col_temp + ') AS prediction' - knn_neighbours = ', array_agg(knn_temp.train_id) AS k_nearest_neighbours ' + knn_neighbours = ', array_agg(knn_temp.train_id ORDER BY knn_temp.dist ASC)'\ --- End diff -- Preferred to break long lines by wrapping expressions in parentheses over using a backslash. ([PEP8 link](https://www.python.org/dev/peps/pep-0008/#maximum-line-length))
---