|
37 | 37 | import java.util.function.Function; |
38 | 38 |
|
39 | 39 | /** |
40 | | - * Aggregates field values for long. |
41 | | - * TODO: make .java.st from this to support other types |
42 | | - * TODO: add "includeTimestamp" to @Aggregator |
| 40 | + * Change point detection for series of long values. |
43 | 41 | */ |
44 | | -// TODO: add normal @Aggregator |
45 | | -// @Aggregator({ |
46 | | -// includeTimestamps = true, |
47 | | -// @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), |
48 | | -// @IntermediateState(name = "values", type = "LONG_BLOCK") }) |
| 42 | + |
| 43 | +// TODO: make .java.st from this to support different types |
| 44 | + |
| 45 | +// TODO: add non-grouping @Aggregator, like this: |
| 46 | +/* |
| 47 | +@Aggregator( |
| 48 | + includeTimestamps = true, |
| 49 | + value = { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "LONG_BLOCK") } |
| 50 | +) |
| 51 | +*/ |
| 52 | +// This need "includeTimestamps" support in @Aggregator. |
| 53 | + |
49 | 54 | @GroupingAggregator( |
50 | 55 | includeTimestamps = true, |
51 | 56 | value = { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "LONG_BLOCK") } |
@@ -123,7 +128,7 @@ public int compareTo(TimeAndValue other) { |
123 | 128 | } |
124 | 129 |
|
125 | 130 | void sort() { |
126 | | - // TODO: this is very inefficient and doesn't account for memory! |
| 131 | + // TODO: this copying is a bit inefficient and doesn't account for memory |
127 | 132 | List<TimeAndValue> list = new ArrayList<>(count); |
128 | 133 | for (int i = 0; i < count; i++) { |
129 | 134 | list.add(new TimeAndValue(timestamps.get(i), values.get(i))); |
@@ -185,6 +190,7 @@ void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContex |
185 | 190 | } |
186 | 191 |
|
187 | 192 | public Block evaluateFinal(IntVector selected, BlockFactory blockFactory) { |
| 193 | + // TODO: this needs to output multiple columns or a composite object, not a JSON blob. |
188 | 194 | try (BytesRefBlock.Builder builder = blockFactory.newBytesRefBlockBuilder(selected.getPositionCount())) { |
189 | 195 | for (int s = 0; s < selected.getPositionCount(); s++) { |
190 | 196 | SingleState state = states.get(selected.getInt(s)); |
@@ -244,7 +250,6 @@ Block toBlock(Function<SingleState, LongArray> getArray, BlockFactory blockFacto |
244 | 250 | } |
245 | 251 |
|
246 | 252 | void enableGroupIdTracking(SeenGroupIds seenGroupIds) { |
247 | | - // noop - we handle the null states inside `toIntermediate` and `evaluateFinal` |
248 | 253 | } |
249 | 254 |
|
250 | 255 | @Override |
|
0 commit comments