ion-elgreco commented on issue #10181:
URL: https://github.com/apache/datafusion/issues/10181#issuecomment-2070893136
@alamb this is how we create expressions:
```rust
/// Parse a string predicate into an `Expr`
pub(crate) fn parse_predicate_expression(
schema: &DFSchema,
expr: impl AsRef<str>,
df_state: &SessionState,
) -> DeltaResult<Expr> {
let dialect = &GenericDialect {};
let mut tokenizer = Tokenizer::new(dialect, expr.as_ref());
let tokens = tokenizer
.tokenize()
.map_err(|err| DeltaTableError::GenericError {
source: Box::new(err),
})?;
let sql = Parser::new(dialect)
.with_tokens(tokens)
.parse_expr()
.map_err(|err| DeltaTableError::GenericError {
source: Box::new(err),
})?;
let context_provider = DeltaContextProvider { state: df_state };
let sql_to_rel =
SqlToRel::new_with_options(&context_provider,
DeltaParserOptions::default().into());
Ok(sql_to_rel.sql_to_expr(sql, schema, &mut Default::default())?)
}
```
--
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]