arrow_graph/sql/
extension.rs1use datafusion::execution::context::SessionContext;
2use crate::error::Result;
3use crate::sql::graph_functions::register_all_graph_functions;
4use crate::sql::window_functions::register_window_functions;
5
6pub struct GraphSqlExtension;
7
8impl GraphSqlExtension {
9 pub fn new() -> Self {
10 Self
11 }
12
13 pub fn register_functions(&self, ctx: &mut SessionContext) -> Result<()> {
15 register_all_graph_functions(ctx)
17 .map_err(|e| crate::error::GraphError::algorithm(format!("Failed to register graph functions: {}", e)))?;
18
19 register_window_functions(ctx)
21 .map_err(|e| crate::error::GraphError::algorithm(format!("Failed to register window functions: {}", e)))?;
22
23 Ok(())
24 }
25}
26
27impl Default for GraphSqlExtension {
28 fn default() -> Self {
29 Self::new()
30 }
31}