Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit d304e1a

Browse files
committed
Adjust PR #314
1 parent 3080dd0 commit d304e1a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

data_diff/hashdiff_tables.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525

2626

2727
def diff_sets(a: set, b: set) -> Iterator:
28-
s1 = set(a)
29-
s2 = set(b)
30-
d = defaultdict(list)
31-
32-
diff_ab = (row for row in a if row in s1 - s2)
33-
diff_ba = (row for row in b if row in s2 - s1)
28+
sa = set(a)
29+
sb = set(b)
3430

3531
# The first item is always the key (see TableDiffer.relevant_columns)
36-
for i in diff_ab:
37-
d[i[0]].append(("-", i))
38-
for i in diff_ba:
39-
d[i[0]].append(("+", i))
32+
# TODO update when we add compound keys to hashdiff
33+
d = defaultdict(list)
34+
for row in a:
35+
if row not in sb:
36+
d[row[0]].append(("-", row))
37+
for row in b:
38+
if row not in sa:
39+
d[row[0]].append(("+", row))
4040

4141
for _k, v in sorted(d.items(), key=lambda i: i[0]):
4242
yield from v

0 commit comments

Comments
 (0)