Moved Function resolving from parser to query generator