When I tried to calculate the median of the age field in a table with 120
million rows, I implemented a custom UDAF. However, there was a significant
performance difference between the two different types of  accumulator. The
ListView stated that it would enable the state backend when encountering
large amounts of data. How can I observe this process and which classes are
responsible for these functions?
```java

public static class State implements Serializable {

    public int scale = 2;

    @DataTypeHint(value = "ARRAY<DOUBLE>")
    public ArrayList<Double> numbers;

    public State() {}
}

@Override
public State createAccumulator() {
    State state = new State();
    state.numbers = new ArrayList<>();
    return state;
}


```java

public static class State implements Serializable {

    public int scale = 2;

    public ListView<Double> numbers;

    public State() {}
}

@Override
public State createAccumulator() {
    State state = new State();
    state.numbers = new ListView<>();
    return state;
}

Reply via email to