Skip to content

Commit

Permalink
wrap up
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 19, 2023
1 parent 6814944 commit b2b9a92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/user-guide/expressions/plugins.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Expression plugins

Expression plugins are the preferred way to create user defined functions. They allow you to compile a rust function
and register as an expression into the polars library. The polars engine will dynamically link your function at runtime
and register that as an expression into the polars library. The polars engine will dynamically link your function at runtime
and your expression will run almost as fast as native expressions. Note that this works without any interference of python
and thus no GIL contention.

Expand All @@ -11,7 +11,7 @@ They will benefit from the same benefits default expression have:
- Parallelism
- Rust native performance

To get started we will see what is needed to create a custom expresison.
To get started we will see what is needed to create a custom expression.

## Our first custom expression: Pig Latin

Expand Down Expand Up @@ -222,8 +222,10 @@ fn haversine(inputs: &[Series]) -> PolarsResult<Series> {
crate::distances::naive_haversine(start_lat, start_long, end_lat, end_long)?
.into_series()
}
_ => unimplemented!(),
_ => polars_bail!(InvalidOperation: "only supported for float types"),
};
Ok(out)
}
```

That's all you need to know to get started. Take a look at <examples link> to see how this all fits together.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ nav:
- user-guide/expressions/window.md
- user-guide/expressions/folds.md
- user-guide/expressions/lists.md
- user-guide/expressions/plugins.md
- user-guide/expressions/user-defined-functions.md
- user-guide/expressions/structs.md
- user-guide/expressions/numpy.md
Expand Down

0 comments on commit b2b9a92

Please sign in to comment.