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

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

In my opinion, the ByteString is an internal representation of byte array. The 
UDF, should be defined using byte[], and EnumerableCalc should be updated to 
convert byte[] to ByteString when function with byte parameter or return type 
is detected.  

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

Reply via email to