Abstract ``set_index`` class. Simplifies (later lowers) either to Blockwise ops if we are already sorted or to ``SetPartition`` which handles shuffling. Parameters ---------- frame: Expr Frame-like expression where the index is set. _other: Expr | Scalar Eit
| 804 | |
| 805 | |
| 806 | class SetIndex(BaseSetIndexSortValues): |
| 807 | """Abstract ``set_index`` class. |
| 808 | |
| 809 | Simplifies (later lowers) either to Blockwise ops if we are already sorted |
| 810 | or to ``SetPartition`` which handles shuffling. |
| 811 | |
| 812 | Parameters |
| 813 | ---------- |
| 814 | frame: Expr |
| 815 | Frame-like expression where the index is set. |
| 816 | _other: Expr | Scalar |
| 817 | Either a Series-like expression to use as Index or a scalar defining the column. |
| 818 | drop: bool |
| 819 | Whether we drop the old column. |
| 820 | sorted: str |
| 821 | No need for shuffling if we are already sorted. |
| 822 | user_divisions: int |
| 823 | Divisions as passed by the user. |
| 824 | upsample: float |
| 825 | Used to increase the number of samples for quantiles. |
| 826 | """ |
| 827 | |
| 828 | _parameters = [ |
| 829 | "frame", |
| 830 | "_other", |
| 831 | "drop", |
| 832 | "user_divisions", |
| 833 | "partition_size", |
| 834 | "ascending", |
| 835 | "npartitions", |
| 836 | "upsample", |
| 837 | "shuffle_method", |
| 838 | "append", |
| 839 | "options", # Options for the chosen shuffle method |
| 840 | ] |
| 841 | _defaults = { |
| 842 | "drop": True, |
| 843 | "user_divisions": None, |
| 844 | "partition_size": 128e6, |
| 845 | "ascending": True, |
| 846 | "npartitions": None, |
| 847 | "upsample": 1.0, |
| 848 | "shuffle_method": None, |
| 849 | "options": None, |
| 850 | "append": False, |
| 851 | } |
| 852 | _filter_passthrough = True |
| 853 | |
| 854 | @property |
| 855 | def _projection_columns(self): |
| 856 | return self.columns + ( |
| 857 | [self._other] if not isinstance(self._other, Expr) else [] |
| 858 | ) |
| 859 | |
| 860 | @functools.cached_property |
| 861 | def _meta(self): |
| 862 | if isinstance(self._other, Expr): |
| 863 | other = self._other._meta |
no outgoing calls
no test coverage detected