ilovesoup / asterixdb

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

Rewrite rule fails on getNonNullableType #876

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following query fails during rewrite:
drop dataverse emergencyTest if exists;
create dataverse emergencyTest;
use dataverse emergencyTest;

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

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

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

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 reportTimes on CHPReports(timestamp);
create index userTimes on userLocations(timestamp);
create index shelterloc on tornadoShelters(location) type rtree;

create function NearbySheltersDuringTornadoDanger($userid) {
for $emergency in dataset CHPReports
let $dangerzone := create-circle($emergency.epicenter,$emergency.radius)
let $timewindow := day-time-duration("PT1M")
where (some $user in dataset userLocations satisfies
      $user.user-id = $userid
)
return {
"shelter locations":for $shelter in dataset tornadoShelters where 
spatial-intersect( $dangerzone,$shelter.location) return $shelter.location}
};

create type sub as closed{
  "id":int,
  "param0":int64
}
create dataset NearbySheltersDuringTornadoDangerChannelSubscriptions(sub)
primary key id;

create type result as open{
  "id": uuid
}
create dataset NearbySheltersDuringTornadoDangerChannelResults(result)
primary key id autogenerated;

insert into dataset NearbySheltersDuringTornadoDangerChannelResults  ( 
for $sub in dataset NearbySheltersDuringTornadoDangerChannelSubscriptions
 for $result in NearbySheltersDuringTornadoDanger($sub.param0)
return {
"result":$result});

Here is the error:
SEVERE: null
java.lang.NullPointerException
    at edu.uci.ics.asterix.metadata.entities.Index.getNonNullableType(Index.java:133)
    at edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.isMatched(AbstractIntroduceAccessMethodRule.java:313)
    at edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.pruneIndexCandidates(AbstractIntroduceAccessMethodRule.java:259)
    at edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.pruneIndexCandidates(AbstractIntroduceAccessMethodRule.java:116)
    at edu.uci.ics.asterix.optimizer.rules.am.IntroduceJoinAccessMethodRule.rewritePost(IntroduceJoinAccessMethodRule.java:131)
    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:108)
    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)
    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)
    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.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController.rewriteWithRuleCollection(SequentialFixpointRuleController.java:49)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.runOptimizationSets(HeuristicOptimizer.java:91)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.optimize(HeuristicOptimizer.java:78)

Original issue reported on code.google.com by sjaco...@ucr.edu on 28 Apr 2015 at 9:27