Browse Source

Merge pull request #10243 from rpastrana/HPCC-17930couchbase-simple

HPCC-17930 Provide couchbase plugin sample queries

Reviewed-By: Dan Camper <dan.camper@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 years ago
parent
commit
f23e47fec7

+ 234 - 0
initfiles/examples/embed/couchbase-simple.ecl

@@ -0,0 +1,234 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2017 HPCC Systems®.
+
+    Licensed 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.
+############################################################################## */
+
+IMPORT couchbase;
+
+/******************************************************************************************
+   This set of example queries are based on the couchbase sample bucket 'travel-sample'
+   The sample data is easily set-up, please refer to the couchbase documentation for set-up
+*******************************************************************************************/
+
+server := '127.0.0.1';            //change this to point to your couchbase
+thebucket := 'travel-sample';
+
+namerec := RECORD
+  string name;
+END;
+
+typerec := RECORD
+  string type;
+END;
+
+travelrec := RECORD
+  string callsign;
+  string country;
+  string iata;
+  string icao;
+  integer id;
+  string name;
+  string type;
+END;
+
+georec := RECORD
+  integer alt;
+  real lat;
+  real lon;
+END;
+
+airportrec := RECORD
+  string airportname;
+  string city;
+  string country;
+  string faa;
+  string  tz;
+  string type;
+  integer id;
+  string icao;
+  georec geo;
+END;
+
+/*
+ --Sample Airport record--
+ "airportname": "Calais Dunkerque",
+    "city": "Calais",
+    "country": "France",
+    "faa": "CQF",
+    "geo": {
+      "alt": 12,
+      "lat": 50.962097,
+      "lon": 1.954764
+    },
+    "icao": "LFAC",
+    "id": 1254,
+    "type": "airport",
+    "tz": "Europe/Paris"
+*/
+/*
+  --sample airline record--
+  "callsign": null,
+  "country": "United States",
+  "iata": "WQ",
+  "icao": "PQW",
+  "id": 13633,
+  "name": "PanAm World Airways",
+  "type": "airline"
+*/
+schedrec := RECORD
+  unsigned day;
+  string flight;
+  string utc;
+END;
+
+routerec := RECORD
+  string airline;
+  string airlineid;
+  string3 destinationairport;
+  real distance;
+  string equipment;
+  integer id;
+  dataset(schedrec) schedule {xpath('schedule')};
+  string3 sourceairport;
+  unsigned stops;
+  string type;
+END;
+/*
+  "travel-sample": {
+  "airline": "AH",
+  "airlineid": "airline_794",
+  "destinationairport": "CDG",
+  "distance": 1420.6731433915318,
+  "equipment": "738",
+  "id": 10041,
+  "schedule": [
+      {
+       "day": 0,
+       "flight": "AH547",
+       "utc": "07:58:00"
+      },
+      {
+       "day": 0,
+       "flight": "AH428",
+       "utc": "12:08:00"
+      },
+      {
+       "day": 1,
+       "flight": "AH444",
+       "utc": "14:16:00"
+      },
+      {
+       "day": 3,
+       "flight": "AH741",
+       "utc": "04:56:00"
+      },
+      {
+       "day": 4,
+       "flight": "AH027",
+       "utc": "03:16:00"
+      },
+      {
+       "day": 4,
+       "flight": "AH113",
+       "utc": "08:11:00"
+      },
+      {
+       "day": 6,
+       "flight": "AH260",
+       "utc": "18:02:00"
+      },
+      {
+       "day": 6,
+       "flight": "AH873",
+       "utc": "03:58:00"
+      }
+     ],
+     "sourceairport": "AAE",
+     "stops": 0,
+     "type": "route"
+    }
+    */
+
+/* Due to inconsistencies found in couchbase travel-sample, some queries explicitly omit records of type landmark and hotel */
+
+integer countAllRecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT count(*) from `travel-sample` as mybucketalias where mybucketalias.type != 'landmark' and mybucketalias.type != 'hotel';
+ENDEMBED;
+
+integer countTypes() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT COUNT(DISTINCT mybucketalias.type) from `travel-sample` as mybucketalias where mybucketalias.type != 'landmark' and mybucketalias.type != 'hotel';
+ENDEMBED;
+
+dataset(typerec) allTypes() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT DISTINCT mybucketalias.type from `travel-sample` as mybucketalias where mybucketalias.type IS NOT NULL and mybucketalias.type != 'landmark' and mybucketalias.type != 'hotel';
+ENDEMBED;
+
+dataset(travelrec) fulltravelrecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where callsign = 'MILE-AIR' limit 10;
+ENDEMBED;
+
+dataset(namerec) airlinenames() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.name from `travel-sample` as mybucketalias where mybucketalias.type = 'airline' limit 10;
+ENDEMBED;
+
+dataset(airportrec) airportrecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' limit 10;
+ENDEMBED;
+
+dataset(airportrec) usairportrecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and country = 'United States' limit 10;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbycountry(string m) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and country = $m limit 10;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbyid(integer id) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and id = $id limit 10;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbyaltitude(integer alt) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and geo.alt >= $alt limit 10;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbycoordinates(row(georec) values) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and geo.lat = $lat and geo.lon = $lon limit 10;
+ENDEMBED;
+
+dataset(routerec) fullroute()  := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT mybucketalias.* FROM `travel-sample` as mybucketalias WHERE type = 'route' and sourceairport IS NOT NULL LIMIT 10
+ENDEMBED;
+
+dataset(routerec) routeschedule(string sair, string dair)  := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT mybucketalias.schedule  FROM `travel-sample` as mybucketalias WHERE type = 'route' and sourceairport = $sair and destinationairport = $dair  LIMIT 1
+ENDEMBED;
+
+sequential
+(
+  OUTPUT(countAllRecords(), NAMED('CountOfAllRecs'));
+  OUTPUT(countTypes(), NAMED('CountOfAllRecTypes'));
+  OUTPUT(allTypes(), NAMED('AllRecordTypes'));
+  OUTPUT(airlinenames(), NAMED('AirlineNames'));
+  OUTPUT(usairportrecords(), NAMED('USAirports'));
+  OUTPUT(airportrecordsbycountry('"France"'), NAMED('AirportsByCountry'));
+  OUTPUT(fulltravelrecords(), NAMED('FullTravelRec'));
+  OUTPUT(airportrecordsbyid(3411), NAMED('AirportByID'));
+  OUTPUT(airportrecordsbyaltitude(4000), NAMED('AirportsAtAltitude'));
+  OUTPUT(airportrecordsbycoordinates(ROW({0,31.3426028, -109.5064544},georec)), NAMED('AirportAtCoordinate'));
+  OUTPUT(fullroute(), NAMED('FullRouteRec'));
+  OUTPUT(routeschedule('"AAE"', '"CDG"'),  NAMED('RouteAAEtoCDG'));
+  OUTPUT('Done', NAMED('Status'));
+);
+

