Skip to content

Commit dd2b8b2

Browse files
nikhilsinhaparseablenitishtde-sh
authored
fix: skip null data type fields (#1016)
skip the schema generation with `Null` data type fields fixes the issue when first event has null data type and field has valid data after the initial schema is persisted fixes the schema merge issue for such cases --------- Signed-off-by: Nitish Tiwari <[email protected]> Co-authored-by: Nitish Tiwari <[email protected]> Co-authored-by: Devdutt Shenoi <[email protected]>
1 parent 0353dc4 commit dd2b8b2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/event/format/json.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl EventFormat for Event {
8686
infer_schema
8787
.fields
8888
.iter()
89+
.filter(|field| !field.data_type().is_null())
8990
.cloned()
9091
.sorted_by(|a, b| a.name().cmp(b.name()))
9192
.collect()

src/handlers/http/ingest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ mod tests {
384384
let (rb, _) = into_event_batch(req, json, HashMap::default(), None, None).unwrap();
385385

386386
assert_eq!(rb.num_rows(), 1);
387-
assert_eq!(rb.num_columns(), 6);
387+
assert_eq!(rb.num_columns(), 5);
388388
assert_eq!(
389389
rb.column_by_name("a").unwrap().as_int64_arr(),
390390
&Int64Array::from_iter([1])

0 commit comments

Comments
 (0)