code: def dump_stream(self, iterator, stream):
          
  
          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)
docs: 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.