@@ -40,17 +40,19 @@ class NumericType(ColType):
4040 # 'precision' signifies how many fractional digits (after the dot) we want to compare
4141 precision : int
4242
43+ class FractionalType (NumericType ):
44+ pass
4345
44- class Float (NumericType ):
46+ class Float (FractionalType ):
4547 pass
4648
4749
48- class Decimal (NumericType ):
50+ class Decimal (FractionalType ):
4951 pass
5052
5153
5254@dataclass
53- class Integer (Decimal ):
55+ class Integer (NumericType ):
5456 def __post_init__ (self ):
5557 assert self .precision == 0
5658
@@ -114,7 +116,7 @@ def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
114116 ...
115117
116118 @abstractmethod
117- def normalize_number (self , value : str , coltype : NumericType ) -> str :
119+ def normalize_number (self , value : str , coltype : FractionalType ) -> str :
118120 """Creates an SQL expression, that converts 'value' to a normalized number.
119121
120122 The returned expression must accept any SQL int/numeric/float, and return a string.
@@ -139,18 +141,20 @@ def normalize_value_by_type(self, value: str, coltype: ColType) -> str:
139141
140142 The returned expression must accept any SQL value, and return a string.
141143
142- The default implementation dispatches to a method according to `` coltype` `:
144+ The default implementation dispatches to a method according to `coltype`:
143145
144146 TemporalType -> normalize_timestamp()
145- NumericType -> normalize_number()
146- -else- -> to_string()
147+ FractionalType -> normalize_number()
148+ *else* -> to_string()
149+
150+ (`Integer` falls in the *else* category)
147151
148152 """
149153 if isinstance (coltype , TemporalType ):
150154 return self .normalize_timestamp (value , coltype )
151- elif isinstance (coltype , NumericType ):
155+ elif isinstance (coltype , FractionalType ):
152156 return self .normalize_number (value , coltype )
153- return self .to_string (f" { value } " )
157+ return self .to_string (value )
154158
155159 def _normalize_table_path (self , path : DbPath ) -> DbPath :
156160 ...
0 commit comments