You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Paul Rogers (Jira)" <ji...@apache.org> on 2019/11/30 03:11:00 UTC

[jira] [Resolved] (DRILL-7303) Filter record batch does not handle zero-length batches

     [ https://issues.apache.org/jira/browse/DRILL-7303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Rogers resolved DRILL-7303.
--------------------------------
    Resolution: Duplicate

> Filter record batch does not handle zero-length batches
> -------------------------------------------------------
>
>                 Key: DRILL-7303
>                 URL: https://issues.apache.org/jira/browse/DRILL-7303
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.16.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Major
>
> Testing of the row-set-based JSON reader revealed a limitation of the Filter record batch: if an incoming batch has zero records, the length of the associated SV2 is left at -1. In particular:
> {code:java}
> public class SelectionVector2 implements AutoCloseable {
>   // Indicates actual number of rows in the RecordBatch
>   // container which owns this SV2 instance
>   private int batchActualRecordCount = -1;
> {code}
> Then:
> {code:java}
> public abstract class FilterTemplate2 implements Filterer {
>   @Override
>   public void filterBatch(int recordCount) throws SchemaChangeException{
>     if (recordCount == 0) {
>       outgoingSelectionVector.setRecordCount(0);
>       return;
>     }
> {code}
> Notice there is no call to set the actual record count. The solution is to insert one line of code:
> {code:java}
>     if (recordCount == 0) {
>       outgoingSelectionVector.setRecordCount(0);
>       outgoingSelectionVector.setBatchActualRecordCount(0); // <-- Add this
>       return;
>     }
> {code}
> Without this, the query fails with an error due to an invalid index of -1.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)