Paul Rogers created DRILL-6313:

             Summary: ScanBatch.Mutator does not report new schema for empty 
first batch
                 Key: DRILL-6313
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.13.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers
             Fix For: 1.14.0

Create a format plugin that honors an empty select list by returning no 
columns. This case occurs in a {{COUNT(\*)}} query.

When run, the query fails with:

SYSTEM ERROR: IllegalStateException: next() returned OK without first returning 
OK_NEW_SCHEMA [#2, ScanBatch]

The reason is that the {{Mutator}} class uses a flag, {{schemaChanged}}, which 
defaults to {{schemaChanged}}. It is set to {{true}} only when a field is 
added. But, since the query requested no fields, no field is added.

The fix is simple, just default {{schemaChanged}} to {{true}}.

This message was sent by Atlassian JIRA

Reply via email to