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

Function test_create_physical_expr_nvl2

datafusion/core/tests/expr_api/mod.rs:324–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

322
323#[test]
324fn test_create_physical_expr_nvl2() {
325 let batch = &TEST_BATCH;
326 let df_schema = DFSchema::try_from(batch.schema()).unwrap();
327 let ctx = SessionContext::new();
328
329 let expect_err = |expr| {
330 let physical_expr = ctx.create_physical_expr(expr, &df_schema).unwrap();
331 let err = physical_expr.evaluate(batch).unwrap_err();
332 assert!(
333 err.to_string()
334 .contains("nvl2 should have been simplified to case"),
335 "unexpected error: {err:?}"
336 );
337 };
338
339 expect_err(nvl2(col("i"), lit(1i64), lit(0i64)));
340 expect_err(nvl2(lit(1i64), col("i"), lit(0i64)));
341}
342
343#[tokio::test]
344async fn test_create_physical_expr_coercion() {

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
unwrap_errMethod · 0.80
colFunction · 0.50
litFunction · 0.50
schemaMethod · 0.45
create_physical_exprMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…