[ https://issues.apache.org/jira/browse/CASSANDRA-11391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Stupp reassigned CASSANDRA-11391: ---------------------------------------- Assignee: Robert Stupp > "class declared as inner class" error when using UDF > ---------------------------------------------------- > > Key: CASSANDRA-11391 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11391 > Project: Cassandra > Issue Type: Bug > Components: CQL > Environment: C* 3.4 > Reporter: DOAN DuyHai > Assignee: Robert Stupp > Priority: Critical > > {noformat} > cqlsh:music> CREATE FUNCTION testMapEntry(my_map map<text, text>) > ... CALLED ON NULL INPUT > ... RETURNS text > ... LANGUAGE java > ... AS $$ > ... String buffer = ""; > ... for(java.util.Map.Entry<String, String> entry: > my_map.entrySet()) { > ... buffer = buffer + entry.getKey() + ": " + > entry.getValue() + ", "; > ... } > ... return buffer; > ... $$; > InvalidRequest: code=2200 [Invalid query] > message="Could not compile function 'music.testmapentry' from Java source: > org.apache.cassandra.exceptions.InvalidRequestException: > Java UDF validation failed: [class declared as inner class]" > {noformat} > When I try to decompile the source code into byte code, below is the result: > {noformat} > public java.lang.String test(java.util.Map<java.lang.String, > java.lang.String>); > Code: > 0: ldc #2 // String > 2: astore_2 > 3: aload_1 > 4: invokeinterface #3, 1 // InterfaceMethod > java/util/Map.entrySet:()Ljava/util/Set; > 9: astore_3 > 10: aload_3 > 11: invokeinterface #4, 1 // InterfaceMethod > java/util/Set.iterator:()Ljava/util/Iterator; > 16: astore 4 > 18: aload 4 > 20: invokeinterface #5, 1 // InterfaceMethod > java/util/Iterator.hasNext:()Z > 25: ifeq 94 > 28: aload 4 > 30: invokeinterface #6, 1 // InterfaceMethod > java/util/Iterator.next:()Ljava/lang/Object; > 35: checkcast #7 // class java/util/Map$Entry > 38: astore 5 > 40: new #8 // class java/lang/StringBuilder > 43: dup > 44: invokespecial #9 // Method > java/lang/StringBuilder."<init>":()V > 47: aload_2 > 48: invokevirtual #10 // Method > java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; > 51: aload 5 > 53: invokeinterface #11, 1 // InterfaceMethod > java/util/Map$Entry.getKey:()Ljava/lang/Object; > 58: checkcast #12 // class java/lang/String > 61: invokevirtual #10 // Method > java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; > 64: ldc #13 // String : > 66: invokevirtual #10 // Method > java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; > 69: aload 5 > 71: invokeinterface #14, 1 // InterfaceMethod > java/util/Map$Entry.getValue:()Ljava/lang/Object; > 76: checkcast #12 // class java/lang/String > 79: invokevirtual #10 // Method > java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; > 82: ldc #15 // String , > 84: invokevirtual #10 // Method > java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; > 87: invokevirtual #16 // Method > java/lang/StringBuilder.toString:()Ljava/lang/String; > 90: astore_2 > 91: goto 18 > 94: aload_2 > 95: areturn > {noformat} > There is nothing that could trigger inner class creation ... -- This message was sent by Atlassian JIRA (v6.3.4#6332)