+ 140 - 0
initfiles/examples/embed/couchbase-simple2.ecl

@@ -0,0 +1,140 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2017 HPCC Systems®.
+
+    Licensed 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.
+############################################################################## */
+
+//class=embedded
+//class=3rdparty
+
+IMPORT couchbase;
+IMPORT STD;
+
+/***********************************************************************************************
+   This set of example queries are based on a device oriented document structure described below
+   These samples queries rely on a bucket named 'iot'. In order to run these queries, please
+      create the iot bucket on the target couchbase server
+************************************************************************************************/
+
+server := '127.0.0.1';
+thebucket := 'iot';
+
+string adocid := '"mydocid' ;
+string adoc1  := '{"deviceID": "9cf9r-3c0f-446b-ad6a-4136deb88519" ,"deviceType": "handheld","message":{"locationData":{"x": 52.227,"y": 77.699,"z": 99.999, "zoneId": "W"}, "rawdata":{"ambientTemp": 68.21, "barometer": 14.81, "batteryLevelPercentage": 95.32, "bodyTemp": 30.08, "coLevel": 1.46, "forceSensitiveResistance": 136, "heartRate": 94}, "deviceTimestamp": "2017-06-05 15:04:35.924657-0400"}, "receivedTimestamp": "' + STD.System.Debug.msTick ( ) + '"}';
+string adoc2 := '{"deviceID":  "1135c-3c0f-776b-ag6a-7136deb83464" ,"deviceType": "wearable","message":{"locationData":{"x": 2.247,"y": 33.629,"z": 1.323,   "zoneId": "A"}, "rawdata":{"ambientTemp": 8.65,  "barometer": 34.56, "batteryLevelPercentage": 32.09, "bodyTemp": 29.68, "coLevel": 1.34, "forceSensitiveResistance": 6,   "heartRate": 56}, "deviceTimestamp": "2017-06-05 15:05:27.325365-0400"}, "receivedTimestamp": "' + STD.System.Debug.msTick ( ) + '"}';
+
+/*
+Document structure:
+{
+    "deviceID": "9cf9r-3c0f-446b-ad6a-4136deb88519",
+    "deviceType": "handheld",
+    "message":
+    {
+        "locationData": {
+            "x": 52.227,
+            "y": 77.699,
+            "z": 99.999,
+            "zoneId": "W"
+        },
+        "rawdata": {
+            "ambientTemp": 38.21,
+            "barometer": 14.81,
+            "batteryLevelPercentage": 95.32,
+            "bodyTemp": 30.08,
+            "coLevel": 1.46,
+            "forceSensitiveResistance": 166,
+            "heartRate": 94
+        },
+        "deviceTimestamp": "2017-06-05 15:04:35.924657-0400"
+    },
+    "receivedTimestamp": "1496275475926453"
+}
+*/
+
+deviceidrec := RECORD
+  string deviceID;
+END;
+
+rawdatarec := RECORD
+  real4 ambientTemp;
+  real4 barometer;
+  real4 batteryLevelPercentage;
+  real4 bodyTemp;
+  real4 coLevel;
+  real4 forceSensitiveResistance;
+  INTEGER heartRate;
+END;
+
+locationDatarec := RECORD
+  real x {xpath('x')};
+  real y {xpath('y')};
+  real z {xpath('z')};
+  string zoneId {xpath('zoneId')};
+END;
+
+messagerec := RECORD
+  string deviceTimestamp;
+  locationDatarec locationData;
+  rawdatarec rawdata;
+END;
+
+iotrec := RECORD
+  string deviceID;
+  string deviceType;
+  string receivedTimestamp;
+  messagerec message;
+END;
+
+BOOLEAN insertiotdoc(string docid, string doc) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1))
+  INSERT INTO iot (KEY, VALUE) VALUES ($docid, $doc) RETURNING TRUE AS c;
+ENDEMBED;
+
+BOOLEAN upsertiotdoc(string docid, string doc) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1))
+  INSERT INTO iot (KEY, VALUE) VALUES ($docid, $doc) RETURNING TRUE AS c;
+ENDEMBED;
+
+STRING getlatesttimestamp() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1))
+  SELECT max(iot.receivedTimestamp) FROM iot;
+ENDEMBED;
+
+dataset(iotrec) getlatestdoc(string devid) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1))
+  SELECT iot.* FROM iot where iot.deviceID = $devid;
+ENDEMBED;
+
+integer devicecount() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1))
+  SELECT count(DISTINCT iot.deviceID) FROM iot ;
+ENDEMBED;
+
+dataset(iotrec) devicebylocation(row(locationDatarec) values) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select iot.* from iot where iot.message.locationData.x = $x and iot.message.locationData.y = $y limit 1;
+ENDEMBED;
+
+dataset(deviceidrec) deviceidsbyzone(string zone) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select DISTINCT iot.deviceID from iot where iot.message.locationData.zoneId = $zone;
+ENDEMBED;
+
+sequential
+(
+  OUTPUT(insertiotdoc(adocid + random() + '"', adoc1));
+  Std.System.Debug.Sleep(200);
+  OUTPUT(insertiotdoc(adocid + random() + '"', adoc2));
+  OUTPUT(upsertiotdoc(adocid + random() + '"', adoc1));
+  Std.System.Debug.Sleep(200);
+  OUTPUT(getlatesttimestamp());
+  OUTPUT(getlatestdoc('"11135e49c-3c0f-446b-ad6a-4136deb88519"'));
+  OUTPUT(devicecount());
+  OUTPUT(devicebylocation(ROW({2.247,33.629,1.323,'"A"'},locationDatarec)));
+  OUTPUT(deviceidsbyzone('"A"'));
+  OUTPUT('Done');
+);

