namhnguyen / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

left-outer join with a nullable field returns an IndexOutOfBoundsException #760

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If your type contains a field which is nullable, and you left-outer joined by 
this field, then you will get an IndexOutOfBoundsException exception.
Note that the data doesn't have to contain a null field, the type just needs to 
be nullable to reproduce the error.

Reproduction:
=============

drop dataverse kereno if exists;
create dataverse kereno;
use dataverse kereno;

create type page_info_type as open {}

create type page_views_type as closed {
        id: int32, 
        user: string?,
        action: int32,
        timespent: int32,
        query_term: string?,
        ip_addr: int32,
        timestamp: int32,
        estimated_revenue: double?,
        page_info: page_info_type,
        page_links: {{ page_info_type}}?
}

create dataset page_views(page_views_type)
primary key id;

load dataset page_views using localfs
(("path"="127.0.0.1:///home/kereno/benchmarking/asterix/ADM-format/page_views/pa
rt-m-00000"),("format"="adm"));

create type power_users_type as closed {
        id: int32,
        name: string?,
        phone: string?,
        address: string?,
        city: string?,
        state: string?,
        zip: int32?
}

create dataset power_users_samples(power_users_type)
primary key id;

load dataset power_users_samples using localfs
(("path"="127.0.0.1:///home/kereno/benchmarking/asterix/ADM-format/power_users_s
amples/part-m-00000"),("format"="adm"));

for $x in dataset page_views
return $x

for $x in dataset power_users_samples
return $x

//Query 13
//========

for $page_views in dataset page_views
return {
"user": $page_views.user,
"phone": for $power_users_samples in dataset power_users_samples
where $page_views.user = $power_users_samples.name
return $power_users_samples.phone, //if you replace phone by id - it works.
"estimated_revenue": $page_views.estimated_revenue
}

Stack:
========
INFO: Executing: 
edu.uci.ics.hyracks.control.cc.work.JobletCleanupNotificationWork@39400055
edu.uci.ics.hyracks.api.exceptions.HyracksException: Job failed on account of:
edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException

    at edu.uci.ics.hyracks.control.cc.job.JobRun.waitForCompletion(JobRun.java:207)
    at edu.uci.ics.hyracks.control.cc.work.WaitForJobCompletionWork$1.run(WaitForJobCompletionWork.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.hyracks.control.common.utils.ExceptionUtils.setNodeIds(ExceptionUtils.java:41)
    at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:291)
    ... 3 more
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.hyracks.algebricks.runtime.serializer.ResultSerializerFactoryProvider$1$1.appendTuple(ResultSerializerFactoryProvider.java:69)
    at edu.uci.ics.hyracks.dataflow.std.result.ResultWriterOperatorDescriptor$1.nextFrame(ResultWriterOperatorDescriptor.java:95)
    at edu.uci.ics.hyracks.dataflow.common.comm.util.FrameUtils.flushFrame(FrameUtils.java:38)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:38)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:41)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:41)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor$2.close(AlgebricksMetaOperatorDescriptor.java:141)
    at edu.uci.ics.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter.close(PreclusteredGroupWriter.java:168)
    at edu.uci.ics.hyracks.dataflow.std.group.preclustered.PreclusteredGroupOperatorNodePushable.close(PreclusteredGroupOperatorNodePushable.java:82)
    at edu.uci.ics.hyracks.dataflow.std.sort.ExternalSortRunMerger.process(ExternalSortRunMerger.java:164)
    at edu.uci.ics.hyracks.dataflow.std.sort.ExternalSortOperatorDescriptor$MergeActivity$1.initialize(ExternalSortOperatorDescriptor.java:189)
    at edu.uci.ics.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.initialize(SuperActivityOperatorNodePushable.java:81)
    at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:234)
    ... 3 more
Caused by: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.dataflow.data.nontagged.printers.ARecordPrinterFactory$1.print(ARecordPrinterFactory.java:64)
    at edu.uci.ics.hyracks.algebricks.runtime.writers.PrinterBasedWriterFactory$1.printTuple(PrinterBasedWriterFactory.java:62)
    at edu.uci.ics.hyracks.algebricks.runtime.serializer.ResultSerializerFactoryProvider$1$1.appendTuple(ResultSerializerFactoryProvider.java:65)
    ... 15 more
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.set(ARecordPointable.java:263)
    at edu.uci.ics.asterix.dataflow.data.nontagged.printers.ARecordPrinterFactory$1.print(ARecordPrinterFactory.java:60)
    ... 17 more
Caused by: java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.om.pointables.AListPointable.set(AListPointable.java:160)
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.set(ARecordPointable.java:225)
    ... 18 more
