Github user hpandeycodeit commented on a diff in the pull request:
https://github.com/apache/madlib/pull/315#discussion_r215149235
--- Diff: src/ports/postgres/modules/knn/knn.py_in ---
@@ -264,12 +260,17 @@ def knn(schema_madlib, point_source,
point_column_name, point_id,
SELECT test.{test_id} AS {test_id_temp},
train.{point_id} as train_id,
{fn_dist}(
- train.{point_column_name},
- test.{test_column_name})
+ p_col_name,
+ t_col_name)
AS dist
{label_out}
- FROM {point_source} AS train,
- {test_source} AS test
+ FROM
+ (
+ SELECT {point_id} , {point_column_name} as
p_col_name , {label_column_name} from {point_source}
+ ) train,
+ (
+ SELECT {test_id} ,{test_column_name} as
t_col_name from {test_source}
+ ) test
--- End diff --
Done.
---