iffyio commented on code in PR #1507:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1507#discussion_r1835696061


##########
src/parser/mod.rs:
##########
@@ -11141,19 +11154,34 @@ impl<'a> Parser<'a> {
     /// FIRST_VALUE(x IGNORE NULL);
     /// ```
     fn parse_function_argument_list(&mut self) -> Result<FunctionArgumentList, 
ParserError> {
+        let mut clauses = vec![];
+
+        if dialect_of!(self is MsSqlDialect) {
+            // JSON_ARRAY(NULL ON NULL)
+            if self.parse_keywords(&[Keyword::NULL, Keyword::ON, 
Keyword::NULL]) {
+                clauses.push(FunctionArgumentClause::JsonNullClause(
+                    JsonNullClause::NullOnNull,
+                ));
+            }
+            // JSON_ARRAY(ABSENT ON NULL)

Review Comment:
   hmm yeah that was my understanding, but not sure I follow that the change is 
needed to handle that scenario, in that neither of the [other 
clauses](https://github.com/apache/datafusion-sqlparser-rs/blob/43b0652bb1469e253ef3e1d9e606f43c30dba845/src/parser/mod.rs#L11182-L11224)
 should kick in or?



##########
src/parser/mod.rs:
##########
@@ -11096,6 +11096,19 @@ impl<'a> Parser<'a> {
                 arg,
                 operator: FunctionArgOperator::Assignment,
             })
+        } else if dialect_of!(self is MsSqlDialect) {
+            // FUNC(<expr> : <expr>)
+            let name = self.parse_wildcard_expr()?;
+            if self.consume_token(&Token::Colon) {
+                let arg = self.parse_expr()?.into();
+                Ok(FunctionArg::Named {
+                    name,
+                    arg,
+                    operator: FunctionArgOperator::Colon,
+                })
+            } else {
+                Ok(FunctionArg::Unnamed(name.into()))
+            }

Review Comment:
   Ah that right! that makes sense, though can we collapse the last else if 
/else so that the unnamed default is constructed once?
   ```rust
   } else  {
     let name = ...;
     if dialect_of!(self is MsSqlDialect) {
       return Ok(FunctionArg::Named{...})
     }
     Ok(FunctionArg::Unnamed(name.into()))
   }
   ```



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