Skip to content
Merged
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 @@ -129,9 +129,9 @@ public class TestInclusiveMetricsEvaluator {
Row.of(),
50,
// any value counts, including nulls
ImmutableMap.of(3, 20L),
ImmutableMap.of(3, 50L),
// null value counts
ImmutableMap.of(3, 2L),
ImmutableMap.of(3, 0L),
// nan value counts
null,
// lower bounds
Expand All @@ -145,9 +145,9 @@ public class TestInclusiveMetricsEvaluator {
Row.of(),
50,
// any value counts, including nulls
ImmutableMap.of(3, 20L),
ImmutableMap.of(3, 50L),
// null value counts
ImmutableMap.of(3, 2L),
ImmutableMap.of(3, 0L),
// nan value counts
null,
// lower bounds
Expand All @@ -161,16 +161,32 @@ public class TestInclusiveMetricsEvaluator {
Row.of(),
50,
// any value counts, including nulls
ImmutableMap.of(3, 20L),
ImmutableMap.of(3, 50L),
// null value counts
ImmutableMap.of(3, 2L),
ImmutableMap.of(3, 0L),
// nan value counts
null,
// lower bounds
ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc")),
// upper bounds
ImmutableMap.of(3, toByteBuffer(StringType.get(), "イロハニホヘト")));

private static final DataFile FILE_5 =
new TestDataFile(
"file_4.avro",
Row.of(),
50,
// any value counts, including nulls
ImmutableMap.of(3, 50L),
// null value counts
ImmutableMap.of(3, 0L),
// nan value counts
null,
// lower bounds
ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc")),
// upper bounds
ImmutableMap.of(3, toByteBuffer(StringType.get(), "abcdefghi")));

@Test
public void testAllNulls() {
boolean shouldRead = new InclusiveMetricsEvaluator(SCHEMA, notNull("all_nulls")).eval(FILE);
Expand Down Expand Up @@ -731,6 +747,14 @@ public void testStringNotStartsWith() {
new InclusiveMetricsEvaluator(SCHEMA, notStartsWith("required", aboveMax), true)
.eval(FILE_4);
assertThat(shouldRead).as("Should read: range matches").isTrue();

shouldRead =
new InclusiveMetricsEvaluator(SCHEMA, notStartsWith("required", "abc"), true).eval(FILE_5);
assertThat(shouldRead).as("Should not read: all strings start with prefix").isFalse();

shouldRead =
new InclusiveMetricsEvaluator(SCHEMA, notStartsWith("required", "abcd"), true).eval(FILE_5);
assertThat(shouldRead).as("Should not read: lower shorter than prefix, cannot match").isTrue();
}

@Test
Expand Down