(&self, stmt: CreateFunction)
| 1472 | } |
| 1473 | |
| 1474 | async fn create_function(&self, stmt: CreateFunction) -> Result<DataFrame> { |
| 1475 | let function = { |
| 1476 | let state = self.state.read().clone(); |
| 1477 | let function_factory = state.function_factory(); |
| 1478 | |
| 1479 | match function_factory { |
| 1480 | Some(f) => f.create(&state, stmt).await?, |
| 1481 | _ => { |
| 1482 | return Err(DataFusionError::Configuration( |
| 1483 | "Function factory has not been configured".to_string(), |
| 1484 | )); |
| 1485 | } |
| 1486 | } |
| 1487 | }; |
| 1488 | |
| 1489 | match function { |
| 1490 | RegisterFunction::Scalar(f) => { |
| 1491 | self.state.write().register_udf(f)?; |
| 1492 | } |
| 1493 | RegisterFunction::Aggregate(f) => { |
| 1494 | self.state.write().register_udaf(f)?; |
| 1495 | } |
| 1496 | RegisterFunction::Window(f) => { |
| 1497 | self.state.write().register_udwf(f)?; |
| 1498 | } |
| 1499 | RegisterFunction::HigherOrder(f) => { |
| 1500 | self.state.write().register_higher_order_function(f)?; |
| 1501 | } |
| 1502 | RegisterFunction::Table(name, f) => self.register_udtf(&name, f), |
| 1503 | }; |
| 1504 | |
| 1505 | self.return_empty_dataframe() |
| 1506 | } |
| 1507 | |
| 1508 | async fn drop_function(&self, stmt: DropFunction) -> Result<DataFrame> { |
| 1509 | // we don't know function type at this point |
no test coverage detected