Hi,

You made the arguments under implicit assumption that the end user is
writing these functions. The assumption breaks down in the following
two cases which are important to me:

1. User defined functions already exist and their signatures can not
be changed.
 2. User defined function are computer generated.

In both cases it is possible to create wrappers around these
functions. The only purpose of such wrappers would be to check Double
for null and either cast it to double or to throw an exception. Of
course it is doable but I thought the proper place for such
functionality may be within  H2 code itself and avoid writing
wrappers.

About default behavior  to return NULL in case of NULL argument. Other
databases (Oracle, Teradata) which support Java UDF behave differently
here and throw an exception.

I suggest to move this discussion offline  so that I can give you more
details about actual usage of Java UDF.

Sincerely,
Pavel

On Apr 23, 1:03 pm, Thomas Mueller <[email protected]>
wrote:
> Hi,
>
> > I noticed in the latest build the following behavior for user-defined
> > Java functions with primitive arguments.
>
> Could you provide an example? For user defined functions, you can
> already implement the behavior yourself. I don't think it's necessary
> to add any additional features in the database. Maybe the
> documentation needs to be improved, let's see. 
> Fromhttp://www.h2database.com/html/features.html#user_defined_functions:
>
> = Function Data Type Mapping =
> Functions that accept non-nullable parameters such as "int" will not
> be called if one of those parameters is NULL. Instead, the result of
> the function is NULL. If the function should be called if a parameter
> is NULL, you need to use java.lang.Integer instead.
>
> > The end user has no control over this behavior
>
> The person who implements the user defined function is the one that
> decides what to do. That's how it should be.
>
> > I propose to throw an
> > exception
>
> For user defined functions, the most logic solution is that the user
> defined method throws an exception, or convert null to NaN if needed.
> There is no need to "declare" that. Declaring would only make it
> slower, and would add unnecessary complexity, without adding any new
> feature.
>
> Regards,
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups "H2 
> Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/h2-database?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to