br1ghtyang / asterixdb

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

ClassCastException for collection type #579

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This AQL will produce:
edu.uci.ics.asterix.om.types.BuiltinType$10 cannot be cast to 
edu.uci.ics.asterix.om.types.AbstractCollectionType [ClassCastException]

What am I doing wrong?

------------------------
drop dataverse foo if exists;
create dataverse foo if not exists;
use dataverse foo;

create type footype as open {
    entities: {
        text: string?,
        numbers: [int32]?
    },
    id: int64
}

create dataset foo(footype) primary key id;

insert into dataset foo({
    "id": int64("1"), 
    "entities": {
        "numbers": []}
    }
);

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

GoogleCodeExporter commented 8 years ago
The full stack trace:

SEVERE: Job failed on account of:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: edu.uci.ics.asterix.om.types.BuiltinType$10 
cannot be cast to edu.uci.ics.asterix.om.types.AbstractCollectionType
edu.uci.ics.hyracks.api.exceptions.HyracksException: Job failed on account of:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: edu.uci.ics.asterix.om.types.BuiltinType$10 
cannot be cast to edu.uci.ics.asterix.om.types.AbstractCollectionType
    at edu.uci.ics.hyracks.control.cc.job.JobRun.waitForCompletion(JobRun.java:190)
    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:724)
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: 
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: edu.uci.ics.asterix.om.types.BuiltinType$10 
cannot be cast to 
edu.uci.ics.asterix.om.types.AbstractCollectionType
    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.std.EmptyTupleSourceRuntimeFactory$1.open(EmptyTupleSourceRuntimeFactory.java:55)
    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: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: edu.uci.ics.asterix.om.types.BuiltinType$10 
cannot be cast to edu.uci.ics.asterix.om.types.AbstractCollectionType
    at edu.uci.ics.asterix.runtime.evaluators.functions.CastRecordDescriptor$2$1.evaluate(CastRecordDescriptor.java:91)
    at 
edu.uci.ics.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenT
oExpressionRuntimeProviderAdapter$ScalarEvaluatorFactoryAdapter$1.evaluate(Logic
alExpressionJobGenToExpressionRuntimeProviderAdapter.java:106)
    at edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.produceTuple(AssignRuntimeFactory.java:124)
    ... 9 more
Caused by: edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: 
edu.uci.ics.asterix.om.types.BuiltinType$10 cannot be cast to 
edu.uci.ics.asterix.om.types.AbstractCollectionType
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:83)
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:45)
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.accept(ARecordPointable.
java:282)
    at edu.uci.ics.asterix.runtime.evaluators.functions.CastRecordDescriptor$2$1.evaluate(CastRecordDescriptor.java:87)
    ... 11 more
Caused by: edu.uci.ics.asterix.common.exceptions.AsterixException: 
edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: edu.uci.ics.asterix.om.types.BuiltinType$10 
cannot be cast to 
edu.uci.ics.asterix.om.types.AbstractCollectionType
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:83)
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:45)
    at edu.uci.ics.asterix.om.pointables.ARecordPointable.accept(ARecordPointable.java:282)
    at edu.uci.ics.asterix.om.pointables.cast.ARecordCaster.writeOutput(ARecordCaster.java:290)
    at edu.uci.ics.asterix.om.pointables.cast.ARecordCaster.castRecord(ARecordCaster.java:126)
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:81)
    ... 14 more
Caused by: edu.uci.ics.asterix.common.exceptions.AsterixException: 
java.lang.ClassCastException: edu.uci.ics.asterix.om.types.BuiltinType$10 
cannot be cast to edu.uci.ics.asterix.om.types.AbstractCollectionType
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:64)
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:45)
    at edu.uci.ics.asterix.om.pointables.AListPointable.accept(AListPointable.java:166)
    at edu.uci.ics.asterix.om.pointables.cast.ARecordCaster.writeOutput(ARecordCaster.java:290)
    at edu.uci.ics.asterix.om.pointables.cast.ARecordCaster.castRecord(ARecordCaster.java:126)
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:81)
    ... 19 more
Caused by: java.lang.ClassCastException: 
edu.uci.ics.asterix.om.types.BuiltinType$10 cannot be cast to 
edu.uci.ics.asterix.om.types.AbstractCollectionType
    at edu.uci.ics.asterix.om.pointables.cast.ACastVisitor.visit(ACastVisitor.java:62)
    ... 24 more
java.lang.ClassCastException

Original comment by zheilb...@gmail.com on 29 Jul 2013 at 7:31

GoogleCodeExporter commented 8 years ago
Raman pointed out my error:
drop dataverse foo if exists;
create dataverse foo if not exists;
use dataverse foo;

create type footype as open {
        entities: {
                text: string?,
                numbers: [int32]?
        },
        id: int64
}

create dataset foo(footype) primary key id;

insert into dataset foo({
        "id": int64("1"),
        "entities": {
                "numbers": []}  ===> You have defined text to be a
closed nullable field.
                                                This instance does not
conform with the type definition.
                                                If text happens to be
null, as per current implementation,
                                                it is *required* to be
defined as null in the record.
        }.
);

insert into dataset foo({
        "id": int64("1"),
        "entities": {
                "text":null,   ====> This would work!
                "numbers": []}
                                    }
);

Original comment by zheilb...@gmail.com on 30 Jul 2013 at 12:56

GoogleCodeExporter commented 8 years ago

Original comment by dtab...@gmail.com on 30 Jul 2013 at 5:21

GoogleCodeExporter commented 8 years ago
It should not be necessary to put fields in with NULL values - leaving them out 
means the same thing - so this is still a valid bug, just not a blocking bug 
since there is a workaround of sorts.

Original comment by dtab...@gmail.com on 30 Jul 2013 at 5:28

GoogleCodeExporter commented 8 years ago
Hmm, okay... That was my thought at first as well: a nullable field need not be 
provided (in which case it will be implicitly given the value NULL).

Original comment by zheilb...@gmail.com on 30 Jul 2013 at 9:56

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 31 Jul 2013 at 10:25

GoogleCodeExporter commented 8 years ago

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

GoogleCodeExporter commented 8 years ago

Original comment by ildar.absalyamov on 12 Nov 2014 at 10:51

GoogleCodeExporter commented 8 years ago
Why is this invalid now? It seems like a valid issue from what is described here

Original comment by ima...@uci.edu on 12 Nov 2014 at 11:01

GoogleCodeExporter commented 8 years ago
I guess "Invalid" is not a proper name here, but we don't have 
"Non-reproducible" status

Original comment by ildar.absalyamov on 12 Nov 2014 at 11:20

GoogleCodeExporter commented 8 years ago
Interesting, I am not able to reproduce it either (on 0.8.6). I wonder what 
commit has fixed this? It looks like it was reproducible at one point

Original comment by ima...@uci.edu on 12 Nov 2014 at 11:55

GoogleCodeExporter commented 8 years ago
Future request:  Please don't change bugs statuses, particularly to things that 
mean "no future attention", without recording an explanation.  :-)

Interesting side note:  This bug is one point where the AQL religion is 
slightly different than the Couchbase N1QL religion and UCSD SQL++ religion.  
(They would have said "works as designed" to the original bug.)

Original comment by dtab...@gmail.com on 13 Nov 2014 at 6:03