class_docstr: Serializer used by Python worker to evaluate Pandas UDFs
class_docstr_tok: ["Serializer","used","by","Python","worker","to","evaluate","Pandas","UDFs"]
docstr: Override because Pandas UDFs require a START_ARROW_STREAM before the Arrow stream is sent.
  This should be sent after creating the first record batch so in case of an error, it can
  be sent back to the JVM before the Arrow stream starts.
code: def dump_stream(self, iterator, stream):
      """
      Override because Pandas UDFs require a START_ARROW_STREAM before the Arrow stream is sent.
      This should be sent after creating the first record batch so in case of an error, it can
      be sent back to the JVM before the Arrow stream starts.
      """
  
      def init_stream_yield_batches():
          should_write_start_length = True
          for series in iterator:
              batch = self._create_batch(series)
              if should_write_start_length:
                  write_int(SpecialLengths.START_ARROW_STREAM, stream)
                  should_write_start_length = False
              yield batch
  
      return ArrowStreamSerializer.dump_stream(
          self, init_stream_yield_batches(), stream
      )
  
imports: from pyspark.errors import PySparkRuntimeError, PySparkTypeError, PySparkValueError
  from pyspark.loose_version import LooseVersion
  from pyspark.serializers import Serializer, read_int, write_int, UTF8Deserializer, CPickleSerializer
  from pyspark.sql.pandas.types import from_arrow_type, to_arrow_type, _create_converter_from_pandas, _create_converter_to_pandas
  from pyspark.sql.types import DataType, StringType, StructType, BinaryType, StructField, LongType, IntegerType
label_desc: Use image node_id 5 for calling the ArrowStreamPandasUDFSerializer obj's underlying member method code with example usage: obj.dump_stream(iterator, stream) and returns: ArrowStreamSerializer