use of org.apache.iceberg.expressions.InclusiveMetricsEvaluator in project iceberg by apache.
the class TestNotStartsWith method testInclusiveMetricsEvaluatorForNotStartsWith.
@Test
public void testInclusiveMetricsEvaluatorForNotStartsWith() {
boolean shouldRead = new InclusiveMetricsEvaluator(SCHEMA, notStartsWith(COLUMN, "aaa")).eval(FILE_1);
Assert.assertTrue("Should match: some columns meet the filter criteria", shouldRead);
shouldRead = new InclusiveMetricsEvaluator(SCHEMA, notStartsWith(COLUMN, "b")).eval(FILE_1);
Assert.assertFalse("Should not match: no columns match the filter criteria", shouldRead);
shouldRead = new InclusiveMetricsEvaluator(SCHEMA, notStartsWith(COLUMN, "bb")).eval(FILE_1);
Assert.assertFalse("Should not match: no columns match the filter criteria", shouldRead);
shouldRead = new InclusiveMetricsEvaluator(SCHEMA, notStartsWith(COLUMN, "bbb")).eval(FILE_1);
Assert.assertFalse("Should not match: no columns match the filter criteria", shouldRead);
shouldRead = new InclusiveMetricsEvaluator(SCHEMA, notStartsWith(COLUMN, "bbbb")).eval(FILE_1);
Assert.assertTrue("Should match: some columns match the filter criteria", shouldRead);
}
use of org.apache.iceberg.expressions.InclusiveMetricsEvaluator in project iceberg by apache.
the class ManifestReader method entries.
CloseableIterable<ManifestEntry<F>> entries() {
if ((rowFilter != null && rowFilter != Expressions.alwaysTrue()) || (partFilter != null && partFilter != Expressions.alwaysTrue()) || (partitionSet != null)) {
Evaluator evaluator = evaluator();
InclusiveMetricsEvaluator metricsEvaluator = metricsEvaluator();
// ensure stats columns are present for metrics evaluation
boolean requireStatsProjection = requireStatsProjection(rowFilter, columns);
Collection<String> projectColumns = requireStatsProjection ? withStatsColumns(columns) : columns;
return CloseableIterable.filter(open(projection(fileSchema, fileProjection, projectColumns, caseSensitive)), entry -> entry != null && evaluator.eval(entry.file().partition()) && metricsEvaluator.eval(entry.file()) && inPartitionSet(entry.file()));
} else {
return open(projection(fileSchema, fileProjection, columns, caseSensitive));
}
}
Aggregations