@@ -192,12 +192,6 @@ def _annotate_array(self: TypeAnnotator, expression: exp.Array) -> exp.Array:
192192 exp .LaxBool ,
193193 }
194194 },
195- ** {
196- expr_type : {"returns" : exp .DataType .Type .DATE }
197- for expr_type in {
198- exp .DateFromUnixDate ,
199- }
200- },
201195 ** {
202196 expr_type : {"returns" : exp .DataType .Type .DATETIME }
203197 for expr_type in {
@@ -272,14 +266,30 @@ def _annotate_array(self: TypeAnnotator, expression: exp.Array) -> exp.Array:
272266 exp .Uuid ,
273267 }
274268 },
269+ ** {
270+ expr_type : {"annotator" : lambda self , e : _annotate_by_args_with_coerce (self , e )}
271+ for expr_type in {
272+ exp .PercentileCont ,
273+ exp .SafeAdd ,
274+ exp .SafeMultiply ,
275+ exp .SafeSubtract ,
276+ }
277+ },
278+ ** {
279+ expr_type : {"annotator" : lambda self , e : self ._annotate_by_args (e , "this" , array = True )}
280+ for expr_type in {
281+ exp .ApproxQuantiles ,
282+ exp .JSONExtractArray ,
283+ exp .RegexpExtractAll ,
284+ exp .Split ,
285+ }
286+ },
275287 ** {
276288 expr_type : {"returns" : exp .DataType .Type .TIMESTAMPTZ } for expr_type in TIMESTAMP_EXPRESSIONS
277289 },
290+ exp .DateFromUnixDate : {"returns" : exp .DataType .Type .DATE },
278291 exp .ParseBignumeric : {"returns" : exp .DataType .Type .BIGDECIMAL },
279292 exp .ParseNumeric : {"returns" : exp .DataType .Type .DECIMAL },
280- exp .ApproxQuantiles : {
281- "annotator" : lambda self , e : self ._annotate_by_args (e , "this" , array = True )
282- },
283293 exp .ApproxTopK : {"annotator" : lambda self , e : _annotate_by_args_approx_top (self , e )},
284294 exp .ApproxTopSum : {"annotator" : lambda self , e : _annotate_by_args_approx_top (self , e )},
285295 exp .Array : {"annotator" : _annotate_array },
@@ -292,9 +302,6 @@ def _annotate_array(self: TypeAnnotator, expression: exp.Array) -> exp.Array:
292302 e , exp .DataType .build ("ARRAY<TIMESTAMP>" , dialect = "bigquery" )
293303 )
294304 },
295- exp .JSONExtractArray : {
296- "annotator" : lambda self , e : self ._annotate_by_args (e , "this" , array = True )
297- },
298305 exp .JSONFormat : {
299306 "annotator" : lambda self , e : self ._annotate_with_type (
300307 e , exp .DataType .Type .JSON if e .args .get ("to_json" ) else exp .DataType .Type .VARCHAR
@@ -311,14 +318,6 @@ def _annotate_array(self: TypeAnnotator, expression: exp.Array) -> exp.Array:
311318 )
312319 },
313320 exp .Lag : {"annotator" : lambda self , e : self ._annotate_by_args (e , "this" , "default" )},
314- exp .PercentileCont : {"annotator" : lambda self , e : _annotate_by_args_with_coerce (self , e )},
315- exp .RegexpExtractAll : {
316- "annotator" : lambda self , e : self ._annotate_by_args (e , "this" , array = True )
317- },
318- exp .SafeAdd : {"annotator" : lambda self , e : _annotate_by_args_with_coerce (self , e )},
319- exp .SafeMultiply : {"annotator" : lambda self , e : _annotate_by_args_with_coerce (self , e )},
320- exp .SafeSubtract : {"annotator" : lambda self , e : _annotate_by_args_with_coerce (self , e )},
321- exp .Split : {"annotator" : lambda self , e : self ._annotate_by_args (e , "this" , array = True )},
322321 exp .ToCodePoints : {
323322 "annotator" : lambda self , e : self ._annotate_with_type (
324323 e , exp .DataType .build ("ARRAY<BIGINT>" , dialect = "bigquery" )
0 commit comments