4cfd55b0397c78dfae83818bc25e6989761a495a,language/xsp/data_preprocessing/sql_parsing.py,,populate_sql,#Any#Any#Any#,700

Before Change


      continue

    if _is_identifier(item):
      _parse_identifier(item, example, anonymize_values)
      continue

    if _is_identifier_list(item):
      _parse_identifier_list(item, example, anonymize_values)

After Change


    Boolean indicating whether all actions copying values from
    the input utterance were successfully completed.
  
  successful_copy = True
  for item in sql:
    if item.ttype == sqlparse.tokens.Text.Whitespace:
      continue

    if _is_punctuation(item) and (item.value in ("(", ")")):
      _add_simple_step(item, example)
      continue

    if _is_punctuation(item) and (item.value in (",",)):
      _add_simple_step(item, example)
      continue

    if _is_parenthesis(item):
      successful_copy = populate_sql(item, example,
                                     anonymize_values) and successful_copy
      continue

    if _is_wildcard(item):
      _add_simple_step(item, example)
      continue

    if _is_select(item) or _is_from(item):
      _add_simple_step(item, example)
      continue

    if _is_where(item):
      successful_copy = _parse_where(item, example,
                                     anonymize_values) and successful_copy
      continue

    if _is_function(item):
      successful_copy = _parse_function(item, example,
                                        anonymize_values) and successful_copy
      continue

    if _is_identifier(item):
      successful_copy = _parse_identifier(item, example,
                                          anonymize_values) and successful_copy
      continue

    if _is_identifier_list(item):
      successful_copy = _parse_identifier_list(
          item, example, anonymize_values) and successful_copy
      continue

    if _is_keyword(item) and item.value.lower() in ("group", "order", "by",
                                                    "having", "order by",
                                                    "group by"):
      _add_simple_step(item, example)
      continue

    if _is_keyword(item) and item.value.lower() in ("count", "avg", "min",
                                                    "max", "sum"):
      _add_simple_step(item, example)
      continue

    if _is_operation(item):
      successful_copy = _parse_operation(item, example,
                                         anonymize_values) and successful_copy
      continue

    if _is_keyword(item) and item.value.lower() in ("between", "and", "or"):
      _add_simple_step(item, example)
      continue

    if _is_order(item):
      _add_simple_step(item, example)
      continue

    if _is_keyword(item) and item.value.lower() in ("distinct",):
      _add_simple_step(item, example)
      continue

    if _is_keyword(item) and item.value.lower() in ("limit",):
      _add_simple_step(item, example)
      continue

    if _is_keyword(item) and item.value.lower() in ("join", "on"):
      _add_simple_step(item, example)
      continue

    if _is_keyword(item) and item.value.lower() in ("intersect", "union"):
      _add_simple_step(item, example)
      continue

    if _is_keyword(item) and item.value.lower() in ("except",):
      _add_simple_step(item, example)
      continue

    if (_is_integer(item) and
        example.gold_sql_query.actions[len(example.gold_sql_query.actions) -
                                       1].symbol in ("limit", "between",
                                                     "and")):
      prev_len = len(example.gold_sql_query.actions)
      successful_copy = _add_simple_value(item, example,
                                          anonymize_values) and successful_copy
      if len(example.gold_sql_query.actions) == prev_len:
        raise ValueError(
            "Gold query did not change length when adding simple value!")
      continue

    if _is_comparison(item):
      successful_copy = _parse_comparison(item, example,
                                          anonymize_values) and successful_copy
      continue

    _debug_state(item, example)
    raise ParseError("Incomplete _parse_sql")
  return successful_copy
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 14

Instances


Project Name: google-research/language
Commit Name: 4cfd55b0397c78dfae83818bc25e6989761a495a
Time: 2019-11-21
Author: kentonl@google.com
File Name: language/xsp/data_preprocessing/sql_parsing.py
Class Name:
Method Name: populate_sql


Project Name: google-research/language
Commit Name: 4cfd55b0397c78dfae83818bc25e6989761a495a
Time: 2019-11-21
Author: kentonl@google.com
File Name: language/xsp/data_preprocessing/sql_parsing.py
Class Name:
Method Name: _parse_where


Project Name: google-research/language
Commit Name: 4cfd55b0397c78dfae83818bc25e6989761a495a
Time: 2019-11-21
Author: kentonl@google.com
File Name: language/xsp/data_preprocessing/sql_parsing.py
Class Name:
Method Name: _parse_comparison


Project Name: google-research/language
Commit Name: 4cfd55b0397c78dfae83818bc25e6989761a495a
Time: 2019-11-21
Author: kentonl@google.com
File Name: language/xsp/data_preprocessing/sql_parsing.py
Class Name:
Method Name: populate_sql