Skip to content

Commit 0e15f0e

Browse files
author
Devdutt Shenoi
committed
test: revert to dd2b8b2
1 parent e58cf12 commit 0e15f0e

File tree

2 files changed

+82
-10
lines changed

2 files changed

+82
-10
lines changed

.github/workflows/coverage.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ jobs:
2828
with:
2929
tool: cargo-hack, cargo-llvm-cov, nextest
3030

31-
- name: Check with clippy
32-
run: cargo hack clippy --verbose --each-feature --no-dev-deps -- -D warnings
33-
34-
- name: Check docs
35-
run: cargo hack doc --verbose --no-deps --each-feature --no-dev-deps
36-
37-
- name: Doctests
38-
run: cargo hack --each-feature test --doc
39-
4031
- name: Tests
4132
run: cargo hack --each-feature llvm-cov --no-report nextest
4233

src/handlers/http/ingest.rs

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ mod tests {
273273
use std::{collections::HashMap, sync::Arc};
274274

275275
use actix_web::test::TestRequest;
276-
use arrow_array::{ArrayRef, Float64Array, Int64Array, StringArray};
276+
use arrow::datatypes::Int64Type;
277+
use arrow_array::{ArrayRef, Float64Array, Int64Array, ListArray, StringArray};
277278
use arrow_schema::{DataType, Field};
278279
use serde_json::json;
279280

@@ -718,6 +719,86 @@ mod tests {
718719
])
719720
);
720721

722+
assert_eq!(
723+
rb.column_by_name("c_a")
724+
.unwrap()
725+
.as_any()
726+
.downcast_ref::<ListArray>()
727+
.unwrap(),
728+
&ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
729+
None,
730+
None,
731+
Some(vec![Some(1i64)]),
732+
Some(vec![Some(1)])
733+
])
734+
);
735+
736+
assert_eq!(
737+
rb.column_by_name("c_b")
738+
.unwrap()
739+
.as_any()
740+
.downcast_ref::<ListArray>()
741+
.unwrap(),
742+
&ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
743+
None,
744+
None,
745+
None,
746+
Some(vec![Some(2i64)])
747+
])
748+
);
749+
}
750+
751+
#[test]
752+
fn arr_obj_with_nested_type_v1() {
753+
let json = json!([
754+
{
755+
"a": 1,
756+
"b": "hello",
757+
},
758+
{
759+
"a": 1,
760+
"b": "hello",
761+
},
762+
{
763+
"a": 1,
764+
"b": "hello",
765+
"c": [{"a": 1}]
766+
},
767+
{
768+
"a": 1,
769+
"b": "hello",
770+
"c": [{"a": 1, "b": 2}]
771+
},
772+
]);
773+
774+
let req = TestRequest::default().to_http_request();
775+
776+
let (rb, _) = into_event_batch(
777+
&req,
778+
&json,
779+
HashMap::default(),
780+
None,
781+
None,
782+
SchemaVersion::V1,
783+
)
784+
.unwrap();
785+
786+
assert_eq!(rb.num_rows(), 4);
787+
assert_eq!(rb.num_columns(), 7);
788+
assert_eq!(
789+
rb.column_by_name("a").unwrap().as_int64_arr().unwrap(),
790+
&Int64Array::from(vec![Some(1), Some(1), Some(1), Some(1)])
791+
);
792+
assert_eq!(
793+
rb.column_by_name("b").unwrap().as_utf8_arr().unwrap(),
794+
&StringArray::from(vec![
795+
Some("hello"),
796+
Some("hello"),
797+
Some("hello"),
798+
Some("hello")
799+
])
800+
);
801+
721802
assert_eq!(
722803
rb.column_by_name("c_a").unwrap().as_int64_arr().unwrap(),
723804
&Int64Array::from(vec![None, None, Some(1), Some(1)])

0 commit comments

Comments
 (0)