org.apache.parquet.filter2.predicate.Operators.BooleanColumn Java Examples
The following examples show how to use
org.apache.parquet.filter2.predicate.Operators.BooleanColumn.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static BooleanColumn booleanColumn(String columnPath) { return new BooleanColumn(ColumnPath.fromDotString(columnPath)); }
Example #2
Source File: TestColumnIndexBuilder.java From parquet-mr with Apache License 2.0 | 4 votes |
@Test public void testBuildBoolean() { PrimitiveType type = Types.required(BOOLEAN).named("test_boolean"); ColumnIndexBuilder builder = ColumnIndexBuilder.getBuilder(type, Integer.MAX_VALUE); assertThat(builder, instanceOf(BooleanColumnIndexBuilder.class)); assertNull(builder.build()); BooleanColumn col = booleanColumn("test_col"); builder = ColumnIndexBuilder.getBuilder(type, Integer.MAX_VALUE); StatsBuilder sb = new StatsBuilder(); builder.add(sb.stats(type, false, true)); builder.add(sb.stats(type, true, false, null)); builder.add(sb.stats(type, true, true, null, null)); builder.add(sb.stats(type, null, null, null)); builder.add(sb.stats(type, false, false)); assertEquals(5, builder.getPageCount()); assertEquals(sb.getMinMaxSize(), builder.getMinMaxSize()); ColumnIndex columnIndex = builder.build(); assertEquals(BoundaryOrder.UNORDERED, columnIndex.getBoundaryOrder()); assertCorrectNullCounts(columnIndex, 0, 1, 2, 3, 0); assertCorrectNullPages(columnIndex, false, false, false, true, false); assertCorrectValues(columnIndex.getMaxValues(), true, true, true, null, false); assertCorrectValues(columnIndex.getMinValues(), false, false, true, null, false); assertCorrectFiltering(columnIndex, eq(col, true), 0, 1, 2); assertCorrectFiltering(columnIndex, eq(col, null), 1, 2, 3); assertCorrectFiltering(columnIndex, notEq(col, true), 0, 1, 2, 3, 4); assertCorrectFiltering(columnIndex, notEq(col, null), 0, 1, 2, 4); assertCorrectFiltering(columnIndex, userDefined(col, BooleanIsTrueOrNull.class), 0, 1, 2, 3); assertCorrectFiltering(columnIndex, invert(userDefined(col, BooleanIsTrueOrNull.class)), 0, 1, 4); builder = ColumnIndexBuilder.getBuilder(type, Integer.MAX_VALUE); sb = new StatsBuilder(); builder.add(sb.stats(type, null, null)); builder.add(sb.stats(type, false, false)); builder.add(sb.stats(type, null, null, null)); builder.add(sb.stats(type, null, null, null, null)); builder.add(sb.stats(type, false, true, null)); builder.add(sb.stats(type, false, true, null, null)); builder.add(sb.stats(type, null, null, null)); assertEquals(7, builder.getPageCount()); assertEquals(sb.getMinMaxSize(), builder.getMinMaxSize()); columnIndex = builder.build(); assertEquals(BoundaryOrder.ASCENDING, columnIndex.getBoundaryOrder()); assertCorrectNullCounts(columnIndex, 2, 0, 3, 4, 1, 2, 3); assertCorrectNullPages(columnIndex, true, false, true, true, false, false, true); assertCorrectValues(columnIndex.getMaxValues(), null, false, null, null, true, true, null); assertCorrectValues(columnIndex.getMinValues(), null, false, null, null, false, false, null); assertCorrectFiltering(columnIndex, eq(col, true), 4, 5); assertCorrectFiltering(columnIndex, eq(col, null), 0, 2, 3, 4, 5, 6); assertCorrectFiltering(columnIndex, notEq(col, true), 0, 1, 2, 3, 4, 5, 6); assertCorrectFiltering(columnIndex, notEq(col, null), 1, 4, 5); assertCorrectFiltering(columnIndex, userDefined(col, BooleanIsTrueOrNull.class), 0, 2, 3, 4, 5, 6); assertCorrectFiltering(columnIndex, invert(userDefined(col, BooleanIsTrueOrNull.class)), 1, 4, 5); builder = ColumnIndexBuilder.getBuilder(type, Integer.MAX_VALUE); sb = new StatsBuilder(); builder.add(sb.stats(type, null, null)); builder.add(sb.stats(type, true, true)); builder.add(sb.stats(type, null, null, null)); builder.add(sb.stats(type, null, null, null, null)); builder.add(sb.stats(type, true, false, null)); builder.add(sb.stats(type, false, false, null, null)); builder.add(sb.stats(type, null, null, null)); assertEquals(7, builder.getPageCount()); assertEquals(sb.getMinMaxSize(), builder.getMinMaxSize()); columnIndex = builder.build(); assertEquals(BoundaryOrder.DESCENDING, columnIndex.getBoundaryOrder()); assertCorrectNullCounts(columnIndex, 2, 0, 3, 4, 1, 2, 3); assertCorrectNullPages(columnIndex, true, false, true, true, false, false, true); assertCorrectValues(columnIndex.getMaxValues(), null, true, null, null, true, false, null); assertCorrectValues(columnIndex.getMinValues(), null, true, null, null, false, false, null); assertCorrectFiltering(columnIndex, eq(col, true), 1, 4); assertCorrectFiltering(columnIndex, eq(col, null), 0, 2, 3, 4, 5, 6); assertCorrectFiltering(columnIndex, notEq(col, true), 0, 2, 3, 4, 5, 6); assertCorrectFiltering(columnIndex, notEq(col, null), 1, 4, 5); assertCorrectFiltering(columnIndex, userDefined(col, BooleanIsTrueOrNull.class), 0, 1, 2, 3, 4, 5, 6); assertCorrectFiltering(columnIndex, invert(userDefined(col, BooleanIsTrueOrNull.class)), 4, 5); }