br1ghtyang / asterixdb

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

[Severity-BetaBlocker] Insert fails using a list of nested records #433

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Trying to use insert where the body is iterating through a list of adm records 
fails. Please check DDL statements & Query below. You can also find the 
Exception stack trace below that as well.

**NOTE**: If we put just *one* adm record in the list, then it works 
successfully. The problem happens when the list size exceeds 1.

create dataverse insertIssue;
use dataverse insertIssue;

create type subElem as closed {
n: string,
e: int32?
}

create type elem as closed {
id: int32,
name: string,
sub: [subElem]
}

create dataset myDataset(elem)
primary key id;

insert into dataset myDataset (
for $t in [ {"id":1, "name":"u1","sub":[{"n":"se1","e":100}]}, {"id":2, 
"name":"u2","sub":[{"n":"se2","e":200}]} ]
return $t
);

//-------------
Exception stack trace:

Caused by: java.lang.ClassCastException: 
edu.uci.ics.asterix.om.types.BuiltinType$24 cannot be cast to 
edu.uci.ics.asterix.om.types.ARecordType
    at edu.uci.ics.asterix.optimizer.rules.IntroduceDynamicTypeCastRule.rewritePost(IntroduceDynamicTypeCastRule.java:112)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:122)
    at edu.uci.ics.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:49)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:79)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:66)
    at edu.uci.ics.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:81)
    at edu.uci.ics.asterix.api.common.APIFramework.compileQuery(APIFramework.java:281)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.rewriteCompileQuery(AqlTranslator.java:1323)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.handleInsertStatement(AqlTranslator.java:1259)

Original issue reported on code.google.com by pouria.p...@gmail.com on 9 May 2013 at 1:11

GoogleCodeExporter commented 8 years ago
Another Note:
If we do NOT use the nesting type, i.e. using flat adm records; again insert 
works successfully. The problem MIGHT be related to using nested type.

Original comment by pouria.p...@gmail.com on 9 May 2013 at 1:13

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 9 May 2013 at 3:01

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 9 May 2013 at 5:41

GoogleCodeExporter commented 8 years ago

Original comment by buyingyi@gmail.com on 10 May 2013 at 7:04