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

Weird DEDUP and SORT syntax that should not work, does

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0.0
    • Component/s: Code Generator
    • Labels:
      None

      Description

      Sample code:

      Dbg(sym) := MACRO
          OUTPUT(sym, NAMED(#TEXT(sym)));
      ENDMACRO;
      
      DataRec := RECORD
          UNSIGNED4   n;
          UNSIGNED4   i;
      END;
      
      ds1 := DATASET
          (
              5,
              TRANSFORM
                  (
                      DataRec,
                      SELF.n := RANDOM(),
                      SELF.i := RANDOM()
                  )
          );
      
      ds2 := DATASET(['foo', 'bar'], {STRING s});
      
      Dbg(ds1);
      Dbg(ds2);
      
      ds3 := DEDUP(ds1, ds2, WHOLE RECORD, ALL);
      Dbg(ds3);
      
      ds4 := SORT(ds1, ds1, n);
      Dbg(ds4);
      

      To be clear, what is odd in the above code is including two datasets as arguments to both DEDUP and SORT. This sample came about due to someone (me) typing ECL into an email reply and making a copy and paste error, then someone else just pasting that into an editor. No one was actually trying to do something with this syntax.

      What is going on, here? Why does it compile?

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: