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

Simplify SORT(ds, complex-expression)


    • Type: Bug
    • Status: Accepted
    • Priority: Not specified
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Code Generator
    • Labels:


      There are often examples of code which sorts by a complex expression. E.g.,

      SORT(ds, myPreferredName(some-fields));

      At the moment myPreferredName will be called each time a row is compared. It is often much more efficient to project that computed value into the dataset, and then compare that new field. However there are also cases where it isn't so good:

      i) the function creates a large temporary value, which might mean the sort spills much earlier if it is projected out.

      ii) The complex function is a trailing component. E.g.,
      SORT(ds, a, b, c, something-complex).

      That is only more efficient to pre-project if there are likely to be duplicate rows with the same values for fields a,b,c. Otherwise you may end up executing the function more often, and pay the penalty for storing the value as well.




            • Assignee:
              anybody Available for anyone
              ghalliday Gavin Halliday
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: