Young-Seok | be353dd | 2014-05-22 20:30:45 -0700 | [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 | /* |
Young-Seok | be353dd | 2014-05-22 20:30:45 -0700 | [diff] [blame] | 20 | * Description : Test that left-outer-join may use an available rtree index in index subtree. |
| 21 | * Issue : 730 |
| 22 | * Expected Res : Success |
| 23 | * Date : 8th May 2014 |
| 24 | */ |
| 25 | |
| 26 | drop dataverse test if exists; |
| 27 | create dataverse test; |
| 28 | use dataverse test; |
| 29 | |
| 30 | create type TwitterUserType as { |
| 31 | screen_name: string, |
| 32 | lang: string, |
| 33 | friends_count: int32, |
| 34 | statuses_count: int32, |
| 35 | name: string, |
| 36 | followers_count: int32 |
| 37 | } |
| 38 | |
| 39 | create type TweetMessageType as { |
| 40 | tweetid: int64, |
| 41 | user: TwitterUserType, |
| 42 | sender_location: point?, |
| 43 | send_time: datetime, |
| 44 | referred_topics: {{ string }}, |
| 45 | message_text: string |
| 46 | } |
| 47 | |
| 48 | create dataset TweetMessages(TweetMessageType) primary key tweetid; |
| 49 | |
| 50 | create index twmSndLocIx on TweetMessages(sender_location) type rtree; |
| 51 | |
| 52 | write output to nc1:"rttest/rtree-index-join_issue730.adm"; |
| 53 | |
| 54 | for $t1 in dataset('TweetMessages') |
| 55 | where $t1.send_time >= datetime('2011-06-18T14:10:17') and $t1.send_time < datetime('2011-06-18T15:10:17') |
| 56 | let $n := create-circle($t1.sender_location, 5.0) |
| 57 | return { |
| 58 | "message": $t1.tweetid, |
| 59 | "nearby-message": for $t2 in dataset('TweetMessages') |
| 60 | where spatial-intersect($t2.sender_location, $n) |
| 61 | return $t2.tweetid |
Ian Maxon | 857dc13 | 2015-09-25 17:13:19 -0700 | [diff] [blame^] | 62 | } |