MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / parse_select

Function parse_select

evaluation/test-suite-sql-eval/process_sql.py:341–363  ·  view source on GitHub ↗
(toks, start_idx, tables_with_alias, schema, default_tables=None)

Source from the content-addressed store, hash-verified

339
340
341def parse_select(toks, start_idx, tables_with_alias, schema, default_tables=None):
342 idx = start_idx
343 len_ = len(toks)
344
345 assert toks[idx] == 'select', "'select' not found"
346 idx += 1
347 isDistinct = False
348 if idx < len_ and toks[idx] == 'distinct':
349 idx += 1
350 isDistinct = True
351 val_units = []
352
353 while idx < len_ and toks[idx] not in CLAUSE_KEYWORDS:
354 agg_id = AGG_OPS.index("none")
355 if toks[idx] in AGG_OPS:
356 agg_id = AGG_OPS.index(toks[idx])
357 idx += 1
358 idx, val_unit = parse_val_unit(toks, idx, tables_with_alias, schema, default_tables)
359 val_units.append((agg_id, val_unit))
360 if idx < len_ and toks[idx] == ',':
361 idx += 1 # skip ','
362
363 return idx, (isDistinct, val_units)
364
365
366def parse_from(toks, start_idx, tables_with_alias, schema):

Callers 1

parse_sqlFunction · 0.70

Calls 1

parse_val_unitFunction · 0.70

Tested by

no test coverage detected