Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C71AD200D53 for ; Mon, 20 Nov 2017 23:30:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C5C0C160BE1; Mon, 20 Nov 2017 22:30:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 17308160BF9 for ; Mon, 20 Nov 2017 23:30:50 +0100 (CET) Received: (qmail 14814 invoked by uid 500); 20 Nov 2017 22:30:50 -0000 Mailing-List: contact dev-help@madlib.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@madlib.apache.org Delivered-To: mailing list dev@madlib.apache.org Received: (qmail 14624 invoked by uid 99); 20 Nov 2017 22:30:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2017 22:30:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D0268F5F78; Mon, 20 Nov 2017 22:30:49 +0000 (UTC) From: iyerr3 To: dev@madlib.apache.org Reply-To: dev@madlib.apache.org References: In-Reply-To: Subject: [GitHub] madlib pull request #204: Added additional distance metrics for k-NN: Jira-1... Content-Type: text/plain Message-Id: <20171120223049.D0268F5F78@git1-us-west.apache.org> Date: Mon, 20 Nov 2017 22:30:49 +0000 (UTC) archived-at: Mon, 20 Nov 2017 22:30:51 -0000 Github user iyerr3 commented on a diff in the pull request: https://github.com/apache/madlib/pull/204#discussion_r152122999 --- Diff: src/ports/postgres/modules/knn/knn.py_in --- @@ -88,12 +88,28 @@ def knn_validate_src(schema_madlib, point_source, point_column_name, point_id, plpy.error("kNN Error: Data type '{0}' is not a valid type for" " column '{1}' in table '{2}'.". format(col_type_test, test_id, test_source)) + + fn_dist = fn_dist.lower().strip() + dist_functions = { + schema_madlib + '.dist_norm1', + schema_madlib + '.dist_norm2', + schema_madlib + '.squared_dist_norm2', + schema_madlib + '.dist_angle', + schema_madlib + '.dist_tanimoto'} + + if plpy.execute("""select prorettype != 'DOUBLE PRECISION'::regtype --- End diff -- Please avoid expressions with side effects in the if statement. The `plpy.execute` result can be placed in a variable and tested in the next step. ---