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 16C13200C61 for ; Tue, 11 Apr 2017 01:46:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 15878160BA5; Mon, 10 Apr 2017 23:46:43 +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 41822160BA7 for ; Tue, 11 Apr 2017 01:46:42 +0200 (CEST) Received: (qmail 89700 invoked by uid 500); 10 Apr 2017 23:46:41 -0000 Mailing-List: contact dev-help@madlib.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@madlib.incubator.apache.org Delivered-To: mailing list dev@madlib.incubator.apache.org Received: (qmail 89557 invoked by uid 99); 10 Apr 2017 23:46:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2017 23:46:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C08D71A0415 for ; Mon, 10 Apr 2017 23:46:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.021 X-Spam-Level: X-Spam-Status: No, score=-4.021 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id wEfUyI4G_rno for ; Mon, 10 Apr 2017 23:46:38 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 414F95FC84 for ; Mon, 10 Apr 2017 23:46:37 +0000 (UTC) Received: (qmail 88479 invoked by uid 99); 10 Apr 2017 23:46:36 -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, 10 Apr 2017 23:46:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 55B45DFC31; Mon, 10 Apr 2017 23:46:36 +0000 (UTC) From: njayaram2 To: dev@madlib.incubator.apache.org Reply-To: dev@madlib.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-madlib pull request #113: Graph: Add grouping support to SSSP Content-Type: text/plain Message-Id: <20170410234636.55B45DFC31@git1-us-west.apache.org> Date: Mon, 10 Apr 2017 23:46:36 +0000 (UTC) archived-at: Mon, 10 Apr 2017 23:46:43 -0000 Github user njayaram2 commented on a diff in the pull request: https://github.com/apache/incubator-madlib/pull/113#discussion_r110485325 --- Diff: src/ports/postgres/modules/graph/sssp.py_in --- @@ -33,16 +33,49 @@ from utilities.control import MinWarning from utilities.utilities import _assert from utilities.utilities import extract_keyvalue_params from utilities.utilities import unique_string -from utilities.validate_args import get_cols -from utilities.validate_args import unquote_ident +from utilities.utilities import _string_to_array +from utilities.utilities import split_quoted_delimited_str from utilities.validate_args import table_exists from utilities.validate_args import columns_exist_in_table from utilities.validate_args import table_is_empty +from utilities.validate_args import get_cols_and_types +from utilities.validate_args import get_expr_type m4_changequote(`') + +def _check_groups(tbl1, tbl2, grp_list): + + """ + Helper function for joining tables with groups. + Args: + @param tbl1 Name of the first table + @param tbl2 Name of the second table + @param grp_list The list of grouping columns + """ + + sql = [] + for i in grp_list: + sql.append(" "+tbl1+"."+i+" = "+tbl2+"."+i+" ") + return " AND ".join(sql) + --- End diff -- It's better to use list comprehension for this: `' AND '.join([" {tbl1}.{i} = {tbl2}.{i} ".format(**locals()) for i in grp_list])` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---