I've had similar problems with UDF.
When they have "constant" input parameters there's no problem, but when they work on an entire column you can find that error.
We also found that the UDF works with "few" rows, a SELECT TOP 1000 for example, but working with the entire table you have the error again.
We have SAP HANA rev is 85, and maybe this is a bug that is not present in rev 91.
Do you have any SAP Note about this error? I haven't could find any.