* @param first The first argument expression.
* @return the function return type given the function name and the first argument expression node.
*/
public Type findFunctionReturnType(String functionName, AST first) {
// locate the registered function by the given name
SQLFunction sqlFunction = requireSQLFunction( functionName );
// determine the type of the first argument...
Type argumentType = null;
if ( first != null ) {
if ( "cast".equals(functionName) ) {
argumentType = TypeFactory.heuristicType( first.getNextSibling().getText() );
}
else if ( first instanceof SqlNode ) {
argumentType = ( (SqlNode) first ).getDataType();
}
}
return sqlFunction.getReturnType( argumentType, sfi );
}