asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ali Alsuliman (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (ASTERIXDB-2797) Using an array constructor in a function results in an internal error
Date Mon, 07 Jun 2021 13:30:00 GMT

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

Ali Alsuliman edited comment on ASTERIXDB-2797 at 6/7/21, 1:29 PM:
-------------------------------------------------------------------

The error is *not* caused by the use of an array constructor in a function. The error can
happen when there is a variable in the array constructor.

For example,
{code:java}
FROM GleambookUsers AS v SELECT [v] AS list;
{code}
The error has to do with a bug in the compiler where it inserts cast() for the variables in
the array constructor in a way that messes up the type of the array constructor.


was (Author: alsuliman):
The error is not caused by the use of an array constructor in a function. The error can happen
when there is a variable in the array constructor.

For example,
{code:java}
FROM GleambookUsers AS v SELECT [v] AS list;
{code}
The error has to do with a bug in the compiler where it inserts cast() for the variables in
the array constructor in a way that messes up the type of the array constructor.

> Using an array constructor in a function results in an internal error 
> ----------------------------------------------------------------------
>
>                 Key: ASTERIXDB-2797
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2797
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: COMP - Compiler
>    Affects Versions: 0.9.5
>            Reporter: Gift Sinthong
>            Assignee: Ali Alsuliman
>            Priority: Major
>             Fix For: 0.9.7
>
>
>  
> The following function (foo) takes in a record and returns it. When calling this function
on a dataset (the last query) causes an internal error 'IndexOutOfBounds'. However, calling
the same function on a record and an array of records works fine. Changing the array constructor
to the 'to_array' function also works.
>  
> {code:java}
> USE TinySocial;
> CREATE OR REPLACE FUNCTION foo(r) { 
>    (SELECT VALUE x FROM [r] AS x)[0] 
> };
> foo({'a':5});
> SELECT foo(s) FROM [{'a':5}, {'b':7}] AS s LIMIT 5;
> SELECT foo(s) FROM GleambookUsers AS s LIMIT 5;
> {code}
> Here is the error message from the log file.
> {code:java}
> Caused by: java.lang.IndexOutOfBoundsExceptionCaused by: java.lang.IndexOutOfBoundsException
at org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream.write(ByteArrayAccessibleOutputStream.java:75)
~[hyracks-data-std-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at java.io.DataOutputStream.write(DataOutputStream.java:107)
~[?:1.8.0_121] at org.apache.asterix.om.pointables.ARecordVisitablePointable.set(ARecordVisitablePointable.java:231)
~[asterix-om-0.9.6-SNAPSHOT.jar:0.9.6-SNAPSHOT] at org.apache.asterix.om.pointables.AListVisitablePointable.set(AListVisitablePointable.java:127)
~[asterix-om-0.9.6-SNAPSHOT.jar:0.9.6-SNAPSHOT] at org.apache.asterix.om.pointables.ARecordVisitablePointable.set(ARecordVisitablePointable.java:234)
~[asterix-om-0.9.6-SNAPSHOT.jar:0.9.6-SNAPSHOT] at org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ARecordPrinterFactory$1.print(ARecordPrinterFactory.java:61)
~[asterix-om-0.9.6-SNAPSHOT.jar:0.9.6-SNAPSHOT] at org.apache.hyracks.algebricks.runtime.writers.PrinterBasedWriterFactory$1.printTuple(PrinterBasedWriterFactory.java:66)
~[algebricks-runtime-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at org.apache.hyracks.algebricks.runtime.serializer.ResultSerializerFactoryProvider$1$1.appendTuple(ResultSerializerFactoryProvider.java:64)
~[algebricks-runtime-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at org.apache.hyracks.dataflow.std.result.ResultWriterOperatorDescriptor$1.nextFrame(ResultWriterOperatorDescriptor.java:105)
~[hyracks-dataflow-std-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at org.apache.hyracks.dataflow.common.comm.io.AbstractFrameAppender.write(AbstractFrameAppender.java:94)
~[hyracks-dataflow-common-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.flushAndReset(AbstractOneInputOneOutputOneFramePushRuntime.java:73)
~[algebricks-runtime-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.flushIfNotFailed(AbstractOneInputOneOutputOneFramePushRuntime.java:78)
~[algebricks-runtime-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] at org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:60)
~[algebricks-runtime-0.3.6-SNAPSHOT.jar:0.3.6-SNAPSHOT] ... 7 more
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message