You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Droopy Hoo <ol...@gmail.com> on 2015/11/19 13:50:23 UTC

Question about implement a scalarFunction

Hi, all

I have met a problem when using calcite 1.4 to implement a scalarFunction
for my udf.

the field type is date  and I want to realize the MY_FUNC(date)

*SQL : select MY_FUNC(date)  from table;*

if I set my function's argument type to java.sql.Date, calcite will report
Exception:

* Caused by: org.codehaus.commons.compiler.CompileException: Line 124,
Column 45: No applicable constructor/method found for actual parameters
"int"; *


if I set the function's argument type to  int, calcite will report
Exception:

*Caused by: org.apache.calcite.sql.validate.SqlValidatorException: No match
found for function signature MY_FUNCTION(<DATE>)*


In my opinion, Now, I implement both two functions (one the arg type is
int, other's is Date ), and it can work, but I think whether there is
another better choice ?  By the way , is date type must be transformed to
integer type when process the query ?