You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2025/05/30 17:17:33 UTC
Re: [PR] minor: Refactor PhysicalPlanner::default() to avoid duplicate code [datafusion-comet]
andygrove commented on code in PR #1821:
URL: https://github.com/apache/datafusion-comet/pull/1821#discussion_r2116291551
##########
native/core/src/execution/planner.rs:
##########
@@ -146,15 +146,7 @@ pub struct PhysicalPlanner {
impl Default for PhysicalPlanner {
fn default() -> Self {
- let session_ctx = Arc::new(SessionContext::new());
-
- // register UDFs from datafusion-spark crate
- session_ctx.register_udf(ScalarUDF::new_from_impl(SparkExpm1::default()));
-
- Self {
- exec_context_id: TEST_EXEC_CONTEXT_ID,
- session_ctx,
- }
+ Self::new(Arc::new(SessionContext::new()))
Review Comment:
Note that `Self::new` will register the UDF:
```rust
pub fn new(session_ctx: Arc<SessionContext>) -> Self {
// register UDFs from datafusion-spark crate
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkExpm1::default()));
Self {
exec_context_id: TEST_EXEC_CONTEXT_ID,
session_ctx,
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org