(toks, start_idx, tables_with_alias, schema, default_tables=None)
| 339 | |
| 340 | |
| 341 | def 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 | |
| 366 | def parse_from(toks, start_idx, tables_with_alias, schema): |
no test coverage detected