This is an automated email from the ASF dual-hosted git repository. cgivre pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push: new 807138d085 DRILL-8392: Empty Tables Causes Index Out of Bounds Exception on PDF Reader (#2744) 807138d085 is described below commit 807138d085106ba0b97489a55fe9a4c57854f032 Author: Charles S. Givre <cgi...@apache.org> AuthorDate: Wed Jan 25 08:54:29 2023 -0500 DRILL-8392: Empty Tables Causes Index Out of Bounds Exception on PDF Reader (#2744) --- .../java/org/apache/drill/exec/store/pdf/PdfBatchReader.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/format-pdf/src/main/java/org/apache/drill/exec/store/pdf/PdfBatchReader.java b/contrib/format-pdf/src/main/java/org/apache/drill/exec/store/pdf/PdfBatchReader.java index 26d3a94c9f..05dd3b4a52 100644 --- a/contrib/format-pdf/src/main/java/org/apache/drill/exec/store/pdf/PdfBatchReader.java +++ b/contrib/format-pdf/src/main/java/org/apache/drill/exec/store/pdf/PdfBatchReader.java @@ -218,8 +218,16 @@ public class PdfBatchReader implements ManagedReader { if (!Strings.isNullOrEmpty(value)) { writers.get(rowPosition).load(row.get(rowPosition)); + + // If there is not a provided schema, advance the row position index only when values are found + if (negotiator.providedSchema() == null) { + rowPosition++; + } + } + // Advance the row position index when there is a provided schema. + if (negotiator.providedSchema() != null) { + rowPosition++; } - rowPosition++; } metadataReader.writeMetadata();