6
6
from enum import Enum
7
7
from contextlib import contextmanager
8
8
from operator import methodcaller
9
- from typing import Dict , Set , List , Tuple , Iterator , Optional
9
+ from typing import Dict , Set , List , Tuple , Iterator , Optional , Union
10
10
from concurrent .futures import ThreadPoolExecutor , as_completed
11
11
12
12
import attrs
@@ -182,6 +182,8 @@ def get_stats_dict(self, is_dbt: bool = False):
182
182
183
183
@attrs .define (frozen = False )
184
184
class TableDiffer (ThreadBase , ABC ):
185
+ INFO_TREE_CLASS = InfoTree
186
+
185
187
bisection_factor = 32
186
188
stats : dict = {}
187
189
@@ -204,7 +206,8 @@ def diff_tables(self, table1: TableSegment, table2: TableSegment, info_tree: Inf
204
206
Where `row` is a tuple of values, corresponding to the diffed columns.
205
207
"""
206
208
if info_tree is None :
207
- info_tree = InfoTree (SegmentInfo ([table1 , table2 ]))
209
+ segment_info = self .INFO_TREE_CLASS .SEGMENT_INFO_CLASS ([table1 , table2 ])
210
+ info_tree = self .INFO_TREE_CLASS (segment_info )
208
211
return DiffResultWrapper (self ._diff_tables_wrapper (table1 , table2 , info_tree ), info_tree , self .stats )
209
212
210
213
def _diff_tables_wrapper (self , table1 : TableSegment , table2 : TableSegment , info_tree : InfoTree ) -> DiffResult :
@@ -259,7 +262,7 @@ def _validate_and_adjust_columns(self, table1: TableSegment, table2: TableSegmen
259
262
260
263
def _diff_tables_root (
261
264
self , table1 : TableSegment , table2 : TableSegment , info_tree : InfoTree
262
- ) -> DiffResult | DiffResultList :
265
+ ) -> Union [ DiffResult , DiffResultList ] :
263
266
return self ._bisect_and_diff_tables (table1 , table2 , info_tree )
264
267
265
268
@abstractmethod
0 commit comments