Bridget Bevens created DRILL-6531:
-------------------------------------

             Summary: Errors in example for "Aggregate Function Interface" Boaz 
Ben-Zvi Fri 6/15, 5:54 PM Bridget Bevens
                 Key: DRILL-6531
                 URL: https://issues.apache.org/jira/browse/DRILL-6531
             Project: Apache Drill
          Issue Type: Task
          Components: Documentation
            Reporter: Bridget Bevens
            Assignee: Bridget Bevens
             Fix For: 1.14.0


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

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to