Skip to content

Commit 96fdf04

Browse files
authored
Fix aggregation and value type (#57)
* Fix aggregation and value type * Add changelog
1 parent 7993fb1 commit 96fdf04

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ Changes by Version
22
==================
33
Release Notes.
44

5+
0.7.0
6+
------------------
7+
8+
### Features
9+
10+
11+
### Bugs
12+
13+
* Fix MeasureQuery.SumBy to use SUM instead of COUNT
14+
* Add missing FloatFieldValue type in the Measure write operation
15+
516
0.6.0
617
------------------
718

src/main/java/org/apache/skywalking/banyandb/v1/client/MeasureQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public MeasureQuery sumBy(String field, Set<String> groupByKeys) {
110110
Preconditions.checkArgument(fieldProjections.contains(field), "field should be selected first");
111111
Preconditions.checkArgument(this.tagProjections.containsAll(groupByKeys), "groupBy tags should be selected first");
112112
Preconditions.checkState(this.aggregation == null, "aggregation should only be set once");
113-
this.aggregation = new Aggregation(field, Aggregation.Type.COUNT, groupByKeys);
113+
this.aggregation = new Aggregation(field, Aggregation.Type.SUM, groupByKeys);
114114
return this;
115115
}
116116

src/main/java/org/apache/skywalking/banyandb/v1/client/Value.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,20 @@ public BanyandbModel.FieldValue serialize() {
253253
}
254254
}
255255

256+
/**
257+
* The value of a float type field.
258+
*/
259+
public static class FloatFieldValue extends Value<Float> implements Serializable<BanyandbModel.FieldValue> {
260+
private FloatFieldValue(Float value) {
261+
super(value);
262+
}
263+
264+
@Override
265+
public BanyandbModel.FieldValue serialize() {
266+
return BanyandbModel.FieldValue.newBuilder().setFloat(BanyandbModel.Float.newBuilder().setValue(value)).build();
267+
}
268+
}
269+
256270
/**
257271
* Construct a numeric tag
258272
*

0 commit comments

Comments
 (0)