Move alias up to FieldExpression
This makes the FieldExpression a struct with an alias field, with the old FieldExpression nested under as a Field (naming ideas welcome), and removes alias from Column and ArithmeticExpression.
This would be a breaking change and would require some refactoring in distributary, but I thought I'd check if you think this is the right approach first.
This would make it impossible to have nested aliases in one expression, but I can't think of any usecases where that would make a difference (e.g. ((foo AS a) / (bar AS b)) AS c or something, but with the inner aliases actually mattering?).
@ms705: saw that you added aliases to Literal in https://github.com/ms705/nom-sql/commit/2b3f18809dad08687452e1b584a3e8a8b7d45bd7. If you think that is a better approach in general I'll close this :) I guess it'd be useful to eventually be able to do SELECT * AS everything ... too though?
Oh, duh -- I missed this PR. Will take a look to see if your solution is better than mine (which was a quick hack to get a query to work). Sorry about that!
No worries, but let me know and I'll rebase. It does also change existing behavior slightly (see https://github.com/ms705/nom-sql/pull/15#discussion_r171262574) so probably requires some thought nonetheless.
I think this approach is cleaner than what we currently have, but it's quite disruptive as it breaks any code that uses Column, which is a lot. Hence, I propose we shelve it until after the OSDI deadline, and then rebase and merge when we're not fighting fires. Sounds ok?
Yep - that definitely sounds reasonable!