Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -114,7 +114,7 @@ void emptyChunkSelectsNothing() {
// Then nothing is selected and the sum is the additive identity, min/max are null
assertThat(result.selectedRows()).isZero();
assertThat(result.aggNonNullCount()).isZero();
assertThat(result.sum()).isEqualTo(0L);
assertThat(result.sum().longValue()).isZero();
assertThat(result.min()).isNull();
assertThat(result.max()).isNull();
}
Expand All @@ -131,7 +131,7 @@ void noMatchSelectsNothing() {

// Then no row is selected and the aggregate is empty
assertThat(result.selectedRows()).isZero();
assertThat(result.sum()).isEqualTo(0L);
assertThat(result.sum().longValue()).isZero();
assertThat(result.min()).isNull();
assertThat(result.max()).isNull();
}
Expand Down Expand Up @@ -168,7 +168,7 @@ void allNullAggregateContributesNothingButSelectsRows() {
// Then all rows are selected, none contribute to the aggregate, sum is the identity
assertThat(result.selectedRows()).isEqualTo(4L);
assertThat(result.aggNonNullCount()).isZero();
assertThat(result.sum()).isEqualTo(0L);
assertThat(result.sum().longValue()).isZero();
assertThat(result.min()).isNull();
assertThat(result.max()).isNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,9 @@ void longColumn_foldsSumMinMaxSkippingNullValues() {
.orElseThrow();

// Then — a: rows 0, 2, 5 with row 2 null; b: rows 1, 4; null group: row 3
assertThat(result.get("a")).isEqualTo(new FilteredAggregate(3, 2, 14L, 5L, 9L));
assertThat(result.get("b")).isEqualTo(new FilteredAggregate(2, 2, 6L, -1L, 7L));
assertThat(result.get(null)).isEqualTo(new FilteredAggregate(1, 1, 2L, 2L, 2L));
assertThat(result).containsEntry("a", new FilteredAggregate(3, 2, 14L, 5L, 9L));
assertThat(result).containsEntry("b", new FilteredAggregate(2, 2, 6L, -1L, 7L));
assertThat(result).containsEntry(null, new FilteredAggregate(1, 1, 2L, 2L, 2L));
}

@Test
Expand Down Expand Up @@ -634,8 +634,8 @@ void filter_foldsOnlyTheSelectedRows() {

// Then — groups with no selected row do not appear
assertThat(result).containsOnlyKeys("a", "b");
assertThat(result.get("a")).isEqualTo(new FilteredAggregate(2, 2, 14L, 5L, 9L));
assertThat(result.get("b")).isEqualTo(new FilteredAggregate(1, 1, 7L, 7L, 7L));
assertThat(result).containsEntry("a", new FilteredAggregate(2, 2, 14L, 5L, 9L));
assertThat(result).containsEntry("b", new FilteredAggregate(1, 1, 7L, 7L, 7L));
}

/// A dictionary spanning many chunks reaches the kernel as a slice; codes are read at its offset.
Expand Down Expand Up @@ -664,7 +664,7 @@ void duplicateDictionaryValues_foldIntoOneGroup() {
Map<Object, FilteredAggregate> result = Compute.groupedAggregate(chunk(group, v), G, null, V).orElseThrow();

// Then
assertThat(result.get("x")).isEqualTo(new FilteredAggregate(3, 3, 1011L, 1L, 1000L));
assertThat(result).containsEntry("x", new FilteredAggregate(3, 3, 1011L, 1L, 1000L));
}

@Test
Expand Down Expand Up @@ -705,9 +705,9 @@ void booleanGroupColumn_foldsFalseTrueAndNull() {

// Then
assertThat(result).containsOnlyKeys(true, false, null);
assertThat(result.get(true)).isEqualTo(new FilteredAggregate(2, 2, 4L, 1L, 3L));
assertThat(result.get(false)).isEqualTo(new FilteredAggregate(1, 1, 2L, 2L, 2L));
assertThat(result.get(null)).isEqualTo(new FilteredAggregate(1, 1, 4L, 4L, 4L));
assertThat(result).containsEntry(true, new FilteredAggregate(2, 2, 4L, 1L, 3L));
assertThat(result).containsEntry(false, new FilteredAggregate(1, 1, 2L, 2L, 2L));
assertThat(result).containsEntry(null, new FilteredAggregate(1, 1, 4L, 4L, 4L));
}

@Test
Expand All @@ -722,8 +722,8 @@ void integerGroupColumn_foldsEachDistinctValueWithAFilter() {

// Then
assertThat(result).containsOnlyKeys(7L, -3L);
assertThat(result.get(7L)).isEqualTo(new FilteredAggregate(2, 2, 7L, 3L, 4L));
assertThat(result.get(-3L)).isEqualTo(new FilteredAggregate(2, 2, 7L, 2L, 5L));
assertThat(result).containsEntry(7L, new FilteredAggregate(2, 2, 7L, 3L, 4L));
assertThat(result).containsEntry(-3L, new FilteredAggregate(2, 2, 7L, 2L, 5L));
}

/// A u64 key past 2^63 has no signed-long home, so the kernel declines rather than group it
Expand Down Expand Up @@ -764,7 +764,7 @@ void decimalAggregate_foldsExactlyAtTheColumnScale() {
Map<Object, FilteredAggregate> result = Compute.groupedAggregate(chunk(group, v), G, null, V).orElseThrow();

// Then
assertThat(result.get("a")).isEqualTo(new FilteredAggregate(2, 2, new BigDecimal("3.25"),
assertThat(result).containsEntry("a", new FilteredAggregate(2, 2, new BigDecimal("3.25"),
new BigDecimal("1.25"), new BigDecimal("2.00")));
assertThat(result.get("b").sum()).isEqualTo(new BigDecimal("-0.50"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void zeroMatchingPoolValuesSumToIdentityWithoutScanning() {
Number result = filteredSum(filter, new Predicate.Gt(100L), agg);

// Then the sum is the additive identity
assertThat(result).isEqualTo(0L);
assertThat(result.longValue()).isZero();
assertFusedMatchesReference(filter, new Predicate.Gt(100L), agg);
}

Expand Down Expand Up @@ -244,7 +244,7 @@ void emptyDictSumsToIdentity() {
Number result = filteredSum(filter, new Predicate.Gt(0L), agg);

// Then it is the additive identity
assertThat(result).isEqualTo(0L);
assertThat(result.longValue()).isZero();
assertFusedMatchesReference(filter, new Predicate.Gt(0L), agg);
}

Expand Down
Loading