Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-17757

Couchbase Plugin: Unable to parse query results into complex RECORD structure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.2.14
    • Fix Version/s: 6.4.0
    • Component/s: Plugins
    • Labels:
      None

      Description

      IMPORT Std;
      IMPORT couchbase;
      
      #WORKUNIT('name', 'Couchbase: General Testing');
      
      //------------------------------------------------------------------------------
      
      ThreeDCoordinateRecord := RECORD
          DECIMAL5_3              x                           {XPATH('x')};
          DECIMAL5_3              y                           {XPATH('y')};
          DECIMAL5_3              z                           {XPATH('z')};
      END;
      
      GPSRecord := RECORD
          DECIMAL9_6              latitude                    {XPATH('latitude')};
          DECIMAL9_6              longitude                   {XPATH('longitude')};
      END;
      
      WifiRecord := RECORD
          STRING                  id                          {XPATH('id')};
          STRING                  value                       {XPATH('value')};
      END;
      
      RawDataRecord := RECORD
          DECIMAL6_3              ambientTemp                 {XPATH('ambientTemp')};
          DECIMAL5_2              barometer                   {XPATH('barometer')};
          DECIMAL6_3              batteryLevelPercentage      {XPATH('batteryLevelPercentage')};
          DECIMAL4_2              bodyTemp                    {XPATH('bodyTemp')};
          DECIMAL5_3              coLevel                     {XPATH('coLevel')};
          DECIMAL6_3              forceSensitiveResistance    {XPATH('forceSensitiveResistance')};
          UNSIGNED2               heartRate                   {XPATH('heartRate')};
      END;
      
      ContextualDataRecord := RECORD
          ThreeDCoordinateRecord  accelerometer               {XPATH('accelerometer')};
          GPSRecord               gps                         {XPATH('gps')};
          ThreeDCoordinateRecord  gyroscope                   {XPATH('gyroscope')};
          ThreeDCoordinateRecord  magneticfield               {XPATH('magneticfield')};
          DATASET(WifiRecord)     wifi                        {XPATH('wifi')};
      END;
      
      LocationDataRecord := RECORD
          ThreeDCoordinateRecord;
          STRING                  zoneID                      {XPATH('zoneId')};
      END;
      
      HeaderRecord := RECORD
          STRING                  msgtype                     {XPATH('msgtype')};
          STRING                  thePriority                 {XPATH('priority')};
      END;
      
      EventRecord := RECORD
          ContextualDataRecord    contextualData              {XPATH('contextualData')};
          STRING                  eventID                     {XPATH('eventId')};
          BOOLEAN                 isEventStatus               {XPATH('eventStatus')};
          STRING                  guid                        {XPATH('guid')};
          BOOLEAN                 isStaleData                 {XPATH('isStaleData')};
          LocationDataRecord      locationData                {XPATH('locationData')};
          RawDataRecord           rawData                     {XPATH('rawData')};
          UNSIGNED4               sequence                    {XPATH('sequence')};
          STRING                  timestamp                   {XPATH('timestamp')};
      END;
      
      EventWrapper := RECORD
          EventRecord             theEvent                    {XPATH('event')};
          HeaderRecord            theHeader                   {XPATH('header')};
      END;
      
      Raw_Layout := RECORD
          BOOLEAN                 isCompressed                {XPATH('compressed')};
          EventWrapper            d                           {XPATH('d')};
      END;
      
      ETL_Layout := RECORD
          Raw_Layout;
          Std.Date.Timestamp_t    deviceTimestamp             {XPATH('deviceTimestamp')};
      END;
      
      Parsed_Layout := RECORD
          Std.Date.Timestamp_t    receivedTimestamp           {XPATH('receivedTimestamp')};
          UNSIGNED4               roxieNodeNum                {XPATH('roxieNodeNum')};
          UNSIGNED4               roxieThreadID               {XPATH('roxieThreadID')};
          STRING40                deviceID                    {XPATH('deviceID')};
          ETL_Layout              message                     {XPATH('message')};
      END;
      
      //------------------------------------------------------------------------------
      
      DATASET(Parsed_Layout) GetDeltaStoreDataByDeviceID2() := EMBED(couchbase : server('10.240.33.98'), bucket('org_hpcc_guardhat_smarthat_data_handler'))
          select org_hpcc_guardhat_smarthat_data_handler.* from org_hpcc_guardhat_smarthat_data_handler where deviceID = "f0044311-05cf-4344-bb93-a52687d0d3e9" limit 10;
      ENDEMBED;
      
      docsDev2 := GetDeltaStoreDataByDeviceID2();
      OUTPUT(docsDev2, NAMED('docsDev2'));
      

      This code completes but populates only the top-level record attributes; all others acquire default values. See http://10.240.32.163:8010/?Wuid=W20170606-155129&Sequence=0&Widget=ResultWidget for an example.

        Attachments

          Activity

            People

            • Assignee:
              dcamper Dan S. Camper
              Reporter:
              dcamper Dan S. Camper
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: