MCPcopy Create free account
hub / github.com/google-research/language / _find_direction

Function _find_direction

language/xsp/data_preprocessing/sql_parsing.py:299–314  ·  view source on GitHub ↗

Finds a column annotation in a given direction.

(reverse)

Source from the content-addressed store, hash-verified

297 return
298
299 def _find_direction(reverse):
300 """Finds a column annotation in a given direction."""
301 table_entities = _find_from_table(item, example, reverse=reverse)
302
303 if not table_entities:
304 return False
305
306 for table_entity in table_entities:
307 entity = _find_column_entities(item.value, example, table_entity)
308
309 if entity:
310 example.gold_sql_query.actions.append(
311 SQLAction(entity_copy=SchemaEntityCopy(copied_column=entity)))
312 return True
313
314 raise ParseError('Unable to find annotation of table ' + str(item))
315
316 if (prev_symbol in ('where', 'by') or _is_where(parent) or
317 _is_where(parent.parent)):

Callers 1

_resolve_referenceFunction · 0.85

Calls 5

SQLActionClass · 0.90
SchemaEntityCopyClass · 0.90
_find_from_tableFunction · 0.85
_find_column_entitiesFunction · 0.85
ParseErrorClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…