Github user hpandeycodeit commented on a diff in the pull request:
https://github.com/apache/madlib/pull/315#discussion_r214414914
--- 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 --
Replaced the temp tables with subqueries.
---