Steven Jacobs | b557191 | 2015-02-03 10:19:29 -0800 | [diff] [blame] | 1 | /* |
Ian Maxon | 857dc13 | 2015-09-25 17:13:19 -0700 | [diff] [blame] | 2 | * 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 Jacobs | b557191 | 2015-02-03 10:19:29 -0800 | [diff] [blame] | 20 | * 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 | */ |
| 25 | drop dataverse twitter if exists; |
| 26 | create dataverse twitter; |
| 27 | use dataverse twitter; |
| 28 | |
| 29 | create type TweetMessageType as closed { |
| 30 | tweetid: int64, |
| 31 | sender-location: point, |
| 32 | text: string |
| 33 | } |
| 34 | |
| 35 | create type TweetHistorySubscription as open{ |
| 36 | subscription-id: int32, |
| 37 | location: point |
| 38 | } |
| 39 | |
| 40 | create dataset TweetHistorySubscriptions(TweetHistorySubscription) |
| 41 | primary key subscription-id; |
| 42 | create index testa on TweetHistorySubscriptions(location) type rtree; |
| 43 | |
| 44 | create dataset TweetMessages(TweetMessageType) |
| 45 | primary key tweetid; |
| 46 | create index locationIdx on TweetMessages(sender-location) type rtree; |
| 47 | |
Ian Maxon | f7b6453 | 2015-12-09 17:28:18 -0800 | [diff] [blame] | 48 | write output to asterix_nc1:"rttest/query-issue838.adm"; |
Steven Jacobs | b557191 | 2015-02-03 10:19:29 -0800 | [diff] [blame] | 49 | |
| 50 | for $sub in dataset TweetHistorySubscriptions |
| 51 | let $location := $sub.location |
| 52 | for $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 | ) |
| 58 | return { |
| 59 | "subscription-id":$sub.subscription-id, |
| 60 | "changeSet":1, |
| 61 | "execution-time":current-datetime(), |
| 62 | "message-text":$text |
Ian Maxon | 857dc13 | 2015-09-25 17:13:19 -0700 | [diff] [blame] | 63 | } |