bombsimon commented on code in PR #2009:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2009#discussion_r2291312644
##########
src/parser/mod.rs:
##########
@@ -17869,4 +17954,18 @@ mod tests {
assert!(Parser::parse_sql(&GenericDialect, &sql).is_err());
}
}
+
+ #[test]
+ fn test_parse_semantic_view() {
+ let sql = r#"SEMANTIC_VIEW(model DIMENSIONS a.b METRICS c.d WHERE x >
0) AS sm"#;
+ let mut parser = Parser::new(&GenericDialect {})
+ .try_with_sql(sql)
+ .expect("failed to create parser");
+
+ let ast = parser
+ .parse_semantic_view_table_factor()
+ .expect("should parse SEMANTIC_VIEW");
+
+ assert!(matches!(ast, TableFactor::SemanticView { .. }));
+ }
Review Comment:
Moved the other tests to `sqlparser_common` and using the `TestedDialects`
for the full queries.
I also removed this test after a discussion outside of GitHub. This means
that we actually don't test whether or not `parse_semantic_view_table_factor`
expects the first token to be `Keyword::SEMANTIC_VIEW` or if we just peeked the
tokens before.
--
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]