eliaperantoni commented on issue #1548:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/issues/1548#issuecomment-2943240795

   I noticed that `CASE .. END` expressions don't have correct spans because 
the locations of the heading and trailing keywords are not considered. ie. the 
following test fails:
   
   ```rust
   #[test]
   fn test_case_expr_span() {
       let sql = "CASE 1 WHEN 2 THEN 3 ELSE 4 END";
       let mut parser = Parser::new(&GenericDialect 
{}).try_with_sql(sql).unwrap();
       assert_eq!(
           parser.parse_expr().unwrap().span(),
           Span::new(Location::new(1, 1), Location::new(1, sql.len() as u64 + 
1))
       );
   }
   ```
   
   I'm about to open a PR that fixes the issue following the footsteps of what 
was done for `Select`: including the `AttachedToken`s for the keywords in the 
AST node and using them in the `Spanned` impl.
   
   Should I make a subticket for this? @alamb 


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