-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rust, python): add streamable udfs
- Loading branch information
Showing
10 changed files
with
128 additions
and
44 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
polars/polars-lazy/polars-pipe/src/executors/operators/function.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use polars_core::error::PolarsResult; | ||
use polars_plan::prelude::*; | ||
|
||
use crate::operators::{DataChunk, Operator, OperatorResult, PExecutionContext}; | ||
|
||
#[derive(Clone)] | ||
pub struct FunctionOperator { | ||
pub(crate) function: FunctionNode, | ||
} | ||
|
||
impl Operator for FunctionOperator { | ||
fn execute( | ||
&mut self, | ||
_context: &PExecutionContext, | ||
chunk: &DataChunk, | ||
) -> PolarsResult<OperatorResult> { | ||
Ok(OperatorResult::Finished( | ||
chunk.with_data(self.function.evaluate(chunk.data.clone())?), | ||
)) | ||
} | ||
|
||
fn split(&self, _thread_no: usize) -> Box<dyn Operator> { | ||
Box::new(self.clone()) | ||
} | ||
|
||
fn fmt(&self) -> &str { | ||
"function" | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
polars/polars-lazy/polars-pipe/src/executors/operators/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
mod dummy; | ||
mod filter; | ||
mod function; | ||
mod placeholder; | ||
mod projection; | ||
|
||
pub(crate) use dummy::PlaceHolder; | ||
pub(crate) use filter::*; | ||
pub(crate) use function::*; | ||
pub(crate) use placeholder::PlaceHolder; | ||
pub(crate) use projection::*; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters