milenkovicm commented on code in PR #10392:
URL: https://github.com/apache/datafusion/pull/10392#discussion_r1623202665
##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -341,29 +341,8 @@ pub struct CreateFunctionBody {
pub language: Option<Ident>,
/// IMMUTABLE | STABLE | VOLATILE
pub behavior: Option<Volatility>,
- /// AS 'definition'
- pub as_: Option<DefinitionStatement>,
- /// RETURN expression
- pub return_: Option<Expr>,
-}
-
-#[derive(Clone, PartialEq, Eq, Hash, Debug)]
-pub enum DefinitionStatement {
- SingleQuotedDef(String),
- DoubleDollarDef(String),
-}
-
-impl From<sqlparser::ast::FunctionDefinition> for DefinitionStatement {
- fn from(value: sqlparser::ast::FunctionDefinition) -> Self {
- match value {
- sqlparser::ast::FunctionDefinition::SingleQuotedDef(s) => {
- Self::SingleQuotedDef(s)
- }
- sqlparser::ast::FunctionDefinition::DoubleDollarDef(s) => {
- Self::DoubleDollarDef(s)
- }
- }
- }
+ /// RETURN or AS function body
+ pub function_body: Option<Expr>,
Review Comment:
Thanks for letting me know, @alamb
I just wonder if this change will diverge sqlparser from Postgres?
I guess function like this
```sql
CREATE FUNCTION strlen(name TEXT)
RETURNS int LANGUAGE plrust AS
$$
Ok(Some(name.unwrap().len() as i32))
$$;
```
Would not be possible without wrapping body with string
--
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]