Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add round property for CardinalityAggregator #146

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,22 @@ public class CardinalityAggregator extends DruidAggregator {
private static final String CARDINALITY_AGGREGATOR_TYPE = "cardinality";
private List<String> fields;
private Boolean byRow;
private Boolean round;

@Builder
@Deprecated
abhi-zapr marked this conversation as resolved.
Show resolved Hide resolved
private CardinalityAggregator(@NonNull String name, @NonNull List<String> fields, Boolean byRow) {
this.type = CARDINALITY_AGGREGATOR_TYPE;
this.name = name;
this.fields = fields;
this.byRow = byRow;
}

@Builder
private CardinalityAggregator(@NonNull String name, @NonNull List<String> fields, Boolean byRow, Boolean round) {
this.type = CARDINALITY_AGGREGATOR_TYPE;
this.name = name;
this.fields = fields;
this.byRow = byRow;
this.round = round;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void testAllFields() throws JsonProcessingException, JSONException {
.name("Hello")
.fields(fields)
.byRow(true)
.round(true)
.build();

JSONArray fieldJsonArray = new JSONArray(fields);
Expand All @@ -59,6 +60,7 @@ public void testAllFields() throws JsonProcessingException, JSONException {
jsonObject.put("name", "Hello");
jsonObject.put("fields", fieldJsonArray);
jsonObject.put("byRow", true);
jsonObject.put("round", true);

String actualJSON = objectMapper.writeValueAsString(cardinalityAggregator);
String expectedJSON = jsonObject.toString();
Expand Down Expand Up @@ -147,6 +149,7 @@ public void testEqualsWithAnotherSubClass() {
.name("Agg1")
.fields(Collections.singletonList("Haha"))
.byRow(true)
.round(true)
.build();
CountAggregator aggregator2 = new CountAggregator("count");

Expand Down