alamb commented on issue #10256:
URL: https://github.com/apache/datafusion/issues/10256#issuecomment-2092912899

   Maybe we could make the API easier to use like:
   
   ```rust
   /// DataFusion's Exprs can represent either an `Expr` or an `OrderByExpr`
   enum Unparsed {
     // SQL Expression
     Expr(ast::Expr),
     // SQL ORDER BY expression (e.g. `col ASC NULLS FIRST`)
     OrderByExpr(ast::OrderByExpr),
   }
    
   /// Throws an error if Expr can not be represented by an `ast::Expr` 
   pub fn expr_to_sql(expr: &Expr) -> Result<sql::ast::Expr> { 
   ...
    } 
   
   /// Returns an `Unparsed` based on the expression
   pub fn expr_to_unparsed(expr: &Expr) -> Result<Unparsed> { 
   ...
    } 
   ```
   
   And that way you example would be
   
   ```rust
   let expr = self.expr_to_sql(left.as_ref())?;
   ```
   
   In  places where order by may be possible then the user could call the 
`self.expr_to_unparsed` 🤔 


-- 
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-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to