()
| 34 | /// using the abs() function as our scalar UDF. |
| 35 | #[tokio::test] |
| 36 | async fn test_user_defined_table_function() -> Result<()> { |
| 37 | let module = get_module()?; |
| 38 | let (ctx, codec) = super::utils::ctx_and_codec(); |
| 39 | |
| 40 | let ffi_table_func = (module.create_table_function)(codec); |
| 41 | let foreign_table_func: Arc<dyn TableFunctionImpl> = ffi_table_func.into(); |
| 42 | |
| 43 | ctx.register_udtf("my_range", foreign_table_func); |
| 44 | |
| 45 | let result = ctx |
| 46 | .sql("SELECT * FROM my_range(5)") |
| 47 | .await? |
| 48 | .collect() |
| 49 | .await?; |
| 50 | let expected = create_array!(Int64, [0, 1, 2, 3, 4]) as ArrayRef; |
| 51 | |
| 52 | assert!(result.len() == 1); |
| 53 | assert!(result[0].column(0) == &expected); |
| 54 | |
| 55 | Ok(()) |
| 56 | } |
| 57 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…