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

Function _sort_source

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

Source from the content-addressed store, hash-verified

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