mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-25 00:14:06 +00:00
Add more tests and docstring
This commit is contained in:
parent
11680b1f00
commit
1d7fffc121
2 changed files with 5 additions and 3 deletions
|
@ -13847,6 +13847,7 @@ impl<'a> Parser<'a> {
|
||||||
Ok(XmlPassingClause { arguments })
|
Ok(XmlPassingClause { arguments })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parse a [TableFactor::SemanticView]
|
||||||
fn parse_semantic_view_table_factor(&mut self) -> Result<TableFactor, ParserError> {
|
fn parse_semantic_view_table_factor(&mut self) -> Result<TableFactor, ParserError> {
|
||||||
let name = self.parse_object_name(true)?;
|
let name = self.parse_object_name(true)?;
|
||||||
|
|
||||||
|
|
|
@ -4622,12 +4622,13 @@ fn test_semantic_view_all_variants_should_pass() {
|
||||||
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1, dim2)",
|
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1, dim2)",
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
|
("SELECT * FROM SEMANTIC_VIEW(a.b METRICS c.d, c.e)", None),
|
||||||
(
|
(
|
||||||
"SELECT * FROM SEMANTIC_VIEW(model METRICS met1, met2)",
|
"SELECT * FROM SEMANTIC_VIEW(model FACTS fact1, fact2)",
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"SELECT * FROM SEMANTIC_VIEW(model FACTS fact1, fact2)",
|
"SELECT * FROM SEMANTIC_VIEW(model FACTS DATE_PART('year', col))",
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -4650,7 +4651,7 @@ fn test_semantic_view_all_variants_should_pass() {
|
||||||
"SELECT * FROM SEMANTIC_VIEW(model METRICS orders.col, orders.col2)",
|
"SELECT * FROM SEMANTIC_VIEW(model METRICS orders.col, orders.col2)",
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
// We can parse in any order bu will always produce a result in a fixed order.
|
// We can parse in any order but will always produce a result in a fixed order.
|
||||||
(
|
(
|
||||||
"SELECT * FROM SEMANTIC_VIEW(model WHERE x > 0 DIMENSIONS dim1)",
|
"SELECT * FROM SEMANTIC_VIEW(model WHERE x > 0 DIMENSIONS dim1)",
|
||||||
Some("SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1 WHERE x > 0)"),
|
Some("SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1 WHERE x > 0)"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue