cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Penick (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CASSANDRA-10826) frozen<> added to non-frozen UDF/UDA argument types in schema metadata
Date Mon, 07 Dec 2015 16:51:10 GMT
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)

Mime
View raw message