shamim8888 / asterixdb

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

IntroduceJoinAccessMethodRule rule fails with ClassCastException #886

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
DDL:
drop dataverse emergencyTest if exists;
create dataverse emergencyTest;
use dataverse emergencyTest;

create type CHPReport as {
    "rid":uuid,
    "epicenter":point,
    "radius":double,
    "message":string,
    "timestamp":datetime
}

create type userLocation as {
    "id":uuid,
    "user-id":int64,
    "location":point,
    "timestamp":datetime
}

create type tornadoShelter as {
    "tsid":uuid,
    "location":point
}

create type sub as closed{
    "id":int,
    "param0":int64
}

create dataset NearbySheltersDuringTornadoDangerChannelSubscriptions(sub)
primary key id;

create dataset tornadoShelters(tornadoShelter)
primary key tsid autogenerated;

create dataset userLocations(userLocation)
primary key id autogenerated;

create dataset CHPReports(CHPReport)
primary key rid autogenerated;

create index times on CHPReports(timestamp);
create index times2 on userLocations(timestamp);
create index locs on tornadoShelters(location) type rtree;
create index locs2 on CHPReports(epicenter) type rtree;
create index locs3 on userLocations(location) type rtree;

for $sub in dataset NearbySheltersDuringTornadoDangerChannelSubscriptions
for $emergency in dataset CHPReports
let $dangerzone := create-circle($emergency.epicenter,$emergency.radius)
let $timewindow := day-time-duration("PT10M")
where $emergency.etype = "tornado"
where $emergency.timestamp >= current-datetime()-$timewindow
where (some $user in dataset userLocations satisfies
            $user.user-id = $sub.param0
            and $user.timestamp >= current-datetime() - $timewindow
            and spatial-intersect($dangerzone,$user.location))
return {
"id":$sub.param0,
"message":$emergency.message,
"shelter locations":for $shelter in dataset tornadoShelters return 
$shelter.location
};

Here is the plan just before the failure:
assign [$$58] <- [function-call: asterix:field-access-by-index, Args:[%0->$$1, 
AInt32: {3}]] -- |PARTITIONED|
  assign [$$57] <- [function-call: asterix:field-access-by-index, Args:[%0->$$0, AInt32: {1}]] -- |PARTITIONED|
    select (%0->$$29) -- |PARTITIONED|
      group by ([$$0 := %0->$$43; $$1 := %0->$$44; $$2 := %0->$$45; $$36 := %0->$$46; $$37 := %0->$$47; $$40 := %0->$$48; $$41 := %0->$$49]) decor ([]) {
                aggregate [$$29] <- [function-call: asterix:non-empty-stream, Args:[]] -- |LOCAL|
                  select (function-call: algebricks:not, Args:[function-call: algebricks:is-null, Args:[%0->$$42]]) -- |LOCAL|
                    nested tuple source -- |LOCAL|
             } -- |PARTITIONED|
        left outer join (function-call: algebricks:and, Args:[function-call: asterix:spatial-intersect, Args:[%0->$$45, %0->$$56], function-call: algebricks:eq, Args:[%0->$$50, %0->$$51]]) -- |PARTITIONED|
          join (function-call: algebricks:ge, Args:[%0->$$48, %0->$$49]) -- |PARTITIONED|
            assign [$$49, $$51] <- [ADateTime: { 2015-05-18T21:35:18.059Z }, function-call: asterix:field-access-by-index, Args:[%0->$$43, AInt32: {1}]] -- |PARTITIONED|
              data-scan []<-[$$46, $$43] <- emergencyTest:NearbySheltersDuringTornadoDangerChannelSubscriptions -- |PARTITIONED|
                empty-tuple-source -- |PARTITIONED|
            assign [$$45] <- [function-call: asterix:create-circle, Args:[%0->$$53, %0->$$54]] -- |PARTITIONED|
              select (function-call: algebricks:eq, Args:[%0->$$52, AString: {tornado}]) -- |PARTITIONED|
                assign [$$48, $$54, $$53, $$52] <- [function-call: asterix:field-access-by-index, Args:[%0->$$44, AInt32: {4}], function-call: asterix:field-access-by-index, Args:[%0->$$44, AInt32: {2}], function-call: asterix:field-access-by-index, Args:[%0->$$44, AInt32: {1}], function-call: asterix:field-access-by-name, Args:[%0->$$44, AString: {etype}]] -- |PARTITIONED|
                  data-scan []<-[$$47, $$44] <- emergencyTest:CHPReports -- |PARTITIONED|
                    empty-tuple-source -- |PARTITIONED|
          assign [$$42] <- [TRUE] -- |PARTITIONED|
            select (function-call: algebricks:ge, Args:[%0->$$55, ADateTime: { 2015-05-18T21:35:18.061Z }]) -- |PARTITIONED|
              assign [$$56, $$50, $$55] <- [function-call: asterix:field-access-by-index, Args:[%0->$$4, AInt32: {2}], function-call: asterix:field-access-by-index, Args:[%0->$$4, AInt32: {1}], function-call: asterix:field-access-by-index, Args:[%0->$$4, AInt32: {3}]] -- |PARTITIONED|
                unnest-map [$$38, $$4] <- function-call: asterix:index-search, Args:[AString: {userLocations}, AInt32: {0}, AString: {emergencyTest}, AString: {userLocations}, ABoolean: {false}, ABoolean: {false}, ABoolean: {false}, AInt32: {1}, %0->$$61, AInt32: {1}, %0->$$61, TRUE, TRUE, TRUE] -- |PARTITIONED|
                  order (ASC, %0->$$61)  -- |LOCAL|
                    unnest-map [$$60, $$61] <- function-call: asterix:index-search, Args:[AString: {times2}, AInt32: {0}, AString: {emergencyTest}, AString: {userLocations}, ABoolean: {false}, ABoolean: {false}, ABoolean: {false}, AInt32: {1}, %0->$$59, AInt32: {0}, TRUE, TRUE, FALSE] -- |PARTITIONED|
                      assign [$$59] <- [ADateTime: { 2015-05-18T21:35:18.061Z }] -- |PARTITIONED|
                        empty-tuple-source -- |PARTITIONED|

Here is the failure trace:
SEVERE: 
edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression 
cannot be cast to 
edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpr
ession
java.lang.ClassCastException: 
edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression 
cannot be cast to 
edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpr
ession
    at edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.getFieldNameFromSubTree(AbstractIntroduceAccessMethodRule.java:560)
    at edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.fillAllIndexExprs(AbstractIntroduceAccessMethodRule.java:448)
    at edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.fillSubTreeIndexExprs(AbstractIntroduceAccessMethodRule.java:105)
    at edu.uci.ics.asterix.optimizer.rules.am.IntroduceJoinAccessMethodRule.rewritePost(IntroduceJoinAccessMethodRule.java:126)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:122)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:96)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:96)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:96)

Original issue reported on code.google.com by sjaco...@ucr.edu on 18 May 2015 at 9:57

GoogleCodeExporter commented 8 years ago

Original comment by sjaco...@ucr.edu on 18 May 2015 at 9:59

GoogleCodeExporter commented 8 years ago

Original comment by sjaco...@ucr.edu on 18 May 2015 at 10:40