Couldn't give a definite answer without making some things clear:
Q1. What exactly your UDF is doing?
-- Filtering rows from a result set
-- Replacing string values with something else (0, NULL)
-- Something else
Q2. Which way you're using your UDF in Tableau?
-- as a Custom SQL when making a datasource
-- as a Calculation using any of RAWSQL functions
Q3. What data type Tableau shows
for your field in question (named [value])?
-- Numeric (Number decimal or Number whole)
Q4. Are you making an extract or connecting live
to your Redshift instance?
Q5. Your Tableau version number
and your Redshift ODBC driver version number,
Answering to my Q3 could help the most.
This error message happens when something goes wrong creating an extract and probably has nothing to do with your UDF or Redshift. I would recommend upgrading to the latest maintenance release if you haven't already. If that still doesn't work, contact Tableau Support and send them your logs for investigation.