[ 
https://issues.apache.org/jira/browse/CASSANDRA-8374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14268378#comment-14268378
 ] 

Jonathan Ellis commented on CASSANDRA-8374:
-------------------------------------------

bq. most function will end up returning null on null anyway

Granted, but that doesn't change the fact that when you *don't* want to return 
null on null, making this the default is going to be very confusing since (1) 
no other system behaves that way by default and (2) you never opted in to it.

bq. It is not due to what the default at creating time was

I'm thinking of a different scenario -- where my function explicitly handles 
null, e.g. by turning it into a "default" value, but this behavior is 
suppressed by the function short-circuiting to null.  In that case the surprise 
that it's not working as expected is entirely due to the default.


> Better support of null for UDF
> ------------------------------
>
>                 Key: CASSANDRA-8374
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8374
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Sylvain Lebresne
>            Assignee: Robert Stupp
>             Fix For: 3.0
>
>         Attachments: 8473-1.txt, 8473-2.txt
>
>
> Currently, every function needs to deal with it's argument potentially being 
> {{null}}. There is very many case where that's just annoying, users should be 
> able to define a function like:
> {noformat}
> CREATE FUNCTION addTwo(val int) RETURNS int LANGUAGE JAVA AS 'return val + 2;'
> {noformat}
> without having this crashing as soon as a column it's applied to doesn't a 
> value for some rows (I'll note that this definition apparently cannot be 
> compiled currently, which should be looked into).  
> In fact, I think that by default methods shouldn't have to care about 
> {{null}} values: if the value is {{null}}, we should not call the method at 
> all and return {{null}}. There is still methods that may explicitely want to 
> handle {{null}} (to return a default value for instance), so maybe we can add 
> an {{ALLOW NULLS}} to the creation syntax.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to