Caused by: java.lang.IndexOutOfBoundsException
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:138)
    at edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream.write(ByteArrayAccessibleOutputStream.java:48)
    at java.io.DataOutputStream.write(DataOutputStream.java:107)
    at edu.uci.ics.asterix.om.pointables.AListPointable.set(AListPointable.java:133)
    ... 19 more
Apr 23, 2014 5:39:22 PM edu.uci.ics.asterix.api.http.servlet.APIServlet doPost
SEVERE: Job failed on account of:
edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException

edu.uci.ics.hyracks.api.exceptions.HyracksException: Job failed on account of:
edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException

    at edu.uci.ics.hyracks.control.cc.job.JobRun.waitForCompletion(JobRun.java:207)
    at edu.uci.ics.hyracks.control.cc.work.WaitForJobCompletionWork$1.run(WaitForJobCompletionWork.java:44)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.hyracks.control.common.utils.ExceptionUtils.setNodeIds(ExceptionUtils.java:41)
    at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:291)
    ... 3 more
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.hyracks.algebricks.runtime.serializer.ResultSerializerFactoryProvider$1$1.appendTuple(ResultSerializerFactoryProvider.java:69)
    at edu.uci.ics.hyracks.dataflow.std.result.ResultWriterOperatorDescriptor$1.nextFrame(ResultWriterOperatorDescriptor.java:95)
    at edu.uci.ics.hyracks.dataflow.common.comm.util.FrameUtils.flushFrame(FrameUtils.java:38)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:38)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:41)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputOneFramePushRuntime.close(AbstractOneInputOneOutputOneFramePushRuntime.java:41)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor$2.close(AlgebricksMetaOperatorDescriptor.java:141)
    at edu.uci.ics.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter.close(PreclusteredGroupWriter.java:168)
    at edu.uci.ics.hyracks.dataflow.std.group.preclustered.PreclusteredGroupOperatorNodePushable.close(PreclusteredGroupOperatorNodePushable.java:82)
    at edu.uci.ics.hyracks.dataflow.std.sort.ExternalSortRunMerger.process(ExternalSortRunMerger.java:164)
    at edu.uci.ics.hyracks.dataflow.std.sort.ExternalSortOperatorDescriptor$MergeActivity$1.initialize(ExternalSortOperatorDescriptor.java:189)
    at edu.uci.ics.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.initialize(SuperActivityOperatorNodePushable.java:81)
    at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:234)
    ... 3 more
Caused by: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.dataflow.data.nontagged.printers.ARecordPrinterFactory$1.print(ARecordPrinterFactory.java:64)
    at edu.uci.ics.hyracks.algebricks.runtime.writers.PrinterBasedWriterFactory$1.printTuple(PrinterBasedWriterFactory.java:62)
    at edu.uci.ics.hyracks.algebricks.runtime.serializer.ResultSerializerFactoryProvider$1$1.appendTuple(ResultSerializerFactoryProvider.java:65)
    ... 15 more
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.set(ARecordPointable.java:263)
    at edu.uci.ics.asterix.dataflow.data.nontagged.printers.ARecordPrinterFactory$1.print(ARecordPrinterFactory.java:60)
    ... 17 more
Caused by: java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.om.pointables.AListPointable.set(AListPointable.java:160)
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.set(ARecordPointable.java:225)
    ... 18 more
Caused by: java.lang.IndexOutOfBoundsException
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:138)
    at edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream.write(ByteArrayAccessibleOutputStream.java:48)
    at java.io.DataOutputStream.write(DataOutputStream.java:107)
    at edu.uci.ics.asterix.om.pointables.AListPointable.set(AListPointable.java:133)
    ... 19 more

Original issue reported on code.google.com by ker...@gmail.com on 24 Apr 2014 at 12:40

GoogleCodeExporter commented 9 years ago
work-around to this issue: if you put the return of the left-outer join in 
brackets, you will see the right results and will not hit an exception (!). 
Example below:

//Query 13
//========

for $page_views in dataset page_views
return {
"user": $page_views.user,
"estimated_revenue": $page_views.estimated_revenue,
"name_and_phone": for $power_users_samples in dataset power_users_samples
where $page_views.user = $power_users_samples.name
return {
"phone": $power_users_samples.phone
}
}

Original comment by ker...@gmail.com on 24 Apr 2014 at 1:09

GoogleCodeExporter commented 9 years ago

Original comment by ildar.absalyamov on 25 Oct 2014 at 9:32

GoogleCodeExporter commented 9 years ago

Original comment by ildar.absalyamov on 6 Nov 2014 at 6:36