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

TOPN flag for JOIN()

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Accepted
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None
    • Compatibility:
      Major

      Description

      This is a request to add a TOPN flag to the JOIN() ECL function as a way of making KEEP(n) a bit smarter.

      The flag would operate like KEEP(n) in that only n number of matches per LHS would be retained, but the actual records kept would be determined by the same rules that normally govern TOPN(). The syntax could be:

      TOPN(count, sorts)

      Where sorts is one or more attributes in the result (i.e. SELF.x, -SELF.y, etc.).

      Example:

      JOIN(lhs, rhs, LEFT.id = RIGHT.id, TOPN(5, SELF.someNum));
      

      This would function the same as KEEP(5) but the actual kept matches would contain the lowest someNum values in the result rather than just the first five matched records.

      Rationale: This option would save enormous amounts of processing time for certain datasets. For example, a dataset containing lat/lon values where you need to find the nearest n neighbors for every record would benefit tremendously.

        Attachments

          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: