You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ng Jiunn Jye (JIRA)" <ji...@apache.org> on 2015/07/09 15:18:05 UTC

[jira] [Commented] (CALCITE-680) Compilation Error when processing UDF with binary parameter

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

Ng Jiunn Jye commented on CALCITE-680:
--------------------------------------

Hi Julian, 
I have spent a significant amount of time trying to resolve this by making calcite work on byte[] argument / return type. 

The 2 main scenario 
- byte[] as argument 
- byte[] as return type 
spin off to 8 scenario 
 - udf on literal on projection
 - udf on column on projection
 - udf on literal on where clause
 - udf on column on where clause

almost each need to be fix at different area of the code. Even so, I just discovered the some fix work on single column projection but not on multiple column projection. 

I now wonder if it is a bad idea trying to make UDF use byte[] instead of ByteString. Mainly because everywhere in calcite is expecting binary array as ByteString.

I took a look at the BuildInMethod and the ByteString is used as argument and return type. 

I am thinking to fix this issue by using ByteString as argument / return type as in the other BuildInMethods. 


> Compilation Error when processing UDF with binary parameter
> -----------------------------------------------------------
>
>                 Key: CALCITE-680
>                 URL: https://issues.apache.org/jira/browse/CALCITE-680
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Ng Jiunn Jye
>            Assignee: Julian Hyde
>
> I am creating Calcite UDF which convert array of byte into string and vice versa.
> For BinaryToString udf, the SqlValidator is expecting the function with parameter byte[], but during execution, the EnumerableCalc is expecting the function to take parameter of type ByteString. 
> Test Sql  :
> select BinaryToString (x'01020304') from T1
> Error Message: 
> Caused by: org.codehaus.commons.compiler.CompileException: Line 24, Column 84: No applicable constructor/method found for actual parameters "org.apache.calcite.avatica.util.ByteString"; candidates are: "public java.lang.String BinaryToString.eval(byte[])"
> Generated Code extract : 
>             public Object current() {
>               return newBinaryToString().eval(new org.apache.calcite.avatica.util.ByteString(
>                   new byte[] {
>                     (byte)1,
>                     (byte)2,
>                     (byte)3,
>                     (byte)4}));
>             }



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