mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Replace parallel condition/result vectors with single CaseWhen vector in Expr::Case (#1733)
This commit is contained in:
parent
7fc37a76e5
commit
72312ba82a
5 changed files with 160 additions and 50 deletions
|
|
@ -2065,11 +2065,11 @@ impl<'a> Parser<'a> {
|
|||
self.expect_keyword_is(Keyword::WHEN)?;
|
||||
}
|
||||
let mut conditions = vec![];
|
||||
let mut results = vec![];
|
||||
loop {
|
||||
conditions.push(self.parse_expr()?);
|
||||
let condition = self.parse_expr()?;
|
||||
self.expect_keyword_is(Keyword::THEN)?;
|
||||
results.push(self.parse_expr()?);
|
||||
let result = self.parse_expr()?;
|
||||
conditions.push(CaseWhen { condition, result });
|
||||
if !self.parse_keyword(Keyword::WHEN) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -2083,7 +2083,6 @@ impl<'a> Parser<'a> {
|
|||
Ok(Expr::Case {
|
||||
operand,
|
||||
conditions,
|
||||
results,
|
||||
else_result,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue