4cfd55b0397c78dfae83818bc25e6989761a495a,language/xsp/data_preprocessing/sql_parsing.py,,_parse_comparison,#Any#Any#Any#,590

Before Change


      continue

    if _is_parenthesis(item):
      populate_sql(item, example, anonymize_values)
      continue

    if _is_function(item):
      _parse_function(item, example, anonymize_values)

After Change



def _parse_comparison(sql, example, anonymize_values):
  Parse the part relative to a comparison in the SQL query.
  successful_copy = True
  for item in sql:
    if item.ttype == sqlparse.tokens.Text.Whitespace:
      continue
    if _is_identifier(item):
      successful_copy = _parse_identifier(item, example,
                                          anonymize_values) and successful_copy
      continue
    if _is_comparison_operator(item):
      _add_simple_step(item, example)
      continue
    if _is_literal(item):
      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_parenthesis(item):
      successful_copy = populate_sql(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_operation(item):
      successful_copy = _parse_operation(item, example,
                                         anonymize_values) and successful_copy
      continue

    _debug_state(item, example)
    raise ParseError("Incomplete _parse_comparison")

  return successful_copy


def _parse_where(sql, example, anonymize_values):
  Parse the part relative to the WHERE clause of the SQL query.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

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: _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: _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: _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: 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_function