Skip to content
Permalink
Browse files
DRILL-6622: Fixed a NullPointerException in a query with Union
closes #1391
  • Loading branch information
sachouche authored and Ben-Zvi committed Jul 23, 2018
1 parent 2162986 commit c58735a04e0ad6dcff15ee35bbbc27bdd7a14aef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
@@ -114,8 +114,13 @@ private class HashAggMemoryManager extends RecordBatchMemoryManager {

@Override
public void update() {
update(incoming);
}

@Override
public void update(RecordBatch incomingRecordBatch) {
// Get sizing information for the batch.
setRecordBatchSizer(new RecordBatchSizer(incoming));
setRecordBatchSizer(new RecordBatchSizer(incomingRecordBatch));

int fieldId = 0;
int newOutgoingRowWidth = 0;
@@ -584,6 +584,11 @@ public AggOutcome doWork() {
currentBatchRecordCount = incoming.getRecordCount(); // initialize for first non empty batch
// Calculate the number of partitions based on actual incoming data
delayedSetup();
// Update the record batch manager since this is the first batch with data; we need to
// perform the update before any processing.
// NOTE - We pass the incoming record batch explicitly because it could be a spilled record (different
// from the instance owned by the HashAggBatch).
outgoing.getRecordBatchMemoryManager().update(incoming);
}

//
@@ -666,7 +671,9 @@ public AggOutcome doWork() {
// remember EMIT, but continue like handling OK

case OK:
outgoing.getRecordBatchMemoryManager().update();
// NOTE - We pass the incoming record batch explicitly because it could be a spilled record (different
// from the instance owned by the HashAggBatch).
outgoing.getRecordBatchMemoryManager().update(incoming);

currentBatchRecordCount = incoming.getRecordCount(); // size of next batch

@@ -154,6 +154,9 @@ public void update(int inputIndex) {

public void update() {};

public void update(RecordBatch recordBatch) {
}

public void update(RecordBatch recordBatch, int index) {
// Get sizing information for the batch.
setRecordBatchSizer(index, new RecordBatchSizer(recordBatch));

0 comments on commit c58735a

Please sign in to comment.