Have you defined the SQL version of your function? For most aggregate functions, there are usually 2 versions, SQL++ and SQL. coll_stddev would correspond to the SQL++ function. array_stddev would correspond to the SQL function.
On Tue, Feb 20, 2018 at 1:19 PM, Wail Alkowaileet <[email protected]> wrote: > Maybe something related to the function mapping: > > org.apache.asterix.lang.sqlpp.util.FunctionMapUtil > > On Tue, Feb 20, 2018 at 11:34 AM, James Fang <[email protected]> wrote: > > > Hi, > > > > Recently, I have noticed that the aggregation functions I have been > > implementing only work as collection functions, and it will produce > errors > > when ran as an array function. This only affects the new aggregate > > functions I have added and does not affect the existing aggregate > > functions(avg, max, min). Is there something specific I have to do to > make > > these functions work as array functions. > > > > For example: > > *My Functions:* > > coll_stddev( [1.0, 2.0, 3.0] ) --> works > > array_stddev( [1.0, 2.0, 3.0] ) - --> undefined function. > > > > *Exisitng Functions:* > > coll_avg( [1.0, 2.0, 3.0] ) --> works > > array_avg( [1.0, 2.0, 3.0] ) - --> works > > > > > > I have only modified or added files in: > > 1) New FunctionDescriptors and AggregateFunctions > > 2) BuiltinFunctions.java > > 3) FunctionCollection.java > > 4) New Typecomputer. > > > > Stack trace of undefined function: > > 11:15:48.177 [HttpExecutor(port:19001)-13] ERROR org.apache.asterix - > > function Default.array_stddev@1 is not defined > > org.apache.asterix.common.exceptions.CompilationException: function > > Default.array_stddev@1 is not defined > > at > > org.apache.asterix.lang.common.util.FunctionUtil. > > retrieveUsedStoredFunctions(FunctionUtil.java:144) > > ~[classes/:?] > > at > > org.apache.asterix.lang.sqlpp.rewrites.SqlppQueryRewriter. > > inlineDeclaredUdfs(SqlppQueryRewriter.java:226) > > ~[classes/:?] > > at > > org.apache.asterix.lang.sqlpp.rewrites.SqlppQueryRewriter. > > rewrite(SqlppQueryRewriter.java:131) > > ~[classes/:?] > > at > > org.apache.asterix.api.common.APIFramework.reWriteQuery( > > APIFramework.java:199) > > ~[classes/:?] > > at > > org.apache.asterix.app.translator.QueryTranslator.rewriteCompileQuery( > > QueryTranslator.java:1894) > > ~[classes/:?] > > at > > org.apache.asterix.app.translator.QueryTranslator.lambda$handleQuery$2( > > QueryTranslator.java:2373) > > ~[classes/:?] > > at > > org.apache.asterix.app.translator.QueryTranslator.createAndRunJob( > > QueryTranslator.java:2496) > > ~[classes/:?] > > at > > org.apache.asterix.app.translator.QueryTranslator. > > deliverResult(QueryTranslator.java:2406) > > ~[classes/:?] > > at > > org.apache.asterix.app.translator.QueryTranslator. > > handleQuery(QueryTranslator.java:2385) > > ~[classes/:?] > > at > > org.apache.asterix.app.translator.QueryTranslator.compileAndExecute( > > QueryTranslator.java:381) > > ~[classes/:?] > > at org.apache.asterix.api.http.server.ApiServlet.post( > ApiServlet.java:168) > > [classes/:?] > > at > > org.apache.hyracks.http.server.AbstractServlet.handle( > > AbstractServlet.java:92) > > [classes/:?] > > at > > org.apache.hyracks.http.server.HttpRequestHandler. > > handle(HttpRequestHandler.java:71) > > [classes/:?] > > at > > org.apache.hyracks.http.server.HttpRequestHandler. > > call(HttpRequestHandler.java:56) > > [classes/:?] > > at > > org.apache.hyracks.http.server.HttpRequestHandler. > > call(HttpRequestHandler.java:37) > > [classes/:?] > > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > [?:1.8.0_131] > > at > > java.util.concurrent.ThreadPoolExecutor.runWorker( > > ThreadPoolExecutor.java:1142) > > [?:1.8.0_131] > > at > > java.util.concurrent.ThreadPoolExecutor$Worker.run( > > ThreadPoolExecutor.java:617) > > [?:1.8.0_131] > > at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131] > > > > > > -- > > *Regards,* > Wail Alkowaileet > -- Regards,
