asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomasz Pawłowski (JIRA) <j...@apache.org>
Subject [jira] [Commented] (ASTERIXDB-2157) Parsing metadata of UDF with UnorderedList return type
Date Tue, 07 Nov 2017 21:21:00 GMT

    [ https://issues.apache.org/jira/browse/ASTERIXDB-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16242901#comment-16242901
] 

Tomasz Pawłowski commented on ASTERIXDB-2157:
---------------------------------------------

I have already created a pull request for this bug https://github.com/apache/asterixdb/pull/6
including a proper unit test.

> Parsing metadata of UDF with UnorderedList return type
> ------------------------------------------------------
>
>                 Key: ASTERIXDB-2157
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2157
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: MTD - Metadata
>            Reporter: Tomasz Pawłowski
>            Priority: Minor
>              Labels: easyfix, newbie
>
> While defining a library UDF with return_type representing a unordered list (eg. {{ ASTRING
}}). UDF is created with result type {{ {{ ASTRING }} }}. 
> This error can be replicated with libraryFunction:
>   <libraryFunction>
>       <function_type>SCALAR</function_type>
>       <name>test</name>
>       <arguments>ASTRING</arguments>
>       <return_type>{{ ASTRING }}</return_type>
>       <definition>org.apache.asterix.external.library.TestFactory</definition>
>     </libraryFunction>
> TestFactory.java:
> package org.apache.asterix.external.library;
> import org.apache.asterix.external.api.IExternalScalarFunction;
> import org.apache.asterix.external.api.IFunctionFactory;
> public class TestFactory implements IFunctionFactory {
>     @Override
>     public IExternalScalarFunction getExternalFunction() {
>         return new TestFunction();
>     }
> }
> // END of TestFactory.java
> TestFunction.java:
> package org.apache.asterix.external.library;
> import org.apache.asterix.external.api.IExternalScalarFunction;
> import org.apache.asterix.external.api.IFunctionHelper;
> import org.apache.asterix.external.library.java.JObjects;
> import org.apache.asterix.om.types.BuiltinType;
> public class TestFunction implements IExternalScalarFunction {
>     private JObjects.JUnorderedList results;
>     @Override
>     public void deinitialize() {}
>     @Override
>     public void evaluate(IFunctionHelper functionHelper) throws Exception {
>         JObjects.JString input = (JObjects.JString) functionHelper.getArgument(0);
>         results.reset();
>         JObjects.JUnorderedList test = new JObjects.JUnorderedList(BuiltinType.ASTRING);
>         test.add(input);
>         test.add(input);
>         test.add(input);
>         results.add(test);
>         functionHelper.setResult(results);
>     }
>     @Override
>     public void initialize(IFunctionHelper functionHelper) throws Exception{
>         results = (JObjects.JUnorderedList) functionHelper.getResultObject();
>     }
> }
> // END of TestFunction.java
> And executing (AQL):
> use dataverse test;
> testlib#test("test")
> Which results in:
> {{ {{ "test", "test", "test" }} }}
> At the same time writing TestFunction evaluate to return {{ ASTRING }} results in error:
> org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: java.io.EOFException
> 	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:231)
> 	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:153)
> 	at org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression.accept(ScalarFunctionCallExpression.java:55)
> 	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.transform(ConstantFoldingRule.java:163)
> 	at org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractAssignOperator.acceptExpressionTransform(AbstractAssignOperator.java:67)
> 	at org.apache.asterix.optimizer.rules.ConstantFoldingRule.rewritePost(ConstantFoldingRule.java:150)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:126)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:100)
> 	at org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:53)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:102)
> 	at org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:82)
> 	at org.apache.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:90)
> 	at org.apache.asterix.api.common.APIFramework.compileQuery(APIFramework.java:267)
> 	at org.apache.asterix.app.translator.QueryTranslator.rewriteCompileQuery(QueryTranslator.java:1834)
> 	at org.apache.asterix.app.translator.QueryTranslator.lambda$handleQuery$1(QueryTranslator.java:2307)
> 	at org.apache.asterix.app.translator.QueryTranslator.createAndRunJob(QueryTranslator.java:2407)
> 	at org.apache.asterix.app.translator.QueryTranslator.deliverResult(QueryTranslator.java:2340)
> 	at org.apache.asterix.app.translator.QueryTranslator.handleQuery(QueryTranslator.java:2319)
> 	at org.apache.asterix.app.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:370)
> 	at org.apache.asterix.app.translator.QueryTranslator.compileAndExecute(QueryTranslator.java:253)
> 	at org.apache.asterix.api.http.server.ApiServlet.post(ApiServlet.java:153)
> 	at org.apache.hyracks.http.server.AbstractServlet.handle(AbstractServlet.java:78)
> 	at org.apache.hyracks.http.server.HttpRequestHandler.handle(HttpRequestHandler.java:70)
> 	at org.apache.hyracks.http.server.HttpRequestHandler.call(HttpRequestHandler.java:55)
> 	at org.apache.hyracks.http.server.HttpRequestHandler.call(HttpRequestHandler.java:36)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.hyracks.api.exceptions.HyracksDataException: java.io.EOFException
> 	at org.apache.hyracks.api.exceptions.HyracksDataException.create(HyracksDataException.java:45)
> 	at org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer.deserialize(AUnorderedListSerializerDeserializer.java:102)
> 	at org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer.deserialize(AUnorderedListSerializerDeserializer.java:43)
> 	at org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer.deserialize(AUnorderedListSerializerDeserializer.java:96)
> 	at org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer.deserialize(AUnorderedListSerializerDeserializer.java:43)
> 	at org.apache.asterix.formats.nontagged.SerializerDeserializerProvider$1.deserialize(SerializerDeserializerProvider.java:191)
> 	at org.apache.asterix.formats.nontagged.SerializerDeserializerProvider$1.deserialize(SerializerDeserializerProvider.java:173)
> 	at org.apache.asterix.optimizer.rules.ConstantFoldingRule$ConstantFoldingVisitor.visitScalarFunctionCallExpression(ConstantFoldingRule.java:228)
> 	... 29 more
> Caused by: java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:392)
> 	at org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer.deserialize(AUnorderedListSerializerDeserializer.java:92)
> 	... 35 more



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message