Benjamin Shen created CASSANDRA-13966:
-----------------------------------------

             Summary: UDAs that instantiate UDTs break after restart
                 Key: CASSANDRA-13966
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13966
             Project: Cassandra
          Issue Type: Bug
          Components: Core
         Environment: Successfully reproducible on a single-node Mac OS X 
Yosemite 10.10.5 cluster and a 6-node CentOS 6.9 cluster.
            Reporter: Benjamin Shen
             Fix For: 3.11.x


When testing performance optimizations for for UDAs, I noticed that, when 
instantiated using udfContext, newly created UDTs would cause a UDA to break, 
but ONLY after restart. This is pretty concern for us to deploy UDAs in a 
production setting, as it feels like a consistency error.

When run without restarting Cassandra, this CQL script produces no errors and 
the expected result:
{code}-- Create and USE your own keyspace

CREATE TYPE testing_type (
    a int
);
CREATE OR REPLACE FUNCTION
testing_state (
    state int
)
CALLED ON NULL INPUT RETURNS 
int
LANGUAGE java AS
'
return state+1;
';


CREATE OR REPLACE FUNCTION
testing_final(state int)
CALLED ON NULL INPUT RETURNS int LANGUAGE java AS
'
udfContext.newUDTValue("testing_type");
return state;';


CREATE OR REPLACE AGGREGATE testing_uda()
SFUNC testing_state
STYPE int
FINALFUNC testing_final
INITCOND 0;


CREATE TABLE IF NOT EXISTS testing_table (
    "a" int,
    PRIMARY KEY ("a")
) WITH gc_grace_seconds=0
    AND COMPACTION={'class': 'TimeWindowCompactionStrategy', 
'compaction_window_unit': 'DAYS', 'compaction_window_size': '1'};

SELECT testing_uda() FROM testing_table;{code}

However, if you then restart Cassandra on the local node and rerun the last 
line again:
{code}
-- Restart Cassandra after running previous script
cqlsh:my_keyspace> SELECT testing_uda() FROM testing_table;
Traceback (most recent call last):
  File "/Users/bshen/cassandra-trunk/bin/cqlsh.py", line 1044, in 
perform_simple_statement
    result = future.result()
  File 
"/Users/bshen/cassandra-trunk/bin/../lib/cassandra-driver-internal-only-3.10.zip/cassandra-driver-3.10/cassandra/cluster.py",
 line 3826, in result
    raise self._final_exception
FunctionFailure: Error from server: code=1400 [User Defined Function failure] 
message="execution of 'phoneid.testing_final[int]' failed: 
java.lang.NullPointerException"
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to