madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iyerr3 <...@git.apache.org>
Subject [GitHub] incubator-madlib pull request: Path: Return results for each match
Date Mon, 21 Mar 2016 21:34:43 GMT
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/incubator-madlib/pull/29#discussion_r56901766
  
    --- Diff: src/ports/postgres/modules/utilities/path.py_in ---
    @@ -387,11 +395,16 @@ def _parse_symbol_str(symbol_expr, pattern_expr):
             lambda m: old_to_new[re.escape(string.lower(m.group(0)))],
             pattern_expr)
     
    -    old_sym_def_str = '\n'.join("WHEN {0} THEN '{1}'::text".format(v, k)
    -                                for k, v in old_sym_definitions.items())
    -    new_sym_def_str = '\n'.join("WHEN {0} THEN '{1}'::text".format(v, k)
    -                                for k, v in new_sym_definitions.items())
    -    return (new_pattern_expr, old_sym_def_str, new_sym_def_str)
    +    # build a case statement to search a tuple for each definition and pick the
    +    # appropriate symbol.
    +    orig_sym_case_stmt = []
    +    new_sym_case_stmt = []
    +    general_case_stmt = "WHEN {0} THEN '{1}'::text"
    +    for k in orig_symbols_ordered:
    +        orig_sym_case_stmt.append(general_case_stmt.format(orig_sym_definitions[k], k))
    +        new_sym_case_stmt.append(general_case_stmt.format(orig_sym_definitions[k],
    +                                                          old_to_new[k.lower()]))
    +    return (new_pattern_expr, '\n'.join(orig_sym_case_stmt), '\n'.join(new_sym_case_stmt))
    --- End diff --
    
    Good catch. Updated. 


---
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