ilovesoup / asterixdb

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

spatial-intersect join fails based on the ordering of arguments #832

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
DDL:
drop dataverse channels if exists;
create dataverse channels;
use dataverse channels;

create type TweetMessageType as closed {
  tweetid: int64,
  sender-location: point
}

create type TweetHistorySubscription as open{
  subscription-id: int32,
  location: point
}

create dataset TweetHistorySubscriptions(TweetHistorySubscription)
primary key subscription-id;
create index testa on TweetHistorySubscriptions(location) type rtree;

create dataset TweetMessages(TweetMessageType)
primary key tweetid;
create index locationIdx on TweetMessages(sender-location) type rtree;

//THIS ONE USES RTREE CORRECTLY
for $tweet in dataset TweetMessages
for $sub in dataset TweetHistorySubscriptions
where spatial-intersect($sub.location, $tweet.sender-location)
return $tweet.message-text 

//THIS ONE SAYS COULD NOT FIND FIELD SENDER-LOCATION IN THE SCHEMA
for $tweet in dataset TweetMessages
for $sub in dataset TweetHistorySubscriptions
where spatial-intersect($tweet.sender-location, $sub.location)
return $tweet.message-text 

//THIS ONE USES RTREE CORRECTLY
for $tweet in dataset TweetMessages
for $sub in dataset TweetHistorySubscriptions
let $circle := create-circle($sub.location,30.0)
where spatial-intersect($tweet.sender-location, $circle)
return $tweet.message-text 

//THIS ONE SAYS COULD NOT FIND FIELD NULL IN THE SCHEMA
for $tweet in dataset TweetMessages
for $sub in dataset TweetHistorySubscriptions
let $circle := create-circle($sub.location,30.0)
where spatial-intersect($circle, $tweet.sender-location)
return $tweet.message-text 

STACK_TRACE:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: Could not 
find field sender-location in the schema.
    at edu.uci.ics.asterix.metadata.entities.Index.keyFieldType(Index.java:137)
    at edu.uci.ics.asterix.metadata.entities.Index.getNonNullableKeyFieldType(Index.java:116)
    at edu.uci.ics.asterix.optimizer.rules.am.RTreeAccessMethod.createSecondaryToPrimaryPlan(RTreeAccessMethod.java:171)
    at edu.uci.ics.asterix.optimizer.rules.am.RTreeAccessMethod.applyJoinPlanTransformation(RTreeAccessMethod.java:140)
    at edu.uci.ics.asterix.optimizer.rules.am.IntroduceJoinAccessMethodRule.rewritePost(IntroduceJoinAccessMethodRule.java:150)
    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.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)
    at edu.uci.ics.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder$1$1.optimize(HeuristicCompilerFactoryBuilder.java:83)
    at edu.uci.ics.asterix.api.common.APIFramework.compileQuery(APIFramework.java:308)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.rewriteCompileQuery(AqlTranslator.java:1722)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.handleQuery(AqlTranslator.java:2034)
    at edu.uci.ics.asterix.aql.translator.AqlTranslator.compileAndExecute(AqlTranslator.java:315)

Original issue reported on code.google.com by sjaco...@ucr.edu on 4 Dec 2014 at 11:04

GoogleCodeExporter commented 9 years ago

Original comment by sjaco...@ucr.edu on 9 Dec 2014 at 10:31

GoogleCodeExporter commented 9 years ago

Original comment by sjaco...@ucr.edu on 16 Dec 2014 at 6:32