cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-9457) Empty INITCOND treated as null in aggregate
Date Tue, 26 May 2015 07:39:18 GMT

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

Sylvain Lebresne commented on CASSANDRA-9457:
---------------------------------------------

I'm a bit uncomfortable special casing certain types like that, but I don't have a much better
solution to suggest so I'm fine with it. However, we at least need to accept empty values
for "custom" type, so instead of having a whitelist of types for which empty values do make
sense, I'd prefer adding a blacklist of types that do accept them but for which it doesn't
really make sense. In particular such blacklist won't ever have to be updated since from now
on, when we add new types for which empty values don't make sense, we actually don't allow
them in the first place, so empty value will be rejected by type-checking for these new types.

I would also have a preference for adding some {{acceptEmptyValuesEvenThoughItDoesntReallyMakeSense()}}
method to {{AbstractType}} rather hardcoding some list.



> Empty INITCOND treated as null in aggregate
> -------------------------------------------
>
>                 Key: CASSANDRA-9457
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9457
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Olivier Michallat
>            Assignee: Robert Stupp
>            Priority: Minor
>             Fix For: 2.2.0 rc1
>
>
> Given the following test data:
> {code}
> cqlsh:test> create table foo(k int, v int, primary key(k,v));
> cqlsh:test> insert into foo(k,v) values(1,1);
> cqlsh:test> insert into foo(k,v) values(1,2);
> cqlsh:test> insert into foo(k,v) values(1,3);
> {code}
> And the following aggregate definition:
> {code}
> cqlsh:test> CREATE FUNCTION cat(s text, v int)
>             RETURNS NULL ON NULL INPUT
>             RETURNS text 
>             LANGUAGE java
>             AS 'return s + v;';
> cqlsh:test> CREATE AGGREGATE cats(int) SFUNC cat STYPE text INITCOND '';
> {code}
> The following should return '123', but it returns null:
> {code}
> cqlsh:test> select cats(v) from foo where k = 1;
>  test.cats(v)
> ---------------
> {code}
> The empty INITCOND is treated as null, and the SFUNC is never called.



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

Mime
View raw message