+ 237 - 0
testing/regress/ecl/couchbase-simple.ecl

@@ -0,0 +1,237 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2017 HPCC Systems®.
+
+    Licensed 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.
+############################################################################## */
+
+//class=embedded
+//class=3rdparty
+
+IMPORT couchbase;
+
+/******************************************************************************************
+   This set of example queries are based on the couchbase sample bucket 'travel-sample'
+   The sample data is easily set-up, please refer to the couchbase documentation for set-up
+*******************************************************************************************/
+
+server := '127.0.0.1';            //change this to point to your couchbase
+thebucket := 'travel-sample';
+
+namerec := RECORD
+  string name;
+END;
+
+typerec := RECORD
+  string type;
+END;
+
+travelrec := RECORD
+  string callsign;
+  string country;
+  string iata;
+  string icao;
+  integer id;
+  string name;
+  string type;
+END;
+
+georec := RECORD
+  integer alt;
+  real lat;
+  real lon;
+END;
+
+airportrec := RECORD
+  string airportname;
+  string city;
+  string country;
+  string faa;
+  string  tz;
+  string type;
+  integer id;
+  string icao;
+  georec geo;
+END;
+
+/*
+ --Sample Airport record--
+ "airportname": "Calais Dunkerque",
+    "city": "Calais",
+    "country": "France",
+    "faa": "CQF",
+    "geo": {
+      "alt": 12,
+      "lat": 50.962097,
+      "lon": 1.954764
+    },
+    "icao": "LFAC",
+    "id": 1254,
+    "type": "airport",
+    "tz": "Europe/Paris"
+*/
+/*
+  --sample airline record--
+  "callsign": null,
+  "country": "United States",
+  "iata": "WQ",
+  "icao": "PQW",
+  "id": 13633,
+  "name": "PanAm World Airways",
+  "type": "airline"
+*/
+schedrec := RECORD
+  unsigned day;
+  string flight;
+  string utc;
+END;
+
+routerec := RECORD
+  string airline;
+  string airlineid;
+  string3 destinationairport;
+  real distance;
+  string equipment;
+  integer id;
+  dataset(schedrec) schedule {xpath('schedule')};
+  string3 sourceairport;
+  unsigned stops;
+  string type;
+END;
+/*
+  "travel-sample": {
+  "airline": "AH",
+  "airlineid": "airline_794",
+  "destinationairport": "CDG",
+  "distance": 1420.6731433915318,
+  "equipment": "738",
+  "id": 10041,
+  "schedule": [
+      {
+       "day": 0,
+       "flight": "AH547",
+       "utc": "07:58:00"
+      },
+      {
+       "day": 0,
+       "flight": "AH428",
+       "utc": "12:08:00"
+      },
+      {
+       "day": 1,
+       "flight": "AH444",
+       "utc": "14:16:00"
+      },
+      {
+       "day": 3,
+       "flight": "AH741",
+       "utc": "04:56:00"
+      },
+      {
+       "day": 4,
+       "flight": "AH027",
+       "utc": "03:16:00"
+      },
+      {
+       "day": 4,
+       "flight": "AH113",
+       "utc": "08:11:00"
+      },
+      {
+       "day": 6,
+       "flight": "AH260",
+       "utc": "18:02:00"
+      },
+      {
+       "day": 6,
+       "flight": "AH873",
+       "utc": "03:58:00"
+      }
+     ],
+     "sourceairport": "AAE",
+     "stops": 0,
+     "type": "route"
+    }
+    */
+
+/* Due to inconsistencies found in couchbase travel-sample, some queries explicitly omit records of type landmark and hotel */
+
+integer countAllRecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT count(*) from `travel-sample` as mybucketalias where mybucketalias.type != 'landmark' and mybucketalias.type != 'hotel';
+ENDEMBED;
+
+integer countTypes() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT COUNT(DISTINCT mybucketalias.type) from `travel-sample` as mybucketalias where mybucketalias.type != 'landmark' and mybucketalias.type != 'hotel';
+ENDEMBED;
+
+dataset(typerec) allTypes() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT DISTINCT mybucketalias.type from `travel-sample` as mybucketalias where mybucketalias.type IS NOT NULL and mybucketalias.type != 'landmark' and mybucketalias.type != 'hotel';
+ENDEMBED;
+
+dataset(travelrec) fulltravelrecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where callsign = 'MILE-AIR' limit 1;
+ENDEMBED;
+
+dataset(namerec) airlinenames() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.name from `travel-sample` as mybucketalias where mybucketalias.type = 'airline' limit 1;
+ENDEMBED;
+
+dataset(airportrec) airportrecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' limit 1;
+ENDEMBED;
+
+dataset(airportrec) usairportrecords() := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and country = 'United States' limit 1;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbycountry(string m) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and country = $m limit 1;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbyid(integer id) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and id = $id limit 1;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbyaltitude(integer alt) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and geo.alt >= $alt limit 1;
+ENDEMBED;
+
+dataset(airportrec) airportrecordsbycoordinates(row(georec) values) := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  select mybucketalias.* from `travel-sample` as mybucketalias where mybucketalias.type = 'airport' and geo.lat = $lat and geo.lon = $lon limit 10;
+ENDEMBED;
+
+dataset(routerec) fullroute()  := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT mybucketalias.* FROM `travel-sample` as mybucketalias WHERE type = 'route' and sourceairport IS NOT NULL LIMIT 1
+ENDEMBED;
+
+dataset(routerec) routeschedule(string sair, string dair)  := EMBED(couchbase : server(server), bucket(thebucket), detailed_errcodes(1), operation_timeout(5.5), config_total_timeout(15))
+  SELECT mybucketalias.schedule  FROM `travel-sample` as mybucketalias WHERE type = 'route' and sourceairport = $sair and destinationairport = $dair  LIMIT 1
+ENDEMBED;
+
+sequential
+(
+  OUTPUT(countAllRecords(), NAMED('CountOfAllRecs'));
+  OUTPUT(countTypes(), NAMED('CountOfAllRecTypes'));
+  OUTPUT(allTypes(), NAMED('AllRecordTypes'));
+  OUTPUT(airlinenames(), NAMED('AirlineNames'));
+  OUTPUT(usairportrecords(), NAMED('USAirports'));
+  OUTPUT(airportrecordsbycountry('"France"'), NAMED('AirportsByCountry'));
+  OUTPUT(fulltravelrecords(), NAMED('FullTravelRec'));
+  OUTPUT(airportrecordsbyid(3411), NAMED('AirportByID'));
+  OUTPUT(airportrecordsbyaltitude(4000), NAMED('AirportsAtAltitude'));
+  OUTPUT(airportrecordsbycoordinates(ROW({0,31.3426028, -109.5064544},georec)), NAMED('AirportAtCoordinate'));
+  //OUTPUT(fullroute(), NAMED('FullRouteRec'));
+  //OUTPUT(routeschedule('"AAE"', '"CDG"'),  NAMED('RouteAAEtoCDG'));
+  OUTPUT('Done', NAMED('Status'));
+);
+

