[gather_columns] Traversing function calls
This PR augments the print_column_resolution_order method to also examine columns which are function calls, so queries of the form
SELECT SUM(foo) FROM a
associate the column foo with table a, i.e., produces the output,
Checking query:
select sum(foo) from a
[SingleColumn(expression=FunctionCall(name=QualifiedName(sum), distinct=False, arguments=[QualifiedNameReference(name=QualifiedName(foo))]))]
[Table(name=QualifiedName(a))]
Table Column Resolution:
QualifiedNameReference(name=QualifiedName(foo)): [Table(name=QualifiedName(a))]
Note that the column_name variable was unused and thus I deleted it.
I'm happy to merge this as-is, but for the purposes of limited scope on this example, what do you think of checking the function call name to see that it's in one of pre-defined ones in SQL, e.g.: AVG, MAX, MIN, SUM,COUNT? I only say this because I know that we miss expressions of the form select sum(10*a) from foo. Those require a slightly more complicated visitor (or an additional one) I think, but we could work on that.
@brianv0 I'm happy to augment the PR to include a whitelist of function names.