(toks, start_idx, tables_with_alias, schema, default_tables=None)
| 368 | |
| 369 | |
| 370 | def 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 | |
| 395 | def parse_from(toks, start_idx, tables_with_alias, schema): |
no test coverage detected