Hey Anil,
The problem is that you are using keyword "pow" instead of "power" in
your SQL so Optiq doesn't recognize it as a keyword. Optiq uses "power"
as the keyword for the function you intend to perform (Its SQL standard
I think).
You will have to change your function definition to reflect this as well.
Thanks
Mehant
On 3/1/14, 7:52 AM, Venki Korukanti wrote:
Hi Anil,
I think custom functions within SQL are not supported yet. There is a
separate JIRA for that. You can test by creating a physical plan that uses
your function. An example of physical plan
is: <gitclone>/exec/java-exec/src/test/resources/functions/testSubstring.json.
In the "project" operator change expr from "substr" to your function. Once
you create a physical plan either you can submit it through
"./bin/submit_plan" or write a unittest that submits this plan. I prefer
the latter as you anyway need a unittest that tests your code in order to
submit the patch. Example unittest for testSubstring.json file is:
<gitclone>/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFunctions.java,
look at testSubstring.
Thanks
Venki
On Sat, Mar 1, 2014 at 6:16 AM, AnilKumar B <[email protected]> wrote:
I am new to Apache drill, trying to implement Power
function(DRILL-390<https://issues.apache.org/jira/browse/DRILL-390>),
I implemented Power function, and registered in
org.apache.drill.common.expression.fn.MathFunctions as below.
FunctionDefinition.operator("power", new
ArgumentValidators.NumericTypeAllowed(2, true), new
OutputTypeDeterminer.SameAsAnySoft() , "pow")
While testing, I am facing below issue, am I missing any other
registration?
0: jdbc:drill:schema=parquet-local> SELECT pow(2.0,3.0) AS POW_VALUE FROM
"sample-data/region.parquet";
Mar 01, 2014 7:35:50 PM org.eigenbase.sql.validate.SqlValidatorException
<init>
SEVERE: org.eigenbase.sql.validate.SqlValidatorException: No match found
for function signature POW(<NUMERIC>, <NUMERIC>)
Mar 01, 2014 7:35:50 PM org.eigenbase.util.EigenbaseException <init>
SEVERE: org.eigenbase.util.EigenbaseContextException: From line 1, column 8
to line 1, column 19
org.eigenbase.util.EigenbaseContextException: From line 1, column 8 to line
1, column 19
at
org.eigenbase.resource.EigenbaseResource$_Def12.ex(EigenbaseResource.java:1026)
at org.eigenbase.sql.SqlUtil.newContextException(SqlUtil.java:739)
at org.eigenbase.sql.SqlUtil.newContextException(SqlUtil.java:726)
at
org.eigenbase.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:3849)
at
org.eigenbase.sql.validate.SqlValidatorImpl.handleUnresolvedFunction(SqlValidatorImpl.java:1613)
at org.eigenbase.sql.SqlFunction.deriveType(SqlFunction.java:312)
at org.eigenbase.sql.SqlFunction.deriveType(SqlFunction.java:222)
Thanks & Regards,
B Anil Kumar.