aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAbhishek Ravi <abhi.ravi@gmail.com>2019-01-04 00:04:32 -0800
committerSorabh Hamirwasia <sorabh@apache.org>2019-01-10 10:30:08 -0800
commit4b66226dc7e33d9173e6e714d5cf85beea1e4e46 (patch)
tree4ad70dd3c862421f7fc00c06009824b30cfaeb89 /contrib
parentfc1eacda8b181934eea811e5f228fff697f94549 (diff)
DRILL-6918: Skip ensureAtLeastOneField when there are no records
If none of the project / filter columns, exist in the vector, ensureAtLeastOneField (or the Scan operator) adds at least one field as nullable integer (or nullable varchar if `allTextmode` is enabled). The downstream Filter operator would then go on to fail with `NumberFormatException` because it tries to convert empty fields to integers. Since ensureAtLeastOneField is called after reading all the messages in a batch, it can be skipped if the batch is empty. closes #1595
Diffstat (limited to 'contrib')
-rw-r--r--contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaRecordReader.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaRecordReader.java b/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaRecordReader.java
index 9559c3d8c..62e588ce2 100644
--- a/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaRecordReader.java
+++ b/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaRecordReader.java
@@ -119,7 +119,9 @@ public class KafkaRecordReader extends AbstractRecordReader {
}
}
- messageReader.ensureAtLeastOneField();
+ if (currentMessageCount > 0) {
+ messageReader.ensureAtLeastOneField();
+ }
writer.setValueCount(currentMessageCount);
logger.debug("Took {} ms to process {} records.", watch.elapsed(TimeUnit.MILLISECONDS), currentMessageCount);
logger.debug("Last offset consumed for {}:{} is {}", subScanSpec.getTopicName(), subScanSpec.getPartitionId(),