nodes: 0, module; 1, function_definition; 2, function_name:sortBy; 3, parameters; 4, block; 5, identifier:self; 6, identifier:col; 7, list_splat_pattern; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, return_statement; 13, identifier:cols; 14, comment:"""Sorts the output in each bucket by the given columns on the file system.
  
          :param col: a name of a column, or a list of names.
          :param cols: additional names (optional). If `col` is a list it should be empty.
  
          >>> (df.write.format('parquet')  # doctest: +SKIP
          ...     .bucketBy(100, 'year', 'month')
          ...     .sortBy('day')
          ...     .mode("overwrite")
          ...     .saveAsTable('sorted_bucketed_table'))
          """; 15, call; 16, block; 17, boolean_operator; 18, block; 19, assignment; 20, identifier:self; 21, identifier:isinstance; 22, argument_list; 23, if_statement; 24, expression_statement; 25, not_operator; 26, not_operator; 27, raise_statement; 28, attribute; 29, call; 30, identifier:col; 31, tuple; 32, identifier:cols; 33, block; 34, assignment; 35, call; 36, parenthesized_expression; 37, call; 38, identifier:self; 39, identifier:_jwrite; 40, attribute; 41, argument_list; 42, identifier:list; 43, identifier:tuple; 44, raise_statement; 45, pattern_list; 46, expression_list; 47, identifier:all; 48, generator_expression; 49, call; 50, identifier:TypeError; 51, argument_list; 52, attribute; 53, identifier:sortBy; 54, identifier:col; 55, call; 56, call; 57, identifier:col; 58, identifier:cols; 59, subscript; 60, subscript; 61, call; 62, for_in_clause; 63, identifier:isinstance; 64, argument_list; 65, string:"all names should be `str`"; 66, identifier:self; 67, identifier:_jwrite; 68, identifier:_to_seq; 69, argument_list; 70, identifier:ValueError; 71, argument_list; 72, identifier:col; 73, integer:0; 74, identifier:col; 75, slice; 76, identifier:isinstance; 77, argument_list; 78, identifier:c; 79, identifier:cols; 80, identifier:col; 81, identifier:basestring; 82, attribute; 83, identifier:cols; 84, call; 85, integer:1; 86, identifier:c; 87, identifier:basestring; 88, attribute; 89, identifier:_sc; 90, attribute; 91, argument_list; 92, identifier:self; 93, identifier:_spark; 94, string:"col is a {0} but cols are not empty"; 95, identifier:format; 96, call; 97, identifier:type; 98, argument_list; 99, identifier:col
code: def sortBy(self, col, *cols):
          """Sorts the output in each bucket by the given columns on the file system.
  
          :param col: a name of a column, or a list of names.
          :param cols: additional names (optional). If `col` is a list it should be empty.
  
          >>> (df.write.format('parquet')  # doctest: +SKIP
          ...     .bucketBy(100, 'year', 'month')
          ...     .sortBy('day')
          ...     .mode("overwrite")
          ...     .saveAsTable('sorted_bucketed_table'))
          """
          if isinstance(col, (list, tuple)):
              if cols:
                  raise ValueError("col is a {0} but cols are not empty".format(type(col)))
  
              col, cols = col[0], col[1:]
  
          if not all(isinstance(c, basestring) for c in cols) or not(isinstance(col, basestring)):
              raise TypeError("all names should be `str`")
  
          self._jwrite = self._jwrite.sortBy(col, _to_seq(self._spark._sc, cols))
          return self