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

Fix invalid constant propagation from a DENORMALIZE transform

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.2.12
    • Fix Version/s: 6.4.0
    • Component/s: Code Generator
    • Labels:

      Description

      Runnable code, reproducible in any engine:

      ChildRec := RECORD
          INTEGER1            nameID;
          STRING20            addr;
      END;
      
      ParentRec := RECORD
          INTEGER1            nameID;
          STRING20            name;
          BOOLEAN             hasChildren := FALSE;
          INTEGER1            numRows := 0;
          DATASET(ChildRec)   children := DATASET([], ChildRec);
      END;
      
      namesTable := DATASET
          (
              [
                  {1, 'Gavin'},
                  {2, 'Liz'},
                  {3, 'Mr Nobody'},
                  {4, 'Anywhere'}
              ],
              ParentRec
          );
      
      normAddrs := DATASET
          (
              [
                  {1, '10 Malt Lane'},
                  {2, '10 Malt Lane'},
                  {2, '3 The cottages'}
              ],
              ChildRec
          );
      
      res := DENORMALIZE
          (
              namesTable,
              normAddrs,
              LEFT.nameID = RIGHT.nameID,
              TRANSFORM
                  (
                      ParentRec,
                      SELF.numRows := COUNTER,
                      SELF.children := LEFT.children + RIGHT,
                      SELF.hasChildren := TRUE,
                      SELF := LEFT
                  )
          );
      
      OUTPUT(res, NAMED('AllResults'));
      OUTPUT(res(hasChildren), NAMED('HasChildren'));
      OUTPUT(res(~hasChildren), NAMED('DoesNotHaveChildren'));
      

      Viewing AllResults shows two records with hasChildren=TRUE and two records with hasChildren=FALSE. The next two named results don't return that information correctly, however.

      The graph of the code (enclosed) shows that the DoesNotHaveChildren result actually originates from a NULL, so never even tried to filter the requested results.

      If you mark the DENORMALIZE() call as INDEPENDENT then you get the expected results.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ghalliday Gavin Halliday
                Reporter:
                dcamper Dan S. Camper
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: