Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-6531

Errors in example for "Aggregate Function Interface" Boaz Ben-Zvi Fri 6/15, 5:54 PM Bridget Bevens

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.14.0
    • Documentation

    Description

      Hi Bridget,

      There seems to be an error in the example shown in https://drill.apache.org/docs/custom-function-interfaces/
      Custom Function Interfaces - Apache Drill
      drill.apache.org
      Implement the Drill interface appropriate for the type of function that you want to develop. Each interface provides a set of required holders where you input data types that your function uses and required methods that Drill calls to perform your function’s operations.

      The error is logical, not relating to the main topic (Aggregate Function Interface), but may slightly confuse anyone carefully reading this doc (like me ☺)

      The error is – the red line should come before the brown line:

      @Override

      public void add() {

      if (in.value < min.value)

      { min.value = in.value; secondMin.value = min.value; }

      That is - Should be:

      @Override

      public void add() {

      if (in.value < min.value)

      { secondMin.value = min.value; min.value = in.value; }

      This comes from interpreting the name of the new function (“The second most minimum”).

      While on the subject – looks like the reset() function is also wrong (need to reset to high numbers, not zero):

      @Override

      public void reset()

      { min.value = 0; è 999999999 secondMin.value = 0; è 999999999 }

      Thanks,

      Boaz

      Attachments

        Activity

          People

            bbevens Bridget Bevens
            bbevens Bridget Bevens
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: