Skip to content

Commit

Permalink
Fix: windowspec generator
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed May 2, 2023
1 parent 82da367 commit 5c26f56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sqlglot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
Expression as Expression,
alias_ as alias,
and_ as and_,
cast as cast,
column as column,
condition as condition,
except_ as except_,
from_ as from_,
func as func,
intersect as intersect,
maybe_parse as maybe_parse,
not_ as not_,
Expand All @@ -33,6 +35,7 @@
subquery as subquery,
table_ as table,
to_column as to_column,
to_identifier as to_identifier,
to_table as to_table,
union as union,
)
Expand Down
4 changes: 2 additions & 2 deletions sqlglot/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ def window_sql(self, expression: exp.Window) -> str:
partition_sql = partition + " " if partition and order else partition

spec = expression.args.get("spec")
spec_sql = " " + self.window_spec_sql(spec) if spec else ""
spec_sql = " " + self.windowspec_sql(spec) if spec else ""

alias = self.sql(expression, "alias")
over = self.sql(expression, "over") or "OVER"
Expand All @@ -1572,7 +1572,7 @@ def partition_by_sql(self, expression: exp.Window | exp.MatchRecognize) -> str:
partition = self.expressions(expression, key="partition_by", flat=True)
return f"PARTITION BY {partition}" if partition else ""

def window_spec_sql(self, expression: exp.WindowSpec) -> str:
def windowspec_sql(self, expression: exp.WindowSpec) -> str:
kind = self.sql(expression, "kind")
start = csv(self.sql(expression, "start"), self.sql(expression, "start_side"), sep=" ")
end = (
Expand Down

0 comments on commit 5c26f56

Please sign in to comment.