class_docstr: These test cases exercise the interface to the proto plan
  generation but do not call Spark.
class_docstr_tok: ["These","test","cases","exercise","the","interface","to","the","proto","plan","generation","but","do","not","call","Spark","."]
code: def test_sort(self):
      df = self.connect.readTable(table_name=self.tbl_name)
      plan = (
          df.filter(df.col_name > 3)
          .sort("col_a", "col_b")
          ._plan.to_proto(self.connect)
      )
      self.assertEqual(
          [
              f.child.unresolved_attribute.unparsed_identifier
              for f in plan.root.sort.order
          ],
          ["col_a", "col_b"],
      )
      self.assertEqual(plan.root.sort.is_global, True)
      self.assertEqual(
          plan.root.sort.order[0].direction,
          proto.Expression.SortOrder.SortDirection.SORT_DIRECTION_ASCENDING,
      )
      self.assertEqual(
          plan.root.sort.order[0].direction,
          proto.Expression.SortOrder.NullOrdering.SORT_NULLS_FIRST,
      )
      self.assertEqual(
          plan.root.sort.order[1].direction,
          proto.Expression.SortOrder.SortDirection.SORT_DIRECTION_ASCENDING,
      )
      self.assertEqual(
          plan.root.sort.order[1].direction,
          proto.Expression.SortOrder.NullOrdering.SORT_NULLS_FIRST,
      )
  
      plan = (
          df.filter(df.col_name > 3)
          .orderBy("col_a", "col_b")
          ._plan.to_proto(self.connect)
      )
      self.assertEqual(
          [
              f.child.unresolved_attribute.unparsed_identifier
              for f in plan.root.sort.order
          ],
          ["col_a", "col_b"],
      )
      self.assertEqual(plan.root.sort.is_global, True)
  
      plan = (
          df.filter(df.col_name > 3)
          .sortWithinPartitions(df.col_a.desc(), df.col_b.asc())
          ._plan.to_proto(self.connect)
      )
      self.assertEqual(
          [
              f.child.unresolved_attribute.unparsed_identifier
              for f in plan.root.sort.order
          ],
          ["col_a", "col_b"],
      )
      self.assertEqual(plan.root.sort.is_global, False)
      self.assertEqual(
          plan.root.sort.order[0].direction,
          proto.Expression.SortOrder.SortDirection.SORT_DIRECTION_DESCENDING,
      )
      self.assertEqual(
          plan.root.sort.order[0].direction,
          proto.Expression.SortOrder.NullOrdering.SORT_NULLS_LAST,
      )
      self.assertEqual(
          plan.root.sort.order[1].direction,
          proto.Expression.SortOrder.SortDirection.SORT_DIRECTION_ASCENDING,
      )
      self.assertEqual(
          plan.root.sort.order[1].direction,
          proto.Expression.SortOrder.NullOrdering.SORT_NULLS_FIRST,
      )
  
imports: import unittest
  import uuid
  import datetime
  import decimal
  import math
  from pyspark.testing.connectutils import PlanOnlyTestFixture, should_test_connect, connect_requirement_message
  from pyspark.errors import PySparkValueError
label_desc: Use image node_id 22 for calling the SparkConnectPlanTests obj's underlying member method code with example usage: obj.test_sort() without return types