|
27 | 27 | import pandas as pd
|
28 | 28 | import pyarrow as pa
|
29 | 29 |
|
| 30 | + import ibis.expr.types as ir |
| 31 | + |
30 | 32 |
|
31 | 33 | _table_names = (f"unbound_table_{i:d}" for i in itertools.count())
|
32 | 34 |
|
@@ -658,7 +660,7 @@ def schema(self):
|
658 | 660 | return backend._get_schema_using_query(self.query)
|
659 | 661 |
|
660 | 662 |
|
661 |
| -def _dedup_join_columns(expr, lname: str, rname: str): |
| 663 | +def _dedup_join_columns(expr: ir.Table, lname: str, rname: str): |
662 | 664 | from ibis.expr.operations.generic import TableColumn
|
663 | 665 | from ibis.expr.operations.logical import Equals
|
664 | 666 |
|
@@ -692,18 +694,22 @@ def _dedup_join_columns(expr, lname: str, rname: str):
|
692 | 694 | # Rename columns in the left table that overlap, unless they're known to be
|
693 | 695 | # equal to a column in the right
|
694 | 696 | left_projections = [
|
695 |
| - left[column].name(lname.format(name=column) if lname else column) |
| 697 | + left[column] |
| 698 | + .cast(left[column].type().copy(nullable=True)) |
| 699 | + .name(lname.format(name=column) if lname else column) |
696 | 700 | if column in overlap and column not in equal
|
697 |
| - else left[column] |
| 701 | + else left[column].cast(left[column].type().copy(nullable=True)).name(column) |
698 | 702 | for column in left.columns
|
699 | 703 | ]
|
700 | 704 |
|
701 | 705 | # Rename columns in the right table that overlap, dropping any columns that
|
702 | 706 | # are known to be equal to those in the left table
|
703 | 707 | right_projections = [
|
704 |
| - right[column].name(rname.format(name=column) if rname else column) |
| 708 | + right[column] |
| 709 | + .cast(right[column].type().copy(nullable=True)) |
| 710 | + .name(rname.format(name=column) if rname else column) |
705 | 711 | if column in overlap
|
706 |
| - else right[column] |
| 712 | + else right[column].cast(right[column].type().copy(nullable=True)).name(column) |
707 | 713 | for column in right.columns
|
708 | 714 | if column not in equal
|
709 | 715 | ]
|
|
0 commit comments