def _get_table_names_from_columns(sql_spans):
  """Return set of table names of SqlColumn tuples in sql_spans."""
  table_names_from_columns = set()
  in_from_clause = False
  for span in sql_spans:
    if in_from_clause:
      if span.sql_token and span.sql_token.lower() not in ('join', 'on', '=',
                                                           'inner join'):
        in_from_clause = False
    else:
      if span.sql_token and span.sql_token.lower() == 'from':
        in_from_clause = True
    if not in_from_clause and span.column:
      table_names_from_columns.add(span.column.table_name)
  return table_names_from_columns
Return set of table names of SqlColumn tuples in sql_spans.
language/xsp/data_preprocessing/abstract_sql.py