madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From njayaram2 <...@git.apache.org>
Subject [GitHub] incubator-madlib pull request #113: Graph: Add grouping support to SSSP
Date Mon, 10 Apr 2017 23:46:36 GMT
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.
---

Mime
View raw message