westonpace commented on PR #18086:
URL: https://github.com/apache/datafusion/pull/18086#issuecomment-3416530869

   > Nice! glad to see the producer also being threaded around the 
to_substrait_type() method, that will make it very easy to add new UDFs
   
   @gabotechs I think we still need to change the public API a bit to make the 
substrait producer trait usable.  I can do this in a follow-up if you agree.
   
   Currently I use Substrait this way:
   
   ```
   pub fn encode_substrait(
       expr: Expr,
       schema: Arc<ArrowSchema>,
       state: &SessionState,
   ) -> Result<Vec<u8>> {
       use arrow_schema::Field;
       use datafusion::logical_expr::ExprSchemable;
       use datafusion_common::DFSchema;
   
       let df_schema = Arc::new(DFSchema::try_from(schema)?);
       let output_type = expr.get_type(&df_schema)?;
       // Nullability doesn't matter
       let output_field = Field::new("output", output_type, /*nullable=*/ true);
       let extended_expr = 
datafusion_substrait::logical_plan::producer::to_substrait_extended_expr(
           &[(&expr, &output_field)],
           &df_schema,
           state,
       )?;
   
       Ok(extended_expr.encode_to_vec())
   }
   ```
   
   There is no way for me to specify a custom producer here.  Do we need a 
`handle_extended_expr` method on the custom producer as well?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to