Github user njayaram2 commented on a diff in the pull request: https://github.com/apache/madlib/pull/315#discussion_r213792935 --- Diff: src/ports/postgres/modules/knn/knn.py_in --- @@ -264,12 +275,14 @@ 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}) + train.{point_col_name_temp}, + test.{test_col_name_temp}) AS dist {label_out} - FROM {point_source} AS train, - {test_source} AS test + FROM + {point_source_temp_table} as train, + {test_source_temp_table} as test --- End diff -- Please use subqueries, instead of tables: ``` (select {point_id} , {point_column_name} as {point_col_name_temp} , {label_column_name} from {point_source}) train, (select {test_id}, {test_column_name} as {test_col_name_temp} from {test_source}) test ```
---