1515from __future__ import annotations
1616
1717from functools import singledispatchmethod
18- from typing import Any , Dict , Optional , Sequence
18+ from typing import Any , Dict , Literal , Optional , Sequence
1919
2020import pandas as pd
2121import substrait .algebra_pb2 as algebra_pb2
@@ -38,7 +38,11 @@ class SubstraitCompiler:
3838 Compiles BigFrameNode plans to Substrait schema (JSON representation).
3939 """
4040
41- def __init__ (self , duration_type : Literal ["interval_day" , "int" ], use_precision_types : bool = True ):
41+ def __init__ (
42+ self ,
43+ duration_type : Literal ["interval_day" , "int" ],
44+ use_precision_types : bool = True ,
45+ ):
4246 self ._duration_type = duration_type
4347 self ._use_precision_types = use_precision_types
4448
@@ -1109,7 +1113,9 @@ def _convert_type(self, dtype: Any) -> Dict[str, Any]:
11091113 elif dtype == bigframes .dtypes .TIME_DTYPE :
11101114 if self ._use_precision_types :
11111115 # type_variation_reference 1 is for time64, precision 6 is for microseconds
1112- return {"precision_time" : {"precision" : 6 , "type_variation_reference" : 1 }}
1116+ return {
1117+ "precision_time" : {"precision" : 6 , "type_variation_reference" : 1 }
1118+ }
11131119 else :
11141120 return {"time" : {}}
11151121 elif dtype in (
@@ -1125,9 +1131,7 @@ def _convert_type(self, dtype: Any) -> Dict[str, Any]:
11251131 }
11261132 elif dtype == bigframes .dtypes .TIMEDELTA_DTYPE :
11271133 if self ._duration_type == "interval_day" :
1128- return {
1129- "interval_day" : {"precision" : 6 , "type_variation_reference" : 1 }
1130- }
1134+ return {"interval_day" : {"precision" : 6 , "type_variation_reference" : 1 }}
11311135 else :
11321136 return {"i64" : {}}
11331137 elif bigframes .dtypes .is_struct_like (dtype ):
0 commit comments