MCPcopy Create free account
hub / github.com/apache/datafusion / unnest_non_nullable_list

Function unnest_non_nullable_list

datafusion/core/tests/dataframe/mod.rs:4915–4948  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4913/// Test unnesting a non-nullable list.
4914#[tokio::test]
4915async fn unnest_non_nullable_list() -> Result<()> {
4916 let list_array = ListArray::from_iter_primitive::<Int32Type, _, _>(vec![
4917 Some(vec![Some(1), Some(2)]),
4918 Some(vec![None]),
4919 ]);
4920 let schema = Arc::new(Schema::new(vec![Field::new(
4921 "c1",
4922 DataType::new_list(DataType::Int32, true),
4923 false,
4924 )]));
4925
4926 let batch = RecordBatch::try_new(schema, vec![Arc::new(list_array)])?;
4927 let ctx = SessionContext::new();
4928 let results = ctx
4929 .read_batches(vec![batch])?
4930 .unnest_columns(&["c1"])?
4931 .collect()
4932 .await?;
4933
4934 assert_snapshot!(
4935 batches_to_string(&results),
4936 @r"
4937 +----+
4938 | c1 |
4939 +----+
4940 | 1 |
4941 | 2 |
4942 | |
4943 +----+
4944 "
4945 );
4946
4947 Ok(())
4948}
4949
4950#[tokio::test]
4951async fn test_read_batches() -> Result<()> {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
collectMethod · 0.80
unnest_columnsMethod · 0.80
read_batchesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…