test-suite-sql-eval
test-suite-sql-eval copied to clipboard
Support Aliases without 'AS'
As can be seen in this link, both cases:
SELECT * FROM Table AS t
SELECT * FROM Table t
are valid in many SQL versions, yet the second query isn't supported, as can be seen in the code, in the file process_sql.py:
def scan_alias(toks):
"""Scan the index of 'as' and build the map for all alias"""
as_idxs = [idx for idx, tok in enumerate(toks) if tok == 'as']
alias = {}
for idx in as_idxs:
alias[toks[idx+1]] = toks[idx-1]
return alias