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

Function parse_select

hardness_eval.py:370–392  ·  view source on GitHub ↗
(toks, start_idx, tables_with_alias, schema, default_tables=None)

Source from the content-addressed store, hash-verified

368
369
370def parse_select(toks, start_idx, tables_with_alias, schema, default_tables=None):
371 idx = start_idx
372 len_ = len(toks)
373
374 assert toks[idx] == 'select', "'select' not found"
375 idx += 1
376 isDistinct = False
377 if idx < len_ and toks[idx] == 'distinct':
378 idx += 1
379 isDistinct = True
380 val_units = []
381
382 while idx < len_ and toks[idx] not in CLAUSE_KEYWORDS:
383 agg_id = AGG_OPS.index("none")
384 if toks[idx] in AGG_OPS:
385 agg_id = AGG_OPS.index(toks[idx])
386 idx += 1
387 idx, val_unit = parse_val_unit(toks, idx, tables_with_alias, schema, default_tables)
388 val_units.append((agg_id, val_unit))
389 if idx < len_ and toks[idx] == ',':
390 idx += 1 # skip ','
391
392 return idx, (isDistinct, val_units)
393
394
395def 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