66from enum import Enum
77from contextlib import contextmanager
88from operator import methodcaller
9- from typing import Dict , Set , List , Tuple , Iterator , Optional
9+ from typing import Dict , Set , List , Tuple , Iterator , Optional , Union
1010from concurrent .futures import ThreadPoolExecutor , as_completed
1111
1212import attrs
@@ -182,6 +182,8 @@ def get_stats_dict(self, is_dbt: bool = False):
182182
183183@attrs .define (frozen = False )
184184class TableDiffer (ThreadBase , ABC ):
185+ INFO_TREE_CLASS = InfoTree
186+
185187 bisection_factor = 32
186188 stats : dict = {}
187189
@@ -204,7 +206,8 @@ def diff_tables(self, table1: TableSegment, table2: TableSegment, info_tree: Inf
204206 Where `row` is a tuple of values, corresponding to the diffed columns.
205207 """
206208 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 )
208211 return DiffResultWrapper (self ._diff_tables_wrapper (table1 , table2 , info_tree ), info_tree , self .stats )
209212
210213 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
259262
260263 def _diff_tables_root (
261264 self , table1 : TableSegment , table2 : TableSegment , info_tree : InfoTree
262- ) -> DiffResult | DiffResultList :
265+ ) -> Union [ DiffResult , DiffResultList ] :
263266 return self ._bisect_and_diff_tables (table1 , table2 , info_tree )
264267
265268 @abstractmethod
0 commit comments