blob: c152f0d6af97f13945324220e60f63faa20daa9a [file] [log] [blame]
Steven Jacobsb5571912015-02-03 10:19:29 -08001/*
Ian Maxon857dc132015-09-25 17:13:19 -07002 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19/*
Steven Jacobsb5571912015-02-03 10:19:29 -080020 * Description : This test case is to verify the fix for issue838
21 * https://code.google.com/p/asterixdb/issues/detail?id=838
22 * Expected Res : SUCCESS
23 * Date : 18 Dec. 2014
24 */
25drop dataverse twitter if exists;
26create dataverse twitter;
27use dataverse twitter;
28
29create type TweetMessageType as closed {
30 tweetid: int64,
31 sender-location: point,
32 text: string
33}
34
35create type TweetHistorySubscription as open{
36 subscription-id: int32,
37 location: point
38}
39
40create dataset TweetHistorySubscriptions(TweetHistorySubscription)
41primary key subscription-id;
42create index testa on TweetHistorySubscriptions(location) type rtree;
43
44create dataset TweetMessages(TweetMessageType)
45primary key tweetid;
46create index locationIdx on TweetMessages(sender-location) type rtree;
47
Ian Maxonf7b64532015-12-09 17:28:18 -080048write output to asterix_nc1:"rttest/query-issue838.adm";
Steven Jacobsb5571912015-02-03 10:19:29 -080049
50for $sub in dataset TweetHistorySubscriptions
51let $location := $sub.location
52for $text in (
53 for $tweet in dataset TweetMessages
54 let $circle := create-circle($location,30.0)
55 where spatial-intersect($tweet.sender-location, $circle)
56 return $tweet
57)
58return {
59 "subscription-id":$sub.subscription-id,
60 "changeSet":1,
61 "execution-time":current-datetime(),
62 "message-text":$text
Ian Maxon857dc132015-09-25 17:13:19 -070063}