Skip to content

Commit 0b46246

Browse files
committed
Sync w/ integration tests & clean up AI.FORECAST implementation a little
1 parent eb9dbac commit 0b46246

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

sqlglot-integration-tests

sqlglot/parsers/bigquery.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -617,14 +617,13 @@ def _parse_forecast(self) -> exp.AIForecast | exp.MLForecast:
617617
self.raise_error("Expected table or query statement")
618618

619619
expr = self.expression(exp.AIForecast(this=this))
620-
if self._match(TokenType.COMMA):
621-
while True:
622-
arg = self._parse_lambda()
623-
if arg:
624-
expr.set(arg.this.name, arg)
625-
626-
if not self._match(TokenType.COMMA):
627-
break
620+
while self._match(TokenType.COMMA):
621+
arg = self._parse_lambda()
622+
if isinstance(arg, exp.Kwarg):
623+
expr.set(arg.this.name, arg)
624+
else:
625+
self.raise_error(f"Expected key => value syntax for AI.FORECAST, got {arg}")
626+
break
628627

629628
return expr
630629

0 commit comments

Comments
 (0)