(table_or_dataset, sort_keys, output_type=Table, **kwargs)
| 388 | |
| 389 | |
| 390 | def _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 | |
| 412 | def _group_by(table, aggregates, keys, use_threads=True): |
nothing calls this directly
no test coverage detected