Skip to content

Commit 5fa4cb6

Browse files
committed
Use Parser::parse_wildcard_expr to parse metrics
1 parent c6c8364 commit 5fa4cb6

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

src/ast/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ pub enum TableFactor {
14291429
/// List of dimensions or expression referring to dimensions (e.g. DATE_PART('year', col))
14301430
dimensions: Vec<Expr>,
14311431
/// List of metrics (references to objects like orders.value, value, orders.*)
1432-
metrics: Vec<ObjectName>,
1432+
metrics: Vec<Expr>,
14331433
/// List of facts or expressions referring to facts or dimensions.
14341434
facts: Vec<Expr>,
14351435
/// WHERE clause for filtering

src/parser/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13958,8 +13958,7 @@ impl<'a> Parser<'a> {
1395813958
"METRICS clause can only be specified once".to_string(),
1395913959
));
1396013960
}
13961-
metrics = self
13962-
.parse_comma_separated(|parser| parser.parse_object_name_inner(true, true))?;
13961+
metrics = self.parse_comma_separated(Parser::parse_wildcard_expr)?;
1396313962
} else if self.parse_keyword(Keyword::FACTS) {
1396413963
if !facts.is_empty() {
1396513964
return Err(ParserError::ParserError(

tests/sqlparser_common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16981,7 +16981,6 @@ fn test_parse_semantic_view_table_factor() {
1698116981
let invalid_sqls = [
1698216982
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1 INVALID inv1)",
1698316983
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1 DIMENSIONS dim2)",
16984-
"SELECT * FROM SEMANTIC_VIEW(model METRICS SUM(met1.avg))",
1698516984
];
1698616985

1698716986
for sql in invalid_sqls {

0 commit comments

Comments
 (0)