Details
-
Task
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
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