[
https://issues.apache.org/jira/browse/CALCITE-680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14620727#comment-14620727
]
Julian Hyde commented on CALCITE-680:
-------------------------------------
I'd hoped that there was a fairly easy way to slot in "bridging code" that
converted ByteString to byte[] when coming from the outside world and vice
versa. If you couldn't find an easy way I can't argue with that.
I still think that the correct specification is that UDFs parameters and return
values should be in terms of their JDBC types (byte[], java.sql.Date etc.)
But I don't see much harm in ALSO accepting UDFs that take and return
ByteString values. I'd accept that as a patch if there was also some
documentation about how to write a UDF. (The section in
https://calcite.incubator.apache.org/docs/tutorial.html is "To be written.)
> 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)