gaoqiangz commented on code in PR #1507:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1507#discussion_r1835719464
##########
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,
+ })
Review Comment:
How about this?
```rs
pub enum FunctionArg {
Named {
name: Ident,
arg: FunctionArgExpr,
operator: FunctionArgOperator,
},
ExprNamed {
name: Expr, // <<
arg: FunctionArgExpr,
operator: FunctionArgOperator,
},
Unnamed(FunctionArgExpr),
}
pub trait Dialect {
/// Some dialect supports
`function(<arbitrary-expr>:<arbitrary-expr>,...)`,
/// for this scenario, when returning `true` use the
`FunctionArg::ExprNamed` variant in all cases to express named
arguments,otherwise use the `FunctionArg::Named` variant (compatible reason).
fn supports_function_expr_named { false }
}
```
--
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]