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

Function test_alias_with_metadata

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

Source from the content-addressed store, hash-verified

6195
6196#[tokio::test]
6197async fn test_alias_with_metadata() -> Result<()> {
6198 let mut metadata = HashMap::new();
6199 metadata.insert(String::from("k"), String::from("v"));
6200 let metadata = FieldMetadata::from(metadata);
6201 let df = create_test_table("test")
6202 .await?
6203 .select(vec![col("a").alias_with_metadata("b", Some(metadata))])?
6204 .alias("table_alias")?;
6205 let df = df.select(vec![col("table_alias.b")])?;
6206 let schema = df.schema();
6207 let metadata = schema.field(0).metadata();
6208 assert_eq!(metadata.get("k"), Some(&String::from("v")));
6209 Ok(())
6210}
6211
6212// Use alias to perform a self-join
6213// Issue: https://github.com/apache/datafusion/issues/14112

Callers

nothing calls this directly

Calls 8

newFunction · 0.85
create_test_tableFunction · 0.70
insertMethod · 0.45
aliasMethod · 0.45
selectMethod · 0.45
schemaMethod · 0.45
metadataMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…