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

Document JOIN ...KEEP(n) applying per left row

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 8.0.20
    • 8.2.14
    • Documentation
    • None
    • UK DEV HTHOR

    Description

      The following code snippet creates a dataset of 10 copies of every date for June 2021.

      It then JOINs that to a dataset containing a single record for every day of June 2021, with the qualifier KEEP(3).

      However the resultant dataset still shows 10 records for every date. The qualifier has not taken effect.

      IMPORT STD;
      {DATASET({UNSIGNED4 Date}) Dates} GenerateEveryDay({UNSIGNED4 StartDate} L,UNSIGNED4 Cnt) := TRANSFORM
          UNSIGNED4 Date := STD.Date.AdjustDate(L.StartDate,0,0,Cnt);
          SELF.Dates := DATASET(10,TRANSFORM({UNSIGNED4 Date};SELF.Date := Date));
      END;
      
      EveryDay := NORMALIZE(DATASET([{20210531}],{UNSIGNED4 StartDate}),30,GenerateEveryDay(LEFT,COUNTER));
      MultipleEveryDay := NORMALIZE(EveryDay,LEFT.Dates,TRANSFORM(RIGHT));
      OUTPUT(MultipleEveryDay,NAMED('Multiple_Dates'));
      
      UniqueDates := DEDUP(SORT(MultipleEveryDay,Date),Date);
      OUTPUT(UniqueDates,NAMED('Unique_Dates'));
      
      BadPostKeep := JOIN(MultipleEveryDay,UniqueDates,LEFT.Date = RIGHT.Date,TRANSFORM(LEFT),KEEP(3));
      
      OUTPUT(BadPostKeep,NAMED('SHOULD_BE_3_COPIES_OF_EVERY_DATE_BUT_THERE_ARE_STILL_10_COPIES'));
      

         

      Attachments

        Activity

          People

            jamesdefabia Jim DeFabia
            allan Allan Francis Wrobel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: