br1ghtyang / asterixdb

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

Common subexpression elimination doesn't carry the "openness" of a record with it #592

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The reproduction is below. The statement has a common subexpression. Removing 
it causes the statement to succeed.
----------------------------------------
drop dataverse fooverse if exists;
create dataverse fooverse;
use dataverse fooverse;

create type bartype as open {
    "baz": int32
}

create type footype as open {
    "id": int32,
    "bars": [ bartype ]?   
};

create dataset fooset(footype) primary key id;

insert into dataset fooset (
{
    "id": 1,
    "bars": [
        { "baz": 1 },
        { "baz": 1 }
    ]
}
);
----------------------------------------

Original issue reported on code.google.com by zheilb...@gmail.com on 31 Jul 2013 at 12:46

GoogleCodeExporter commented 8 years ago
The error message:
null []

The stack trace:
SEVERE: Job failed on account of:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: 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.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException

    at edu.uci.ics.hyracks.control.cc.job.JobRun.waitForCompletion(JobRun.java:192)
    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.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException
    at edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.produceTuple(AssignRuntimeFactory.java:126)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.nextFrame(AssignRuntimeFactory.java:112)
    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.std.EmptyTupleSourceRuntimeFactory$1.open(EmptyTupleSourceRuntimeFactory.java:56)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor$1.initialize(AlgebricksMetaOperatorDescriptor.java:104)
    at edu.uci.ics.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.initialize(SuperActivityOperatorNodePushable.java:81)
    at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:228)
    ... 3 more
Caused by: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.runtime.evaluators.functions.CastRecordDescriptor$2$1.evaluate(CastRecordDescriptor.java:91)
    at edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter$ScalarEvaluatorFactoryAdapter$1.evaluate(LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.java:106)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.produceTuple(AssignRuntimeFactory.java:124)
    ... 10 more
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: 
java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.set(ARecordPointable.java:264)
    at edu.uci.ics.asterix.om.pointables.AbstractVisitablePointable.set(AbstractVisitablePointable.java:55)
    at edu.uci.ics.asterix.runtime.evaluators.functions.CastRecordDescriptor$2$1.evaluate(CastRecordDescriptor.java:86)
    ... 12 more
Caused by: java.lang.IllegalStateException: 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:226)
    ... 14 more
Caused by: java.lang.IllegalStateException: java.lang.IndexOutOfBoundsException
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.set(ARecordPointable.java:264)
    at edu.uci.ics.asterix.om.pointables.AListPointable.set(AListPointable.java:135)
    ... 15 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.ARecordPointable.set(ARecordPointable.java:223)
    ... 16 more

The plan:
INFO: Optimized Plan:
commit
-- COMMIT  |PARTITIONED|
  project ([$$6])
  -- STREAM_PROJECT  |PARTITIONED|
    exchange 
    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
      insert into fooverse:fooset from %0->$$8 partitioned by [%0->$$6]
      -- INSERT_DELETE  |PARTITIONED|
        exchange 
        -- HASH_PARTITION_EXCHANGE [$$6]  |PARTITIONED|
          assign [$$6] <- [function-call: asterix:field-access-by-index, Args:[%0->$$8, AInt32: {0}]]
          -- ASSIGN  |UNPARTITIONED|
            project ([$$8])
            -- STREAM_PROJECT  |UNPARTITIONED|
              assign [$$8] <- [function-call: asterix:cast-record, Args:[function-call: asterix:open-record-constructor, Args:[AString: {id}, AInt32: {1}, AString: {bars}, function-call: asterix:ordered-list-constructor, Args:[%0->$$10, %0->$$10]]]]
              -- ASSIGN  |UNPARTITIONED|
                assign [$$10] <- [function-call: asterix:cast-record, Args:[function-call: asterix:closed-record-constructor, Args:[AString: {baz}, AInt32: {1}]]]
                -- ASSIGN  |UNPARTITIONED|
                  empty-tuple-source
                  -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|

Original comment by zheilb...@gmail.com on 31 Jul 2013 at 12:48

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 16 Aug 2013 at 12:00

GoogleCodeExporter commented 8 years ago
Also try this (same root cause):

drop dataverse fooverse if exists;
create dataverse fooverse;
use dataverse fooverse;

create type bartype as open {
    "baz": int32
}

create type footype as open {
    "id": int32,
    "bars": [ bartype ]?   
};

create dataset fooset(footype) primary key id;

insert into dataset fooset (
let $t := {"baz": 1}
return 
{
    "id": 1,
    "bars": [
        $t,
        $t
    ]
}
);

Original comment by zheilb...@gmail.com on 4 Oct 2013 at 10:21

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 18 Oct 2013 at 5:35

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 23 Oct 2013 at 6:14