Github user ppadma commented on a diff in the pull request: https://github.com/apache/drill/pull/1107#discussion_r167380761 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/spill/RecordBatchSizer.java --- @@ -311,8 +311,8 @@ public static ColumnSize getColumn(ValueVector v, String prefix) { public RecordBatchSizer(RecordBatch batch) { this(batch, - (batch.getSchema().getSelectionVectorMode() == BatchSchema.SelectionVectorMode.TWO_BYTE) ? - batch.getSelectionVector2() : null); + (batch.getSchema() == null ? null : (batch.getSchema().getSelectionVectorMode() == BatchSchema.SelectionVectorMode.TWO_BYTE ? --- End diff -- yes, we can get empty batches with empty schema and I think it makes sense to add the check here instead of calling code. That way, it be transparently handled underneath.
---