aharpervc commented on code in PR #1808:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1808#discussion_r2042297201


##########
tests/sqlparser_mssql.rs:
##########
@@ -255,6 +256,93 @@ fn parse_create_function() {
     assert_eq!(
         ms().verified_stmt(multi_statement_function),
         sqlparser::ast::Statement::CreateFunction(CreateFunction {
+            or_alter: false,
+            or_replace: false,
+            temporary: false,
+            if_not_exists: false,
+            name: ObjectName::from(vec![Ident {
+                value: "some_scalar_udf".into(),
+                quote_style: None,
+                span: Span::empty(),
+            }]),
+            args: Some(vec![
+                OperateFunctionArg {
+                    mode: None,
+                    name: Some(Ident {
+                        value: "@foo".into(),
+                        quote_style: None,
+                        span: Span::empty(),
+                    }),
+                    data_type: DataType::Int(None),
+                    default_expr: None,
+                },
+                OperateFunctionArg {
+                    mode: None,
+                    name: Some(Ident {
+                        value: "@bar".into(),
+                        quote_style: None,
+                        span: Span::empty(),
+                    }),
+                    data_type: 
DataType::Varchar(Some(CharacterLength::IntegerLength {
+                        length: 256,
+                        unit: None
+                    })),
+                    default_expr: None,
+                },
+            ]),
+            return_type: Some(DataType::Int(None)),
+            function_body: Some(CreateFunctionBody::MultiStatement(vec![
+                Statement::Set(Set::SingleAssignment {
+                    scope: None,
+                    hivevar: false,
+                    variable: ObjectName::from(vec!["@foo".into()]),
+                    values: vec![sqlparser::ast::Expr::BinaryOp {
+                        left: Box::new(sqlparser::ast::Expr::Identifier(Ident {
+                            value: "@foo".to_string(),
+                            quote_style: None,
+                            span: Span::empty(),
+                        })),
+                        op: sqlparser::ast::BinaryOperator::Plus,
+                        right: Box::new(Expr::Value(
+                            (Value::Number("1".into(), 
false)).with_empty_span()
+                        )),
+                    }],
+                }),
+                Statement::Return(ReturnStatement {
+                    value: 
Some(ReturnStatementValue::Expr(Expr::Identifier(Ident {
+                        value: "@foo".into(),
+                        quote_style: None,
+                        span: Span::empty(),
+                    }))),
+                }),
+            ])),
+            behavior: None,
+            called_on_null: None,
+            parallel: None,
+            using: None,
+            language: None,
+            determinism_specifier: None,
+            options: None,
+            remote_connection: None,
+        }),
+    );
+}
+
+#[test]
+fn parse_mssql_create_function() {
+    let create_or_alter_function = "\

Review Comment:
   In the latest iteration, I moved this "create or alter" example to a 
separate test function. Not sure what the best pattern here is, trying to 
follow existing patterns as applicable 🤔



-- 
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