Coder Grammar is used to explicitly specify Coder derivation for types used in pipelines.
Coder Grammar is used to explicitly specify Coder derivation for types used in pipelines.
The CoderGrammar can be used as follows: - To find the Coder being implicitly derived by Scio. (Debugging)
def c: Coder[MyType] = Coder[MyType]
- To generate an implicit instance to be in scope for type T, use Coder.gen
implicit def coderT: Coder[T] = Coder.gen[T]
Note: Implicit Coders for all parameters of the constructor of type T should be in scope for Coder.gen to be able to derive the Coder.
- To define a Coder of custom type, where the type can be mapped to some other type for which a Coder is known, use Coder.xmap
- To explicitly use kryo Coder use Coder.kryo