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

Function test_fill_null

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

Source from the content-addressed store, hash-verified

6455
6456#[tokio::test]
6457async fn test_fill_null() -> Result<()> {
6458 let df = create_null_table().await?;
6459
6460 // Use fill_null to replace nulls on each column.
6461 let df_filled = df
6462 .fill_null(ScalarValue::Int32(Some(0)), vec!["a".to_string()])?
6463 .fill_null(
6464 ScalarValue::Utf8(Some("default".to_string())),
6465 vec!["b".to_string()],
6466 )?;
6467
6468 let results = df_filled.collect().await?;
6469 assert_snapshot!(
6470 batches_to_sort_string(&results),
6471 @r"
6472 +---+---------+
6473 | a | b |
6474 +---+---------+
6475 | 0 | default |
6476 | 1 | x |
6477 | 3 | z |
6478 +---+---------+
6479 "
6480 );
6481
6482 Ok(())
6483}
6484
6485#[tokio::test]
6486async fn test_fill_null_all_columns() -> Result<()> {

Callers

nothing calls this directly

Calls 4

create_null_tableFunction · 0.85
fill_nullMethod · 0.80
collectMethod · 0.80
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…