package avro
Main package for Avro APIs. Import all.
import com.spotify.scio.avro._
- Source
- package.scala
- Alphabetic
- By Inheritance
- avro
- AvroCoders
- CoderGrammar
- Syntax
- SCollectionSyntax
- ScioContextSyntax
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
Type Members
- sealed trait AvroIO[T <: IndexedRecord] extends ScioIO[T]
- final case class AvroTaps(self: Taps) extends Product with Serializable
- final case class AvroTypedIO[T <: HasAvroAnnotation](path: String)(implicit evidence$1: scala.reflect.api.JavaUniverse.TypeTag[T], evidence$2: Coder[T]) extends ScioIO[T] with Product with Serializable
- final case class GenericRecordIO(path: String, schema: Schema) extends AvroIO[GenericRecord] with Product with Serializable
- final case class GenericRecordParseIO[T](path: String, parseFn: (GenericRecord) => T)(implicit evidence$2: Coder[T]) extends ScioIO[T] with Product with Serializable
Given a parseFn, read GenericRecord and apply a function mapping => T before producing output.
Given a parseFn, read GenericRecord and apply a function mapping => T before producing output. This IO applies the function at the time of de-serializing Avro GenericRecords.
This IO doesn't define write, and should not be used to write Avro GenericRecords.
- final case class GenericRecordTap(path: String, schema: Schema, params: ReadParam) extends Tap[GenericRecord] with Product with Serializable
Tap for GenericRecord Avro files.
- final case class ObjectFileIO[T](path: String)(implicit evidence$1: Coder[T]) extends ScioIO[T] with Product with Serializable
- final case class ProtobufIO[T <: Message](path: String)(implicit evidence$1: ClassTag[T]) extends ScioIO[T] with Product with Serializable
- final case class SpecificRecordIO[T <: SpecificRecord](path: String)(implicit evidence$1: ClassTag[T]) extends AvroIO[T] with Product with Serializable
- final case class SpecificRecordTap[T <: SpecificRecord](path: String, params: ReadParam[T])(implicit evidence$1: ClassTag[T]) extends Tap[T] with Product with Serializable
Tap for SpecificRecord Avro files.
- type doc = avro.types.doc
Annotation for Avro field and record documentation.
Value Members
- val AvroType: avro.types.AvroType.type
Typed Avro annotations and converters.
- def aggregate[T](implicit arg0: Coder[T]): Coder[Iterable[T]]
- Definition Classes
- CoderGrammar
- def avroCoder[T <: IndexedRecord](factory: AvroDatumFactory[T], schema: Schema): Coder[T]
- Definition Classes
- AvroCoders
- implicit def avroFilesSCollectionOps[T](c: SCollection[T])(implicit ev: <:<[T, String]): FilesSCollectionOps
- Definition Classes
- SCollectionSyntax
- def avroGenericRecordCoder: Coder[GenericRecord]
- Definition Classes
- AvroCoders
- def avroGenericRecordCoder(schema: Schema): Coder[GenericRecord]
Create a Coder for Avro GenericRecord given the schema of the GenericRecord.
Create a Coder for Avro GenericRecord given the schema of the GenericRecord.
- schema
AvroSchema for the Coder.
- returns
Coder[GenericRecord]
- Definition Classes
- AvroCoders
- implicit def avroGenericRecordSCollectionOps(c: SCollection[GenericRecord]): GenericRecordSCollectionOps
- Definition Classes
- SCollectionSyntax
- implicit def avroObjectFileSCollectionOps[T](c: SCollection[T]): ObjectFileSCollectionOps[T]
- Definition Classes
- SCollectionSyntax
- implicit def avroProtobufSCollectionOps[T <: Message](c: SCollection[T]): ProtobufSCollectionOps[T]
- Definition Classes
- SCollectionSyntax
- implicit def avroScioContextOps(c: ScioContext): ScioContextOps
- Definition Classes
- ScioContextSyntax
- implicit def avroSpecificFixedCoder[T <: SpecificFixed](implicit arg0: ClassTag[T]): Coder[T]
- Definition Classes
- AvroCoders
- implicit def avroSpecificRecordCoder[T <: SpecificRecord](implicit arg0: ClassTag[T]): Coder[T]
- Definition Classes
- AvroCoders
- implicit def avroSpecificRecordSCollectionOps[T <: SpecificRecord](c: SCollection[T]): SpecificRecordSCollectionOps[T]
- Definition Classes
- SCollectionSyntax
- implicit def avroTypedAvroSCollectionOps[T <: HasAvroAnnotation](c: SCollection[T]): TypedAvroSCollectionOps[T]
- Definition Classes
- SCollectionSyntax
- def beam[T](beam: Coder[T]): Coder[T]
- Definition Classes
- CoderGrammar
- def disjunction[T, Id](typeName: String, coder: Map[Id, Coder[T]])(id: (T) => Id)(implicit arg0: Coder[Id]): Coder[T]
- Definition Classes
- CoderGrammar
- def kryo[T](implicit ct: ClassTag[T]): Coder[T]
Create an instance of Kryo Coder for a given Type.
Create an instance of Kryo Coder for a given Type.
Eg: A kryo Coder for org.joda.time.Interval would look like:
implicit def jiKryo: Coder[Interval] = Coder.kryo[Interval]
- Definition Classes
- CoderGrammar
- def kv[K, V](koder: Coder[K], voder: Coder[V]): Coder[KV[K, V]]
- Definition Classes
- CoderGrammar
- def raw[T](beam: Coder[T]): Coder[T]
Create a ScioCoder from a Beam Coder
Create a ScioCoder from a Beam Coder
- Definition Classes
- CoderGrammar
- def transform[U, T](c: Coder[U])(f: (Coder[U]) => Coder[T])(implicit ct: ClassTag[T]): Coder[T]
- Definition Classes
- CoderGrammar
- def xmap[U, T](c: Coder[U])(f: (U) => T, t: (T) => U)(implicit ct: ClassTag[T]): Coder[T]
Given a Coder[A], create a Coder[B] by defining two functions A => B and B => A.
Given a Coder[A], create a Coder[B] by defining two functions A => B and B => A. The Coder[A] can be resolved implicitly by calling Coder[A]
Eg: Coder for org.joda.time.Interval can be defined by having the following implicit in scope. Without this implicit in scope Coder derivation falls back to Kryo.
implicit def jiCoder: Coder[Interval] = Coder.xmap(Coder[(Long, Long)])(t => new Interval(t._1, t._2), i => (i.getStartMillis, i.getEndMillis))
In the above example we implicitly derive Coder[(Long, Long)] and we define two functions, one to convert a tuple (Long, Long) to Interval, and a second one to convert an Interval to a tuple of (Long, Long)
- Definition Classes
- CoderGrammar
- object AvroIO
- object AvroSysProps extends SysProps
- object AvroTypedIO extends Serializable
- object GenericRecordIO extends Serializable
- object GenericRecordParseIO extends Serializable
- object ObjectFileIO extends Serializable
- object ObjectFileTap
- object ProtobufFileTap
- object ProtobufIO extends Serializable
- object SpecificRecordIO extends Serializable