[
https://issues.apache.org/jira/browse/CALCITE-680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14492678#comment-14492678
]
Julian Hyde commented on CALCITE-680:
-------------------------------------
+1
The arguments and return types for UDFs should use the default Java types for
each SQL type, per the JDBC spec. For BINARY and VARBINARY SQL types, the Java
type is byte[] (even though Calcite uses ByteString internally).
For DATE, TIME, TIMESTAMP types, the Java types are java.sql.Date, Time,
Timestamp (even though Calcite uses int, int, long internally).
> 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)