MCPcopy Create free account
hub / github.com/dask/dask / _lower

Method _lower

dask/dataframe/dask_expr/_shuffle.py:878–924  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

876 return self.frame[self._other]
877
878 def _lower(self):
879 if (
880 self.operand("npartitions") == 1
881 or self.frame.npartitions == 1
882 and (self.user_divisions is None or len(self.user_divisions) == 2)
883 and self.operand("npartitions") is None
884 ):
885 expr = self.frame
886 if self.frame.npartitions > 1:
887 expr = RepartitionToFewer(expr, 1)
888
889 index_set = SetIndexBlockwise(expr, self._other, self.drop, None)
890 return SortIndexBlockwise(index_set)
891
892 if self.user_divisions is None:
893 divisions = self._divisions()
894 if (
895 is_index_like(self._divisions_column._meta)
896 and self.other.divisions == divisions
897 ):
898 presorted = True
899 else:
900 presorted = _get_divisions(
901 self.frame,
902 self.other,
903 self._npartitions_input,
904 self.ascending,
905 upsample=self.upsample,
906 )[3]
907
908 if presorted and self.npartitions == self.frame.npartitions:
909 index_set = SetIndexBlockwise(
910 self.frame, self._other, self.drop, divisions, self.append
911 )
912 return SortIndexBlockwise(index_set)
913
914 return SetPartition(
915 self.frame,
916 self._other,
917 self.drop,
918 self._npartitions_input if self.user_divisions is None else None,
919 self.ascending,
920 self.upsample,
921 self.user_divisions,
922 self.shuffle_method,
923 self.options,
924 )
925
926 def _simplify_up(self, parent, dependents):
927 from dask.dataframe.dask_expr._expr import Filter, Head, Tail

Callers

nothing calls this directly

Calls 8

RepartitionToFewerClass · 0.90
is_index_likeFunction · 0.90
SetIndexBlockwiseClass · 0.85
SortIndexBlockwiseClass · 0.85
_get_divisionsFunction · 0.85
SetPartitionClass · 0.85
operandMethod · 0.80
_divisionsMethod · 0.45

Tested by

no test coverage detected