Skip to content

Commit

Permalink
Few additional tests, improving coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbooker42 committed Dec 17, 2024
1 parent b8e235c commit a13bbab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ static class BaseContext implements SafeCloseable {
}
}
resultsChunk = WritableBooleanChunk.makeWritableChunk(size);
//noinspection unchecked
// noinspection unchecked
filterChunks = new Chunk[filters.length][];
for (int ii = 0; ii < filters.length; ii++) {
//noinspection unchecked
// noinspection unchecked
filterChunks[ii] = new Chunk[filters[ii].recorders.length];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public void testBy() {
Filter.and(Filter.from("B <= 10", "B >= 5")))),
// Multiple input columns
AggCountWhere("filter10", "B >= 5", "C == 1"),
AggCountWhere("filter11", "B >= 5 && C == 1 && A == 0")),
AggCountWhere("filter11", "B >= 5 && C == 1 && A == 0"),
AggCountWhere("filter12", "B >= 5", "C >= 1")),
"A");
show(doubleCounted);
assertEquals(2, doubleCounted.size());
Expand Down Expand Up @@ -183,6 +184,9 @@ public void testBy() {
counts = ColumnVectors.ofLong(doubleCounted, "filter11");
assertEquals(4L, counts.get(0));
assertEquals(0L, counts.get(1));
counts = ColumnVectors.ofLong(doubleCounted, "filter12");
assertEquals(4L, counts.get(0));
assertEquals(2L, counts.get(1));

doubleCounted = table.aggBy(
List.of(
Expand All @@ -199,7 +203,8 @@ public void testBy() {
Filter.and(Filter.from("B <= 10", "B >= 5")))),
// Multiple input columns
AggCountWhere("filter10", "B >= 5", "C == 1"),
AggCountWhere("filter11", "B >= 5 && C == 1 && A == 0")));
AggCountWhere("filter11", "B >= 5 && C == 1 && A == 0"),
AggCountWhere("filter12", "B >= 5", "C >= 1")));
show(doubleCounted);
assertEquals(1, doubleCounted.size());

Expand All @@ -225,6 +230,8 @@ public void testBy() {
assertEquals(6L, counts.get(0));
counts = ColumnVectors.ofLong(doubleCounted, "filter11");
assertEquals(4L, counts.get(0));
counts = ColumnVectors.ofLong(doubleCounted, "filter12");
assertEquals(6L, counts.get(0));

// Lets do some interesting incremental computations, as this is the use case that I'm really aiming at. For
// example, getting the count, and average on each update.
Expand Down Expand Up @@ -389,7 +396,10 @@ public Table e() {
AggCountWhere("filter10", "intCol >= 5", "doubleCol <= 10.0"),
AggCountWhere("filter11", "intCol >= 5 && intColNulls != 3 && doubleCol <= 10.0"),
// DynamicWhereFilter
AggCountWhere("filter12", new DynamicWhereFilter(setTable, true, MatchPairFactory.getExpressions("intCol")))),
AggCountWhere("filter12",
new DynamicWhereFilter(setTable, true,
MatchPairFactory.getExpressions("intCol"))),
AggCountWhere("filter13", "doubleCol >= 5", "doubleColNulls >= 1")),
"Sym").sort("Sym");
}
},
Expand All @@ -414,7 +424,10 @@ public Table e() {
AggCountWhere("filter10", "intCol >= 5", "doubleCol <= 10.0"),
AggCountWhere("filter11", "intCol >= 5 && intColNulls != 3 && doubleCol <= 10.0"),
// DynamicWhereFilter
AggCountWhere("filter12", new DynamicWhereFilter(setTable, true, MatchPairFactory.getExpressions("intCol")))));
AggCountWhere("filter12",
new DynamicWhereFilter(setTable, true,
MatchPairFactory.getExpressions("intCol"))),
AggCountWhere("filter13", "doubleCol >= 5", "doubleColNulls >= 1")));
}
},
new QueryTableTest.TableComparator(
Expand Down
8 changes: 4 additions & 4 deletions table-api/src/main/java/io/deephaven/api/agg/Aggregation.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ static Count AggCount(String resultColumn) {
}

/**
* Create a {@link io.deephaven.api.agg.CountWhere count} aggregation with the supplied output column name,
* counting values that pass the supplied {@code filters}.
* Create a {@link io.deephaven.api.agg.CountWhere count} aggregation with the supplied output column name, counting
* values that pass the supplied {@code filters}.
*
* @param resultColumn The {@link Count#column() output column} name
* @return The aggregation
Expand All @@ -237,8 +237,8 @@ static CountWhere AggCountWhere(String resultColumn, String... filters) {
}

/**
* Create a {@link io.deephaven.api.agg.CountWhere count} aggregation with the supplied output column name,
* counting values that pass the supplied {@code filter}.
* Create a {@link io.deephaven.api.agg.CountWhere count} aggregation with the supplied output column name, counting
* values that pass the supplied {@code filter}.
*
* @param resultColumn The {@link Count#column() output column} name
* @return The aggregation
Expand Down

0 comments on commit a13bbab

Please sign in to comment.