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

Function _sort_source

python/pyarrow/acero.py:390–409  ·  view source on GitHub ↗
(table_or_dataset, sort_keys, output_type=Table, **kwargs)

Source from the content-addressed store, hash-verified

388
389
390def _sort_source(table_or_dataset, sort_keys, output_type=Table, **kwargs):
391
392 if isinstance(table_or_dataset, ds.Dataset):
393 data_source = _dataset_to_decl(table_or_dataset, use_threads=True)
394 else:
395 data_source = Declaration(
396 "table_source", TableSourceNodeOptions(table_or_dataset)
397 )
398
399 order_by = Declaration("order_by", OrderByNodeOptions(sort_keys, **kwargs))
400
401 decl = Declaration.from_sequence([data_source, order_by])
402 result_table = decl.to_table(use_threads=True)
403
404 if output_type == Table:
405 return result_table
406 elif output_type == ds.InMemoryDataset:
407 return ds.InMemoryDataset(result_table)
408 else:
409 raise TypeError("Unsupported output type")
410
411
412def _group_by(table, aggregates, keys, use_threads=True):

Callers

nothing calls this directly

Calls 7

_dataset_to_declFunction · 0.85
TableSourceNodeOptionsFunction · 0.85
OrderByNodeOptionsFunction · 0.85
InMemoryDatasetMethod · 0.80
DeclarationClass · 0.50
TypeErrorFunction · 0.50
to_tableMethod · 0.45

Tested by

no test coverage detected