lwhay / asterixdb

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

Rewrite rule fails on visitAssignOperator #877

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 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 function NearbySheltersDuringTornadoDanger($userid) {
for $emergency in dataset CHPReports
let $dangerzone := create-circle($emergency.epicenter,$emergency.radius)
where (some $user in dataset userLocations satisfies
            $user.user-id = $userid
            and spatial-intersect($dangerzone,$user.location))
return {
"shelter locations":"for $shelter in dataset tornadoShelters  return 
$shelter.location"}
};

for $sub in dataset NearbySheltersDuringTornadoDangerChannelSubscriptions
for $result in NearbySheltersDuringTornadoDanger(int("5"))
return {
    "result":$result
};

Here is the error:
SEVERE: null
java.lang.NullPointerException
    at edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.SubstituteVariableVisitor.visitAssignOperator(SubstituteVariableVisitor.java:101)
    at edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.SubstituteVariableVisitor.visitAssignOperator(SubstituteVariableVisitor.java:1)
    at edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator.accept(AssignOperator.java:60)
    at edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities.substituteVariables(VariableUtilities.java:86)
    at edu.uci.ics.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil.substituteVarRec(OperatorManipulationUtil.java:153)
    at edu.uci.ics.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil.substituteVarRec(OperatorManipulationUtil.java:155)
    at edu.uci.ics.asterix.optimizer.rules.PushGroupByThroughProduct.push(PushGroupByThroughProduct.java:118)
    at edu.uci.ics.asterix.optimizer.rules.PushGroupByThroughProduct.rewritePost(PushGroupByThroughProduct.java:94)
    at edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.rewriteOperatorRef(AbstractRuleController.java:122)

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