blob: 8cb4c6fc4053c440eec702c317cfa5f7f66c42cb [file] [log] [blame]
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* Description : Check an advanced channel for index usage
* Expected Res : Success
* Date : Oct 2017
drop dataverse channels5 if exists;
create dataverse channels5;
use channels5;
create type UserLocation as closed {
recordId: uuid,
location: circle,
userName: string,
timeStamp: datetime
create type EmergencyReport as closed {
reportId: uuid,
Etype: string,
location: circle,
timeStamp: datetime
create type EmergencyShelter as closed {
shelterName: string,
location: circle
create dataset UserLocations(UserLocation)
primary key recordId autogenerated;
create dataset EmergencyReports(EmergencyReport)
primary key reportId autogenerated;
create index locTimes on UserLocations(timeStamp);
create index repTimes on EmergencyReports(timeStamp);
create function RecentEmergenciesNearUser(userName) {
SELECT r AS report
(select value r from EmergencyReports r where r.timeStamp > current_datetime() - day_time_duration("PT10S")) r,
(select value r from UserLocations l where l.timeStamp > current_datetime() - day_time_duration("PT10S")) l
where l.userName = userName
and spatial_intersect(r.location,l.location)
write output to nc1:"rttest/channel-advanced.sqlpp";
set `compiler.indexonly` "false";
create repetitive channel EmergencyChannel using RecentEmergenciesNearUser@1 period duration("PT10S");