[ASTERIXDB-1972] Coordinated Change

Change-Id: I191af547f3142fe5446ead4a2d053ea71e3f1d97
diff --git a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced-index-only.sqlpp b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced-index-only.sqlpp
new file mode 100644
index 0000000..dd73769
--- /dev/null
+++ b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced-index-only.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * 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
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 channels6 if exists;
+create dataverse channels6;
+use channels6;
+
+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
+  FROM
+  (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";
+
+create repetitive channel EmergencyChannel using RecentEmergenciesNearUser@1 period duration("PT10S");
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced.sqlpp b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced.sqlpp
index 53399e1..8ebe8c6 100644
--- a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced.sqlpp
+++ b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-advanced.sqlpp
@@ -66,5 +66,6 @@
 };
 
 write output to nc1:"rttest/channel-advanced.sqlpp";
+set noindexonly 'true';
 
 create repetitive channel EmergencyChannel using RecentEmergenciesNearUser@1 period duration("PT10S");
\ No newline at end of file