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_literal_expression_with_arrays(self):
      l0 = (
          LiteralExpression._from_value(["x", "y", "z"])
          .to_plan(None)
          .literal
      )
      self.assertTrue(l0.array.element_type.HasField("string"))
      self.assertEqual(len(l0.array.elements), 3)
      self.assertEqual(l0.array.elements[0].string, "x")
      self.assertEqual(l0.array.elements[1].string, "y")
      self.assertEqual(l0.array.elements[2].string, "z")
  
      l1 = LiteralExpression._from_value([3, -3]).to_plan(None).literal
      self.assertTrue(l1.array.element_type.HasField("integer"))
      self.assertEqual(len(l1.array.elements), 2)
      self.assertEqual(l1.array.elements[0].integer, 3)
      self.assertEqual(l1.array.elements[1].integer, -3)
  
      l2 = (
          LiteralExpression._from_value([float("nan"), -3.0, 0.0])
          .to_plan(None)
          .literal
      )
      self.assertTrue(l2.array.element_type.HasField("double"))
      self.assertEqual(len(l2.array.elements), 3)
      self.assertTrue(math.isnan(l2.array.elements[0].double))
      self.assertEqual(l2.array.elements[1].double, -3.0)
      self.assertEqual(l2.array.elements[2].double, 0.0)
  
      l3 = (
          LiteralExpression._from_value([[3, 4], [5, 6, 7]])
          .to_plan(None)
          .literal
      )
      self.assertTrue(l3.array.element_type.HasField("array"))
      self.assertTrue(
          l3.array.element_type.array.element_type.HasField("integer")
      )
      self.assertEqual(len(l3.array.elements), 2)
      self.assertEqual(len(l3.array.elements[0].array.elements), 2)
      self.assertEqual(len(l3.array.elements[1].array.elements), 3)
  
      l4 = (
          LiteralExpression._from_value(
              [[float("inf"), 0.4], [0.5, float("nan")], []]
          )
          .to_plan(None)
          .literal
      )
      self.assertTrue(l4.array.element_type.HasField("array"))
      self.assertTrue(
          l4.array.element_type.array.element_type.HasField("double")
      )
      self.assertEqual(len(l4.array.elements), 3)
      self.assertEqual(len(l4.array.elements[0].array.elements), 2)
      self.assertEqual(len(l4.array.elements[1].array.elements), 2)
      self.assertEqual(len(l4.array.elements[2].array.elements), 0)
  
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 54 for calling the SparkConnectPlanTests obj's underlying member method code with example usage: obj.test_literal_expression_with_arrays() without return types