|
7 | 7 |
|
8 | 8 | from runtype import dataclass |
9 | 9 |
|
10 | | -from sqeleton.abcs import ColType_UUID, NumericType, PrecisionType, StringType |
| 10 | +from sqeleton.abcs import ColType_UUID, NumericType, PrecisionType, StringType, Boolean |
11 | 11 |
|
12 | 12 | from .info_tree import InfoTree |
13 | 13 | from .utils import safezip |
@@ -94,17 +94,19 @@ def _validate_and_adjust_columns(self, table1, table2): |
94 | 94 | table1._schema[c1] = col1.replace(precision=lowest.precision, rounds=lowest.rounds) |
95 | 95 | table2._schema[c2] = col2.replace(precision=lowest.precision, rounds=lowest.rounds) |
96 | 96 |
|
97 | | - elif isinstance(col1, NumericType): |
98 | | - if not isinstance(col2, NumericType): |
| 97 | + elif isinstance(col1, (NumericType, Boolean)): |
| 98 | + if not isinstance(col2, (NumericType, Boolean)): |
99 | 99 | raise TypeError(f"Incompatible types for column '{c1}': {col1} <-> {col2}") |
100 | 100 |
|
101 | 101 | lowest = min(col1, col2, key=attrgetter("precision")) |
102 | 102 |
|
103 | 103 | if col1.precision != col2.precision: |
104 | 104 | logger.warning(f"Using reduced precision {lowest} for column '{c1}'. Types={col1}, {col2}") |
105 | 105 |
|
106 | | - table1._schema[c1] = col1.replace(precision=lowest.precision) |
107 | | - table2._schema[c2] = col2.replace(precision=lowest.precision) |
| 106 | + if lowest.precision != col1.precision: |
| 107 | + table1._schema[c1] = col1.replace(precision=lowest.precision) |
| 108 | + if lowest.precision != col2.precision: |
| 109 | + table2._schema[c2] = col2.replace(precision=lowest.precision) |
108 | 110 |
|
109 | 111 | elif isinstance(col1, ColType_UUID): |
110 | 112 | if not isinstance(col2, ColType_UUID): |
|
0 commit comments