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

frozen<> added to non-frozen UDF/UDA argument types in schema metadata

    XMLWordPrintableJSON

    Details

    • Severity:
      Normal

      Description

      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.

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

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

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

        Attachments

          Activity

            People

            • Assignee:
              snazy Robert Stupp
              Reporter:
              mpenick Michael Penick
              Authors:
              Robert Stupp
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: