blob: 24e4adf5063221470a7b1343e6ee8950e781f210 [file] [log] [blame]
Steven Jacobsb5571912015-02-03 10:19:29 -08001/*
2 * Description : This test case is to verify the fix for issue838
3 * https://code.google.com/p/asterixdb/issues/detail?id=838
4 * Expected Res : SUCCESS
5 * Date : 18 Dec. 2014
6 */
7drop dataverse twitter if exists;
8create dataverse twitter;
9use dataverse twitter;
10
11create type TweetMessageType as closed {
12 tweetid: int64,
13 sender-location: point,
14 text: string
15}
16
17create type TweetHistorySubscription as open{
18 subscription-id: int32,
19 location: point
20}
21
22create dataset TweetHistorySubscriptions(TweetHistorySubscription)
23primary key subscription-id;
24create index testa on TweetHistorySubscriptions(location) type rtree;
25
26create dataset TweetMessages(TweetMessageType)
27primary key tweetid;
28create index locationIdx on TweetMessages(sender-location) type rtree;
29
30write output to nc1:"rttest/query-issue838.adm";
31
32for $sub in dataset TweetHistorySubscriptions
33let $location := $sub.location
34for $text in (
35 for $tweet in dataset TweetMessages
36 let $circle := create-circle($location,30.0)
37 where spatial-intersect($tweet.sender-location, $circle)
38 return $tweet
39)
40return {
41 "subscription-id":$sub.subscription-id,
42 "changeSet":1,
43 "execution-time":current-datetime(),
44 "message-text":$text
45}