Skip to content

Commit a1d27f3

Browse files
Merge pull request #967 from jverswijver/union_join_bug
Fix #930 union join bug, Add test for union join.
2 parents 543fa44 + 7bfa2a9 commit a1d27f3

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
## Release notes
22

33
### 0.13.3 -- TBD
4+
* Add - Expose proxy feature for S3 external stores (#961) PR #962
45
* Bugfix - Dependencies not properly loaded on populate. (#902) PR #919
56
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
67
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
78
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
9+
* Bugfix - Fix assertion error when performing a union into a join (#930) PR #967
810

911
### 0.13.2 -- May 7, 2021
1012
* Update `setuptools_certificate` dependency to new name `otumat`

datajoint/expression.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ def join(self, other, semantic_check=True, left=False):
266266
- join_attributes)
267267
# need subquery if any of the join attributes are derived
268268
need_subquery1 = (need_subquery1 or isinstance(self, Aggregation) or
269-
any(n in self.heading.new_attributes for n in join_attributes))
269+
any(n in self.heading.new_attributes for n in join_attributes)
270+
or isinstance(self, Union))
270271
need_subquery2 = (need_subquery2 or isinstance(other, Aggregation) or
271-
any(n in other.heading.new_attributes for n in join_attributes))
272+
any(n in other.heading.new_attributes for n in join_attributes)
273+
or isinstance(self, Union))
272274
if need_subquery1:
273275
self = self.make_subquery()
274276
if need_subquery2:

docs-parts/intro/Releases_lang1.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
0.13.3 -- TBD
22
----------------------
3+
* Add - Expose proxy feature for S3 external stores (#961) PR #962
34
* Bugfix - Dependencies not properly loaded on populate. (#902) PR #919
45
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
56
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
67
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
8+
* Bugfix - Fix assertion error when performing a union into a join (#930) PR #967
79

810
0.13.2 -- May 7, 2021
911
----------------------

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ minio>=7.0.0
1010
matplotlib
1111
cryptography
1212
otumat
13+
urllib3

tests/test_aggr_regressions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,16 @@ def test_issue558_part2():
103103
d = dict(id=3, id2=5)
104104
assert_equal(len(X & d), len((X & d).proj(id2='3')))
105105

106+
107+
def test_union_join():
108+
# https://github.com/datajoint/datajoint-python/issues/930
109+
A.insert(zip([100, 200, 300, 400, 500, 600]))
110+
B.insert([(100, 11), (200, 22), (300, 33), (400, 44)])
111+
q1 = B & 'id < 300'
112+
q2 = B & 'id > 300'
113+
114+
expected_data = [{'id': 0, 'id2': 5}, {'id': 1, 'id2': 6}, {'id': 2, 'id2': 7},
115+
{'id': 3, 'id2': 8}, {'id': 4, 'id2': 9}, {'id': 100, 'id2': 11},
116+
{'id': 200, 'id2': 22}, {'id': 400, 'id2': 44}]
117+
118+
assert ((q1 + q2) * A).fetch(as_dict=True) == expected_data

0 commit comments

Comments
 (0)