You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Michael Penick (JIRA)" <ji...@apache.org> on 2015/12/07 17:51:10 UTC

[jira] [Created] (CASSANDRA-10826) frozen<> added to non-frozen UDF/UDA argument types in schema metadata

Michael Penick created CASSANDRA-10826:
------------------------------------------

             Summary: frozen<> added to non-frozen UDF/UDA argument types in schema metadata
                 Key: CASSANDRA-10826
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10826
             Project: Cassandra
          Issue Type: Bug
            Reporter: Michael Penick


The function "avg_state" is created with a non-frozen tuple argument {{state}} and return type. It should be non-frozen because it's modified by the code in the body of the UDF.

{code}
CREATE KEYSPACE examples WITH replication = { 
  'class': 'SimpleStrategy', 'replication_factor': '3' };

CREATE FUNCTION examples.avg_state(state tuple<int, bigint>, val int)
  CALLED ON NULL INPUT RETURNS tuple<int, bigint>
  LANGUAGE java AS
  'if (val != null) {
    state.setInt(0, state.getInt(0) + 1);
    state.setLong(1, state.getLong(1) + val.intValue());
  }
return state;'
{code}

However, the schema metadata has the both the {{state}} argument and the return type incorrectly defined as {{frozen<>}}:

{code}
cqlsh> SELECT argument_types, return_type FROM system_schema.functions WHERE keyspace_name = 'examples' AND function_name = 'avg_state';

 argument_types                        | return_type
---------------------------------------+----------------------------
 ['frozen<tuple<int, bigint>>', 'int'] | frozen<tuple<int, bigint>>
{code}



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