File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2535,16 +2535,12 @@ def substring_sql(self, expression: exp.Substring) -> str:
25352535 start = expression .args .get ("start" )
25362536 length = expression .args .get ("length" )
25372537
2538- return self .func (
2539- "SUBSTRING" ,
2540- expression .this ,
2541- exp .If (this = start .eq (0 ), true = exp .Literal .number (1 ), false = start )
2542- if start is not None
2543- else None ,
2544- exp .If (this = length < 0 , true = exp .Literal .number (0 ), false = length )
2545- if length is not None
2546- else None ,
2547- )
2538+ if start := expression .args .get ("start" ):
2539+ start = exp .If (this = start .eq (0 ), true = exp .Literal .number (1 ), false = start )
2540+ if length := expression .args .get ("length" ):
2541+ length = exp .If (this = length < 0 , true = exp .Literal .number (0 ), false = length )
2542+
2543+ return self .func ("SUBSTRING" , expression .this , start , length )
25482544
25492545 return self .function_fallback_sql (expression )
25502546
You can’t perform that action at this time.
0 commit comments