io.divolte.spark.avro

AvroDStreamMagnet

class AvroDStreamMagnet[K, +V >: Null <: IndexedRecord] extends AnyRef

Magnet for operations on a DStream containing Avro records.

This is motivated by the fact that Avro records (ironically) don't implement the java.io.Serializable interface, which means that the only safe operations are those which cannot result in Spark trying to serialize the records.

For convenience, we provide two operations:

  1. Extract a set of fields, specified by name. These are extracted to a scala.Seq[Option[AnyRef]] collection. 2. Convert to a io.divolte.spark.avro.Record.
K

the type of the decoded Kafka keys for each message.

V

the type of the deserialized Avro record.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. AvroDStreamMagnet
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def fields(fieldNames: String*): DStream[(K, Seq[Option[Serializable]])]

    Extract specific fields from an RDD of Avro records.

    Extract specific fields from an RDD of Avro records.

    This operation extracts specific fields from an RDD of Avro records. Field values are wrapped in an Option.

    fieldNames

    the names of the fields to extract

    returns

    a DStream of sequences containing the field values requested.

  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. def mapValues[U <: Serializable](f: (V) ⇒ U)(implicit arg0: ClassTag[U]): DStream[(K, U)]

    Extract serializable values from a DStream of Avro records.

    Extract serializable values from a DStream of Avro records.

    U

    The (serializable) type of the value extracted from a record.

    f

    A function to extract the serializable values from a record.

    returns

    A DStream containing the extracted values.

  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  20. def toRecords: DStream[(K, Record)]

    View the DStream of Avro records as io.divolte.spark.avro.Record instances.

    View the DStream of Avro records as io.divolte.spark.avro.Record instances.

    This operation must perform a deep copy of the Avro record with conversions to ensure that everything can be serialized. If you only wish to access a small subset of the Avro record, it can be more efficient to extract the fields you need using AvroRDDMagnet#fields.

    returns

    a DStream of io.divolte.spark.avro.Record instances built from the Avro records.

  21. def toString(): String

    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped