Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-9457

Empty INITCOND treated as null in aggregate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.2.0 rc1
    • None
    • None
    • Low

    Description

      Given the following test data:

      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);
      

      And the following aggregate definition:

      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 '';
      

      The following should return '123', but it returns null:

      cqlsh:test> select cats(v) from foo where k = 1;
      
       test.cats(v)
      ---------------
      

      The empty INITCOND is treated as null, and the SFUNC is never called.

      Attachments

        1. 9457.txt
          33 kB
          Robert Stupp

        Issue Links

          Activity

            People

              snazy Robert Stupp
              omichallat Olivier Michallat
              Robert Stupp
              Sylvain Lebresne
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: