Skip to content

Commit

Permalink
datafusion: account for empty records
Browse files Browse the repository at this point in the history
  • Loading branch information
casperhart authored and tmontaigu committed Sep 17, 2023
1 parent 110f423 commit 0ceffe6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/datafusion.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{FieldType, FieldValue, Reader, Record};
use crate::{FieldType, FieldValue, Reader};
use async_trait::async_trait;
use datafusion::arrow::array::{
ArrayBuilder, ArrayRef, BooleanBuilder, Date32Builder, Float32Builder, Float64Builder,
Expand Down Expand Up @@ -252,13 +252,15 @@ impl ExecutionPlan for DbaseExec {
.collect();

let records = reader.iter_records();
let mut r: Record;

for (l, record) in records.into_iter().enumerate() {
if l >= self.limit {
break;
}
r = record.ok().unwrap();
let Some(r) = record.ok() else {
continue;
};

for i in 0..self.projections.len() {
match r.get(&dbase_field_names[self.projections[i]]).unwrap() {
FieldValue::Character(c) => match c {
Expand Down

0 comments on commit 0ceffe6

Please sign in to comment.