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] [Updated] (ASTERIXDB-2797) Using a variable in an array constructor results in an internal error
Date Mon, 07 Jun 2021 14:26:00 GMT

     [ https://issues.apache.org/jira/browse/ASTERIXDB-2797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ali Alsuliman updated ASTERIXDB-2797:
-------------------------------------
    Description: 
When a variable is used inside an array constructor, the compiler could mess up the output
type of the array when the compiler casts the array elements. At runtime, this can lead to
an internal error. One example is
{code:java}
FROM GleambookUsers AS v SELECT [v] AS list;{code}
Another example is the following function (foo) which 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}
 

  was:
 

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}
 


> Using a variable in an array constructor 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
>
>
> When a variable is used inside an array constructor, the compiler could mess up the output
type of the array when the compiler casts the array elements. At runtime, this can lead to
an internal error. One example is
> {code:java}
> FROM GleambookUsers AS v SELECT [v] AS list;{code}
> Another example is the following function (foo) which 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