@@ -98,12 +98,13 @@ def get_string(self, *args, **kwargs):
9898
9999
100100class WindowFunction (ASTNode ):
101- def __init__ (self , function , partition = None , order_by = None , alias = None ):
101+ def __init__ (self , function , partition = None , order_by = None , alias = None , modifier = None ):
102102 super ().__init__ ()
103103 self .function = function
104104 self .partition = partition
105105 self .order_by = order_by
106106 self .alias = alias
107+ self .modifier = modifier
107108
108109 def to_tree (self , * args , level = 0 , ** kwargs ):
109110 fnc_str = self .function .to_tree (level = level + 2 )
@@ -143,7 +144,8 @@ def to_string(self, *args, **kwargs):
143144 alias_str = self .alias .to_string ()
144145 else :
145146 alias_str = ''
146- return f'{ fnc_str } over({ partition_str } { order_str } ) { alias_str } '
147+ modifier_str = ' ' + self .modifier if self .modifier else ''
148+ return f'{ fnc_str } over({ partition_str } { order_str } { modifier_str } ) { alias_str } '
147149
148150
149151class Object (ASTNode ):
@@ -177,7 +179,12 @@ def __init__(self, info):
177179 super ().__init__ (op = 'interval' , args = [info , ])
178180
179181 def get_string (self , * args , ** kwargs ):
180- return f'INTERVAL { self .args [0 ]} '
182+
183+ arg = self .args [0 ]
184+ items = arg .split (' ' , maxsplit = 1 )
185+ # quote first element
186+ items [0 ] = f"'{ items [0 ]} '"
187+ return "INTERVAL " + " " .join (items )
181188
182189 def to_tree (self , * args , level = 0 , ** kwargs ):
183190 return self .get_string ( * args , ** kwargs )
0 commit comments