class_docstr: SortKey class to convert between different sort args formats.
class_docstr_tok: ["SortKey","class","to","convert","between","different","sort","args","formats","."]
code: def __init__(
      self,
      key: Optional[Union[str, List[str]]] = None,
      descending: Union[bool, List[bool]] = False,
      boundaries: Optional[list] = None,
  ):
      if key is None:
          key = []
      if isinstance(key, str):
          key = [key]
      if not (
          isinstance(key, list) and all(isinstance(k, str) for k in key)
      ):
          raise ValueError(
              f"Key must be a string or a list of strings, but got {key}."
          )
      if isinstance(descending, bool):
          descending = [descending for _ in key]
      elif isinstance(descending, list):
          if len(descending) != len(key):
              raise ValueError(
                  "Length of `descending` does not match the length of the key."
              )
          if len(set(descending)) != 1:
              raise ValueError(
                  "Sorting with mixed key orders not supported yet."
              )
      self._columns = key
      self._descending = descending
      if boundaries:
          for item in boundaries:
              if not isinstance(item, (int, float)):
                  raise ValueError(
                      "The type of items in boundaries must be int or float."
                  )
          boundaries = list(set(boundaries))
          boundaries.sort()
      self._boundaries = boundaries
  
imports: from typing import TYPE_CHECKING, List, Optional, Tuple, TypeVar, Union
  import numpy
  from ray.data._internal.block_list import BlockList
  from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder
  from ray.data._internal.execution.interfaces import TaskContext
  from ray.data._internal.progress_bar import ProgressBar
  from ray.data._internal.push_based_shuffle import PushBasedShufflePlan
  from ray.data._internal.remote_fn import cached_remote_fn
  from ray.data._internal.shuffle import ShuffleOp, SimpleShufflePlan
  from ray.data.block import Block, BlockAccessor, BlockExecStats, BlockMetadata
  from ray.data.context import DataContext
  from ray.types import ObjectRef
label_desc: Use image node_id 1 to create a new SortKey object  with example: obj = SortKey(key, descending, boundaries)