class_docstr: TransformedDStream is a DStream generated by an Python function
  transforming each RDD of a DStream to another RDDs.
  
  Multiple continuous transformations of DStream can be combined into
  one transformation.
class_docstr_tok: ["TransformedDStream","is","a","DStream","generated","by","an","Python","function","transforming","each","RDD","of","a","DStream","to","another","RDDs",".","Multiple","continuous","transformations","of","DStream","can","be","combined","into","one","transformation","."]
code: def __init__(
      self,
      prev: DStream[T],
      func: Union[
          Callable[[RDD[T]], RDD[U]],
          Callable[[datetime, RDD[T]], RDD[U]],
      ],
  ):
      self._ssc = prev._ssc
      self._sc = self._ssc._sc
      self._jrdd_deserializer = self._sc.serializer
      self.is_cached = False
      self.is_checkpointed = False
      self._jdstream_val = None
  
      # Using type() to avoid folding the functions and compacting the DStreams which is not
      # not strictly an object of TransformedDStream.
      if (
          type(prev) is TransformedDStream
          and not prev.is_cached
          and not prev.is_checkpointed
      ):
          prev_func: Callable = prev.func
          func = cast(Callable[[datetime, RDD[T]], RDD[U]], func)
          self.func: Union[
              Callable[[RDD[T]], RDD[U]],
              Callable[[datetime, RDD[T]], RDD[U]],
          ] = lambda t, rdd: func(t, prev_func(t, rdd))
          self.prev: DStream[T] = prev.prev
      else:
          self.prev = prev
          self.func = func
  
imports: import operator
  import time
  from itertools import chain
  from datetime import datetime
  from typing import Any, Callable, Generic, Hashable, Iterable, List, Optional, Tuple, TypeVar, Union, TYPE_CHECKING, cast, overload
  from py4j.protocol import Py4JJavaError
  from py4j.java_gateway import JavaObject
  from pyspark.storagelevel import StorageLevel
  from pyspark.streaming.util import rddToFileName, TransformFunction
  from pyspark.rdd import portable_hash, RDD
  from pyspark.resultiterable import ResultIterable
label_desc: Use image node_id 3 to create a new TransformedDStream object from inherited base classes: DStream with example: obj = TransformedDStream(prev, func)