@@ -63,7 +63,7 @@ def diff_tables(
6363 # There may be many pools, so number of actual threads can be a lot higher.
6464 max_threadpool_size : Optional [int ] = 1 ,
6565 # Algorithm
66- algorithm : Algorithm = Algorithm .HASHDIFF ,
66+ algorithm : Algorithm = Algorithm .AUTO ,
6767 # Into how many segments to bisect per iteration (hashdiff only)
6868 bisection_factor : int = DEFAULT_BISECTION_FACTOR ,
6969 # When should we stop bisecting and compare locally (in row count; hashdiff only)
@@ -94,7 +94,7 @@ def diff_tables(
9494 max_threadpool_size (int): Maximum size of each threadpool. ``None`` means auto.
9595 Only relevant when `threaded` is ``True``.
9696 There may be many pools, so number of actual threads can be a lot higher.
97- algorithm (:class:`Algorithm`): Which diffing algorithm to use (`HASHDIFF` or `JOINDIFF`)
97+ algorithm (:class:`Algorithm`): Which diffing algorithm to use (`HASHDIFF` or `JOINDIFF`. Default=`AUTO` )
9898 bisection_factor (int): Into how many segments to bisect per iteration. (Used when algorithm is `HASHDIFF`)
9999 bisection_threshold (Number): Minimal row count of segment to bisect, otherwise download
100100 and compare locally. (Used when algorithm is `HASHDIFF`).
@@ -144,6 +144,9 @@ def diff_tables(
144144 segments = [t .new (** override_attrs ) for t in tables ] if override_attrs else tables
145145
146146 algorithm = Algorithm (algorithm )
147+ if algorithm == Algorithm .AUTO :
148+ algorithm = Algorithm .JOINDIFF if table1 .database is table2 .database else Algorithm .HASHDIFF
149+
147150 if algorithm == Algorithm .HASHDIFF :
148151 differ = HashDiffer (
149152 bisection_factor = bisection_factor ,
0 commit comments