[ 
https://issues.apache.org/jira/browse/CASSANDRA-7924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14140631#comment-14140631
 ] 

Benjamin Lerer commented on CASSANDRA-7924:
-------------------------------------------

My comments:
* It seems to me that more than 90% of the code of {{AbstractJavaSourceUDF}} is 
use to generate the code of the UDF classes. Due to that I think it should be 
better to convert it into a factory that do not extends UDFunction. It will 
make the things clearer on what is the main purpose of the class.
* The code of {{AbstractJavaSourceUDF.buildUDF}} should be split in smaller 
methods as it will make the code easier to read. I think that using 
{{String.format}} instead of {{StringBuilder.append}} will also help making the 
code more readable.
* Calling {{CannotCompileException.getReason()}} is the same as calling 
{{CannotCompileException.getMessage()}} and calling 
{{InvocationTargetException.getTargetException()}} is the same as calling 
{{InvocationTargetException.getCause()}}, so I think that you should decide if 
you perfer to append only the message or the full stack trace and merge the 3 
catches into one.
 * You should remove the {{@SuppressWarnings}} as they are only needed by your 
IDE (they actually trigger some warning in mine)
* In {{UFTest.testFunctionCreationAndDrop}}, could you add a test to verify 
that when one function as been drop you cannot call it anymore?  
* In {{UFTest.testCreateOrReplaceJavaFunction}}, could you test that when you 
have replaced a function it will that one which is called? 

> Optimization of Java UDFs
> -------------------------
>
>                 Key: CASSANDRA-7924
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7924
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Robert Stupp
>            Assignee: Robert Stupp
>              Labels: docs, lhf, udf
>             Fix For: 3.0
>
>         Attachments: 7924.txt
>
>
> Refactor 'java' UDFs to optimize invocation. Goal is to remove reflection 
> code. Implementation uses javassist to generate an instance of {{Function}} 
> that can be directly used.



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

Reply via email to