You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Kishan Karunaratne (JIRA)" <ji...@apache.org> on 2016/03/12 05:03:45 UTC

[jira] [Created] (CASSANDRA-11347) Can't create User Defined Functions with same name, different args/types

Kishan Karunaratne created CASSANDRA-11347:
----------------------------------------------

             Summary: Can't create User Defined Functions with same name, different args/types
                 Key: CASSANDRA-11347
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11347
             Project: Cassandra
          Issue Type: Bug
         Environment: Cassandra 3.4 | Ruby driver 3.0.0-rc1
            Reporter: Kishan Karunaratne


As of Cassandra 3.4, I can no longer create multiple UDFs with the same name, but different args/types:

{noformat}
CREATE FUNCTION state_group_and_sum(state map<int, int>, star_rating int)
                      CALLED ON NULL INPUT
                      RETURNS map<int, int>
                      LANGUAGE java
                      AS 'if (state.get(star_rating) == null) state.put(star_rating, 1); else state.put(star_rating, ((Integer) state.get(star_rating)) + 1); return state;';
      CREATE FUNCTION state_group_and_sum(state map<int, smallint>, star_rating smallint)
                      CALLED ON NULL INPUT
                      RETURNS map<int, smallint>
                      LANGUAGE java
                      AS 'if (state.get(star_rating) == null) state.put(star_rating, 1); else state.put(star_rating, ((Integer) state.get(star_rating)) + 1); return state;';
{noformat}

Returns to the client:
{noformat}
InvalidRequest: code=2200 [Invalid query] message="Could not compile function 'simplex.state_group_and_sum' from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation failed:
Line 1: The method put(Integer, Short) in the type Map<Integer,Short> is not applicable for the arguments (Short, int)
Line 1: The method put(Integer, Short) in the type Map<Integer,Short> is not applicable for the arguments (Short, int)
Line 1: Cannot cast from Short to Integer
{noformat}



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