Skip to content

Commit 6611c28

Browse files
refactor: Reimplement implicit joiner at expression layer (#436)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent 874026d commit 6611c28

File tree

9 files changed

+462
-409
lines changed

9 files changed

+462
-409
lines changed

bigframes/core/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import bigframes.core.nodes as nodes
2929
from bigframes.core.ordering import OrderingColumnReference
3030
import bigframes.core.ordering as orderings
31+
import bigframes.core.rewrite
3132
import bigframes.core.utils
3233
from bigframes.core.window_spec import WindowSpec
3334
import bigframes.dtypes
@@ -351,14 +352,15 @@ def join(
351352
join_def: join_def.JoinDefinition,
352353
allow_row_identity_join: bool = False,
353354
):
354-
return ArrayValue(
355-
nodes.JoinNode(
356-
left_child=self.node,
357-
right_child=other.node,
358-
join=join_def,
359-
allow_row_identity_join=allow_row_identity_join,
360-
)
355+
join_node = nodes.JoinNode(
356+
left_child=self.node,
357+
right_child=other.node,
358+
join=join_def,
359+
allow_row_identity_join=allow_row_identity_join,
361360
)
361+
if allow_row_identity_join:
362+
return ArrayValue(bigframes.core.rewrite.maybe_rewrite_join(join_node))
363+
return ArrayValue(join_node)
362364

363365
def _uniform_sampling(self, fraction: float) -> ArrayValue:
364366
"""Sampling the table on given fraction.

bigframes/core/compile/compiler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def compile_join(node: nodes.JoinNode, ordered: bool = True):
6666
left=left_ordered,
6767
right=right_ordered,
6868
join=node.join,
69-
allow_row_identity_join=node.allow_row_identity_join,
7069
)
7170
else:
7271
left_unordered = compile_unordered_ir(node.left_child)
@@ -75,7 +74,6 @@ def compile_join(node: nodes.JoinNode, ordered: bool = True):
7574
left=left_unordered,
7675
right=right_unordered,
7776
join=node.join,
78-
allow_row_identity_join=node.allow_row_identity_join,
7977
)
8078

8179

bigframes/core/compile/row_identity.py

Lines changed: 0 additions & 265 deletions
This file was deleted.

0 commit comments

Comments
 (0)