Move BAD from AQL to SQL++
Change-Id: I563bf7b91b280eb65fbbbca0e95e8968f05ea591
diff --git a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-create.aql b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-create.sqlpp
similarity index 73%
rename from asterix-bad/src/test/resources/optimizerts/queries/channel/channel-create.aql
rename to asterix-bad/src/test/resources/optimizerts/queries/channel/channel-create.sqlpp
index a5d4167..24d73e2 100644
--- a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-create.aql
+++ b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-create.sqlpp
@@ -24,15 +24,14 @@
drop dataverse channels if exists;
create dataverse channels;
-use dataverse channels;
-
+use channels;
create type TweetMessageTypeuuid as closed {
tweetid: uuid,
- sender-location: point,
- send-time: datetime,
- referred-topics: {{ string }},
- message-text: string,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
countA: int32,
countB: int32
}
@@ -41,14 +40,13 @@
create dataset TweetMessageuuids(TweetMessageTypeuuid)
primary key tweetid autogenerated;
-create function NearbyTweetsContainingText($location, $text) {
- for $tweet in dataset TweetMessageuuids
- let $circle := create-circle($location,30.0)
- where contains($tweet.message-text,$text)
- and spatial-intersect($tweet.sender-location, $location)
- return $tweet.message-text
+create function NearbyTweetsContainingText(place, text) {
+ (select m.message_text
+ from TweetMessageuuids m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
};
-write output to nc1:"rttest/channel-create.adm";
+write output to nc1:"rttest/channel-create.sqlpp";
-create repetitive channel nearbyTweetChannel using NearbyTweetsContainingText@2 period duration("PT10M");
\ No newline at end of file
+create repetitive channel nearbyTweetChannel using NearbyTweetsContainingText@2 period duration("PT10M");
diff --git a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-subscribe.aql b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-subscribe.sqlpp
similarity index 74%
rename from asterix-bad/src/test/resources/optimizerts/queries/channel/channel-subscribe.aql
rename to asterix-bad/src/test/resources/optimizerts/queries/channel/channel-subscribe.sqlpp
index cbccbde..4a5cbbc 100644
--- a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-subscribe.aql
+++ b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-subscribe.sqlpp
@@ -24,15 +24,14 @@
drop dataverse channels2 if exists;
create dataverse channels2;
-use dataverse channels2;
-
+use channels2;
create type TweetMessageTypeuuid as closed {
tweetid: uuid,
- sender-location: point,
- send-time: datetime,
- referred-topics: {{ string }},
- message-text: string,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
countA: int32,
countB: int32
}
@@ -41,18 +40,17 @@
create dataset TweetMessageuuids(TweetMessageTypeuuid)
primary key tweetid autogenerated;
-create function NearbyTweetsContainingText($location, $text) {
- for $tweet in dataset TweetMessageuuids
- let $circle := create-circle($location,30.0)
- where contains($tweet.message-text,$text)
- and spatial-intersect($tweet.sender-location, $location)
- return $tweet.message-text
+create function NearbyTweetsContainingText(place, text) {
+ (select m.message_text
+ from TweetMessageuuids m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
};
create repetitive channel nearbyTweetChannel using NearbyTweetsContainingText@2 period duration("PT10M");
-write output to nc1:"rttest/channel-subscribe.adm";
+write output to nc1:"rttest/channel-subscribe.sqlpp";
create broker brokerA at "http://www.hello.com";
-subscribe to nearbyTweetChannel (point("30.0, 30.0"), "Live") on brokerA;
\ No newline at end of file
+subscribe to nearbyTweetChannel (point("30.0, 30.0"), "Live") on brokerA;
diff --git a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-unsubscribe.aql b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-unsubscribe.sqlpp
similarity index 74%
rename from asterix-bad/src/test/resources/optimizerts/queries/channel/channel-unsubscribe.aql
rename to asterix-bad/src/test/resources/optimizerts/queries/channel/channel-unsubscribe.sqlpp
index 039b554..508eaa2 100644
--- a/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-unsubscribe.aql
+++ b/asterix-bad/src/test/resources/optimizerts/queries/channel/channel-unsubscribe.sqlpp
@@ -24,15 +24,14 @@
drop dataverse channels3 if exists;
create dataverse channels3;
-use dataverse channels3;
-
+use channels3;
create type TweetMessageTypeuuid as closed {
tweetid: uuid,
- sender-location: point,
- send-time: datetime,
- referred-topics: {{ string }},
- message-text: string,
+ sender_location: point,
+ send_time: datetime,
+ referred_topics: {{ string }},
+ message_text: string,
countA: int32,
countB: int32
}
@@ -41,16 +40,15 @@
create dataset TweetMessageuuids(TweetMessageTypeuuid)
primary key tweetid autogenerated;
-create function NearbyTweetsContainingText($location, $text) {
- for $tweet in dataset TweetMessageuuids
- let $circle := create-circle($location,30.0)
- where contains($tweet.message-text,$text)
- and spatial-intersect($tweet.sender-location, $location)
- return $tweet.message-text
+create function NearbyTweetsContainingText(place, text) {
+ (select m.message_text
+ from TweetMessageuuids m
+ where contains(m.message_text,text)
+ and spatial_intersect(m.sender_location, place))
};
create repetitive channel nearbyTweetChannel using NearbyTweetsContainingText@2 period duration("PT10M");
-write output to nc1:"rttest/channel-unsubscribe.adm";
+write output to nc1:"rttest/channel-unsubscribe.sqlpp";
-unsubscribe "c45ef6d0-c5ae-4b9e-b5da-cf1932718296" from nearbyTweetChannel;
\ No newline at end of file
+unsubscribe "c45ef6d0-c5ae-4b9e-b5da-cf1932718296" from nearbyTweetChannel;