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

Method drop_function

datafusion/core/src/execution/context/mod.rs:1508–1532  ·  view source on GitHub ↗
(&self, stmt: DropFunction)

Source from the content-addressed store, hash-verified

1506 }
1507
1508 async fn drop_function(&self, stmt: DropFunction) -> Result<DataFrame> {
1509 // we don't know function type at this point
1510 // decision has been made to drop all functions
1511 let mut dropped = false;
1512 dropped |= self.state.write().deregister_udf(&stmt.name)?.is_some();
1513 dropped |= self.state.write().deregister_udaf(&stmt.name)?.is_some();
1514 dropped |= self.state.write().deregister_udwf(&stmt.name)?.is_some();
1515 dropped |= self.state.write().deregister_udtf(&stmt.name)?.is_some();
1516 dropped |= self
1517 .state
1518 .write()
1519 .deregister_higher_order_function(&stmt.name)?
1520 .is_some();
1521
1522 // DROP FUNCTION IF EXISTS drops the specified function only if that
1523 // function exists and in this way, it avoids error. While the DROP FUNCTION
1524 // statement also performs the same function, it throws an
1525 // error if the function does not exist.
1526
1527 if !stmt.if_exists && !dropped {
1528 exec_err!("Function does not exist")
1529 } else {
1530 self.return_empty_dataframe()
1531 }
1532 }
1533
1534 fn execute_prepared(&self, execute: Execute) -> Result<DataFrame> {
1535 let Execute {

Callers 1

execute_logical_planMethod · 0.80

Calls 7

deregister_udfMethod · 0.45
writeMethod · 0.45
deregister_udafMethod · 0.45
deregister_udwfMethod · 0.45
deregister_udtfMethod · 0.45

Tested by

no test coverage detected