Skip to content
Draft
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 @@ -122,7 +122,7 @@ public ColumnWriter getColumnWriter(ColumnDescriptor path) {
}
this.columns = unmodifiableMap(mcolumns);

this.rowCountForNextSizeCheck = props.getMinRowCountForPageSizeCheck();
this.rowCountForNextSizeCheck = min(props.getMinRowCountForPageSizeCheck(), props.getPageRowCountLimit());

columnWriterProvider = new ColumnWriterProvider() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public void testSplitsOversizedFilteredPageIntoBoundedVectoredRanges() throws Ex

@Test
public void testSplitsAdjacentFilteredPageRangesAtMaximumAllocation() throws Exception {
int maximumAllocation = 1416;
int maximumAllocation = 1774;
RecordingAllocator allocator = new RecordingAllocator();
RecordingSeekableInputStream stream = newStream(FailureMode.NONE);
FilterPredicate predicate = or(ltEq(intColumn("id"), 99), gtEq(intColumn("id"), 120));
Expand Down Expand Up @@ -708,14 +708,14 @@ private static ParquetReadOptions readOptions(
.withMaxAllocationInBytes(maximumAllocation);
if (filterPages) {
FilterPredicate predicate =
or(ltEq(intColumn("id"), 99), and(gtEq(intColumn("id"), 108), ltEq(intColumn("id"), 115)));
or(ltEq(intColumn("id"), 95), and(gtEq(intColumn("id"), 104), ltEq(intColumn("id"), 111)));
builder.useColumnIndexFilter(true).withRecordFilter(FilterCompat.get(predicate));
}
return builder.build();
}

private static void assertRows(PageReadStore pages, MessageType projection, boolean filtered) {
assertRows(pages, projection, filtered, filtered ? 108 : ROW_COUNT);
assertRows(pages, projection, filtered, filtered ? 104 : ROW_COUNT);
}

private static void assertRows(PageReadStore pages, MessageType projection, boolean filtered, long expectedRows) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -354,6 +355,34 @@ public void testNullValuesWithPageRowLimit() throws IOException {
}
}

@Test
public void testPageRowCountLimitAppliesToFirstPage() throws IOException {
MessageType schema = Types.buildMessage().required(INT32).named("id").named("msg");
GroupFactory factory = new SimpleGroupFactory(schema);

Path path = newTempPath();
try (ParquetWriter<Group> writer = ExampleParquetWriter.builder(path)
.withAllocator(allocator)
.withType(schema)
.withPageRowCountLimit(10)
.withDictionaryEncoding(false)
.build()) {
for (int i = 0; i < 100; ++i) {
writer.write(factory.newGroup().append("id", i));
}
}

try (ParquetFileReader reader = ParquetFileReader.open(HadoopInputFile.fromPath(path, new Configuration()))) {
PageReader pageReader =
reader.readNextRowGroup().getPageReader(schema.getColumns().get(0));
List<Integer> pageRowCounts = new ArrayList<>();
for (DataPage page = pageReader.readPage(); page != null; page = pageReader.readPage()) {
pageRowCounts.add(page.getValueCount());
}
assertThat(pageRowCounts).containsExactly(10, 10, 10, 10, 10, 10, 10, 10, 10, 10);
}
}

@Test
public void testParquetFileWithBloomFilter() throws IOException {
MessageType schema = Types.buildMessage()
Expand Down