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

Function join_coercion_unnamed

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

Source from the content-addressed store, hash-verified

1496
1497#[tokio::test]
1498async fn join_coercion_unnamed() -> Result<()> {
1499 let ctx = SessionContext::new();
1500
1501 // Test that join will coerce column types when necessary
1502 // even when the relations don't have unique names
1503 let left = ctx.read_batch(record_batch!(
1504 ("id", Int32, [1, 2, 3]),
1505 ("name", Utf8, ["a", "b", "c"])
1506 )?)?;
1507 let right = ctx.read_batch(record_batch!(
1508 ("id", Int32, [10, 3]),
1509 ("name", Utf8View, ["d", "c"]) // Utf8View is a different type
1510 )?)?;
1511 let cols = vec!["name", "id"];
1512
1513 let filter = None;
1514 let join = right.join(left, JoinType::LeftAnti, &cols, &cols, filter)?;
1515 let results = join.collect().await?;
1516
1517 assert_snapshot!(
1518 batches_to_sort_string(&results),
1519 @r"
1520 +----+------+
1521 | id | name |
1522 +----+------+
1523 | 10 | d |
1524 +----+------+
1525 "
1526 );
1527 Ok(())
1528}
1529
1530#[tokio::test]
1531async fn join_on() -> Result<()> {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
read_batchMethod · 0.80
collectMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…