Skip to content

Commit ae09fc1

Browse files
committed
refactor: Rename concat_str -> _composite_key and lightly doc
1 parent e55aeb0 commit ae09fc1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

narwhals/_plan/arrow/group_by.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ def agg(self, irs: Seq[NamedIR]) -> Frame:
169169
return result
170170

171171

172-
def concat_str(native: pa.Table, *, separator: str = "") -> ChunkedArray:
172+
def _composite_key(native: pa.Table, *, separator: str = "") -> ChunkedArray:
173+
"""Horizontally join columns to *seed* a unique key per row combination."""
173174
dtype = fn.string_type(native.schema.types)
174175
it = fn.cast_table(native, dtype).itercolumns()
175176
concat: Incomplete = pc.binary_join_element_wise
@@ -206,7 +207,7 @@ def _partition_by_many(
206207
original_names = native.column_names
207208
temp_name = temp.column_name(original_names)
208209
key = acero.col(temp_name)
209-
composite_values = concat_str(acero.select_names_table(native, by))
210+
composite_values = _composite_key(acero.select_names_table(native, by))
210211
# Need to iterate over the whole thing, so py_list first should be faster
211212
unique_py = composite_values.unique().to_pylist()
212213
re_keyed = native.add_column(0, temp_name, composite_values)

0 commit comments

Comments
 (0)