iffyio commented on code in PR #1970: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1970#discussion_r2262413180
########## tests/sqlparser_common.rs: ########## @@ -10875,7 +10875,10 @@ fn parse_pivot_table() { expected_function("b", Some("t")), Review Comment: can we add tests to demonstrate the new behavior? it seems like those are currently lacking in the PR? ########## tests/sqlparser_common.rs: ########## @@ -11143,7 +11146,7 @@ fn parse_pivot_unpivot_table() { expr: call("sum", [Expr::Identifier(Ident::new("population"))]), alias: None }], - value_column: vec![Ident::new("year")], + value_column: vec![Expr::CompoundIdentifier(vec![Ident::new("year")])], Review Comment: hmm heads up that this representation wouldn't be ideal - a compound identifier would be expected to have more than one ident in it ########## src/parser/mod.rs: ########## @@ -13828,7 +13840,13 @@ impl<'a> Parser<'a> { self.expect_token(&Token::LParen)?; let aggregate_functions = self.parse_comma_separated(Self::parse_aliased_function_call)?; self.expect_keyword_is(Keyword::FOR)?; - let value_column = self.parse_period_separated(|p| p.parse_identifier())?; + let value_column = if self.peek_token_ref().token == Token::LParen { + self.parse_parenthesized_compound_identifier_list(Mandatory, false)? + } else { + vec![Expr::CompoundIdentifier( + self.parse_period_separated(|p| p.parse_identifier())?, + )] + }; Review Comment: Ah right that makes sense, I think we can do something this instead to reuse existing capabilities of the parser? ```rust let value_column = if self.peek_token_ref().token == Token::LParen { self.parse_parenthesized_column_list_inner(Mandatory, false, |p| { p.parse_subexpr(self.dialect.prec_value(Precedence::Between)) })? } else { vec![self.parse_subexpr(self.dialect.prec_value(Precedence::Between))?] }; ``` -- 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