MCPcopy Create free account
hub / github.com/apache/arrow / _perform_join

Function _perform_join

python/pyarrow/acero.py:82–260  ·  view source on GitHub ↗

Perform join of two tables or datasets. The result will be an output table with the result of the join operation Parameters ---------- join_type : str One of supported join types. left_operand : Table or Dataset The left operand for the join operation.

(join_type, left_operand, left_keys,
                  right_operand, right_keys,
                  left_suffix=None, right_suffix=None,
                  use_threads=True, coalesce_keys=False,
                  output_type=Table, filter_expression=None)

Source from the content-addressed store, hash-verified

80
81
82def _perform_join(join_type, left_operand, left_keys,
83 right_operand, right_keys,
84 left_suffix=None, right_suffix=None,
85 use_threads=True, coalesce_keys=False,
86 output_type=Table, filter_expression=None):
87 """
88 Perform join of two tables or datasets.
89
90 The result will be an output table with the result of the join operation
91
92 Parameters
93 ----------
94 join_type : str
95 One of supported join types.
96 left_operand : Table or Dataset
97 The left operand for the join operation.
98 left_keys : str or list[str]
99 The left key (or keys) on which the join operation should be performed.
100 right_operand : Table or Dataset
101 The right operand for the join operation.
102 right_keys : str or list[str]
103 The right key (or keys) on which the join operation should be performed.
104 left_suffix : str, default None
105 Which suffix to add to left column names. This prevents confusion
106 when the columns in left and right operands have colliding names.
107 right_suffix : str, default None
108 Which suffix to add to the right column names. This prevents confusion
109 when the columns in left and right operands have colliding names.
110 use_threads : bool, default True
111 Whether to use multithreading or not.
112 coalesce_keys : bool, default False
113 If the duplicated keys should be omitted from one of the sides
114 in the join result.
115 output_type: Table or InMemoryDataset
116 The output type for the exec plan result.
117 filter_expression : pyarrow.compute.Expression
118 Residual filter which is applied to matching row.
119
120 Returns
121 -------
122 result_table : Table or InMemoryDataset
123 """
124 if not isinstance(left_operand, (Table, ds.Dataset)):
125 raise TypeError(f"Expected Table or Dataset, got {type(left_operand)}")
126 if not isinstance(right_operand, (Table, ds.Dataset)):
127 raise TypeError(f"Expected Table or Dataset, got {type(right_operand)}")
128
129 # Prepare left and right tables Keys to send them to the C++ function
130 left_keys_order = {}
131 if not isinstance(left_keys, (tuple, list)):
132 left_keys = [left_keys]
133 for idx, key in enumerate(left_keys):
134 left_keys_order[key] = idx
135
136 right_keys_order = {}
137 if not isinstance(right_keys, (list, tuple)):
138 right_keys = [right_keys]
139 for idx, key in enumerate(right_keys):

Callers 5

test_joins_corner_casesFunction · 0.90
test_joinsFunction · 0.90

Calls 10

_dataset_to_declFunction · 0.85
TableSourceNodeOptionsFunction · 0.85
HashJoinNodeOptionsFunction · 0.85
lenFunction · 0.85
InMemoryDatasetMethod · 0.80
TypeErrorFunction · 0.50
typeEnum · 0.50
DeclarationClass · 0.50
appendMethod · 0.45
to_tableMethod · 0.45

Tested by 5

test_joins_corner_casesFunction · 0.72
test_joinsFunction · 0.72