Some SQL dialects support a relatively obscure "table column aliases" feature where you can rename columns when aliasing a relation in a FROM clause. For example:
Spark does not currently support this. I would like to add support for this in order to allow me to run a corpus of existing queries which depend on this syntax.
There's a good writeup on this at http://modern-sql.com/feature/table-column-aliases, which has additional examples and describes other databases' degrees of support for this feature.
One tricky thing to figure out will be whether FROM clause column aliases take precedence over aliases in the SELECT clause. When adding support for this, we should make sure to add sufficient testing of several corner-cases, including:
- Aliasing in both the SELECT and FROM clause
- Aliasing columns in the FROM clause both with and without an explicit AS.
- Aliasing the wrong number of columns in the FROM clause, both greater and fewer columns than were selected in the SELECT clause.