cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-8374) Better support of null for UDF
Date Thu, 08 Jan 2015 11:37:36 GMT


Sylvain Lebresne commented on CASSANDRA-8374:

bq. 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

Fair enough, I'll admit I wasn't specifically thinking of that scenario. That said, if you
do write a function explicitly handling null, presumably you'll test that case right away
and even if you're surprised by the result, I wouldn't expect it to take you a terribly long
time to figure it out (by checking the doc for instance). Though that's probably wishful thinking
on my part. I'm still also bugged by the idea of not using a default that would be right 99%
of the time because it may suprise a few users.

But anyway, I understand the concerns (I just happen to not be entirely convinced they would
be such a big deal in practice, but you seem to be convinced otherwise so I'm willing to accept
that I'm probably wrong) and so as I said above, my preference goes to forcing an explicit

> Better support of null for UDF
> ------------------------------
>                 Key: CASSANDRA-8374
>                 URL:
>             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
> {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

View raw message