namhnguyen / asterixdb

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

Spatial Index (RTree) not used in spatial selection #729

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Spatial selection (using spatial-intersect() ) does not use RTree with spatial 
objects, other than rectangle.

(1) Here is DDL:
create type TwitterUserType {
screen_name: string,
lang: string,
friends_count: int32,
statuses_count: int32,
name: string,
followers_count: int32
}

create type TweetMessageType {
tweetid: int64,     
user: TwitterUserType,
sender_location: point?,
send_time: datetime,
referred_topics: {{ string }},
message_text: string
}

create dataset TweetMessages(TweetMessageType) primary key tweetid;

create index twmSndLocIx on TweetMessages(sender_location) type rtree;

(2) Following query does not use RTree:

let $r :=  create-circle(create-point(30.0,70.0), 5.0)

for $t in dataset('TweetMessages')
where 
spatial-intersect($t.sender_location, $r)
return {
"name": $t.user.screen_name,   
"tweet": $t.message_text
}

But if $r is replaced with a rectangle (instead of circle), query uses RTree.

Original issue reported on code.google.com by pouria.p...@gmail.com on 14 Mar 2014 at 7:23

GoogleCodeExporter commented 9 years ago
Are you sure?
I just tried it and I saw the R-tree is being used.

Original comment by salsuba...@gmail.com on 14 Mar 2014 at 8:01

GoogleCodeExporter commented 9 years ago
Right !
It is working ...

Original comment by pouria.p...@gmail.com on 14 Mar 2014 at 8:32