| 566 | } |
| 567 | |
| 568 | fn create_physical_expr( |
| 569 | &self, |
| 570 | expr: Expr, |
| 571 | df_schema: &DFSchema, |
| 572 | ) -> datafusion_common::Result<Arc<dyn PhysicalExpr>> { |
| 573 | unsafe { |
| 574 | let codec: Arc<dyn LogicalExtensionCodec> = |
| 575 | (&self.session.logical_codec).into(); |
| 576 | let logical_expr = serialize_expr(&expr, codec.as_ref())?.encode_to_vec(); |
| 577 | let schema = WrappedSchema(FFI_ArrowSchema::try_from(df_schema.as_arrow())?); |
| 578 | |
| 579 | let physical_expr = df_result!((self.session.create_physical_expr)( |
| 580 | &self.session, |
| 581 | logical_expr.into_iter().collect(), |
| 582 | schema |
| 583 | ))?; |
| 584 | |
| 585 | Ok((&physical_expr).into()) |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | fn scalar_functions(&self) -> &HashMap<String, Arc<ScalarUDF>> { |
| 590 | &self.scalar_functions |