+ 35 - 0
testing/regress/ecl/key/couchbase-simple.xml

@@ -0,0 +1,35 @@
+<Dataset name='CountOfAllRecs'>
+ <Row><CountOfAllRecs>26179</CountOfAllRecs></Row>
+</Dataset>
+<Dataset name='CountOfAllRecTypes'>
+ <Row><CountOfAllRecTypes>3</CountOfAllRecTypes></Row>
+</Dataset>
+<Dataset name='AllRecordTypes'>
+ <Row><type>airline</type></Row>
+ <Row><type>airport</type></Row>
+ <Row><type>route</type></Row>
+</Dataset>
+<Dataset name='AirlineNames'>
+ <Row><name>40-Mile Air</name></Row>
+</Dataset>
+<Dataset name='USAirports'>
+ <Row><airportname>Barter Island Lrrs</airportname><city>Barter Island</city><country>United States</country><faa>BTI</faa><tz>America/Anchorage</tz><type>airport</type><id>3411</id><icao>PABA</icao><geo><alt>2</alt><lat>70.133989</lat><lon>-143.581867</lon></geo></Row>
+</Dataset>
+<Dataset name='AirportsByCountry'>
+ <Row><airportname>Calais Dunkerque</airportname><city>Calais</city><country>France</country><faa>CQF</faa><tz>Europe/Paris</tz><type>airport</type><id>1254</id><icao>LFAC</icao><geo><alt>12</alt><lat>50.962097</lat><lon>1.954764</lon></geo></Row>
+</Dataset>
+<Dataset name='FullTravelRec'>
+ <Row><callsign>MILE-AIR</callsign><country>United States</country><iata>Q5</iata><icao>MLA</icao><id>10</id><name>40-Mile Air</name><type>airline</type></Row>
+</Dataset>
+<Dataset name='AirportByID'>
+ <Row><airportname>Barter Island Lrrs</airportname><city>Barter Island</city><country>United States</country><faa>BTI</faa><tz>America/Anchorage</tz><type>airport</type><id>3411</id><icao>PABA</icao><geo><alt>2</alt><lat>70.133989</lat><lon>-143.581867</lon></geo></Row>
+</Dataset>
+<Dataset name='AirportsAtAltitude'>
+ <Row><airportname>Grants Milan Muni</airportname><city>Grants</city><country>United States</country><faa>GNT</faa><tz>America/Denver</tz><type>airport</type><id>3439</id><icao>KGNT</icao><geo><alt>6537</alt><lat>35.167286</lat><lon>-107.901989</lon></geo></Row>
+</Dataset>
+<Dataset name='AirportAtCoordinate'>
+ <Row><airportname>Douglas Municipal Airport</airportname><city>Douglas</city><country>United States</country><faa>DGL</faa><tz>America/Phoenix</tz><type>airport</type><id>7588</id><icao>KDGL</icao><geo><alt>4173</alt><lat>31.3426028</lat><lon>-109.5064544</lon></geo></Row>
+</Dataset>
+<Dataset name='Status'>
+ <Row><Status>Done</Status></Row>
+</Dataset>